AquaDX/AquaMai/UX/SinglePlayer.cs

30 lines
1.1 KiB
C#
Raw Normal View History

using System;
using HarmonyLib;
using UnityEngine;
2024-02-07 18:16:07 +08:00
namespace AquaMai.UX
{
// Hides the 2p (right hand side) UI.
// Note: this is not my original work. I simply interpreted the code and rewrote it as a mod.
public class SinglePlayer
{
[HarmonyPrefix]
[HarmonyPatch(typeof(Main.GameMain), "LateInitialize", new Type[] { typeof(MonoBehaviour), typeof(Transform), typeof(Transform) })]
public static bool LateInitialize(MonoBehaviour gameMainObject, ref Transform left, ref Transform right)
{
left.transform.position = Vector3.zero;
right.localScale = Vector3.zero;
GameObject.Find("Mask").SetActive(false);
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(MeshButton), "IsPointInPolygon", new Type[] { typeof(Vector2[]), typeof(Vector2) })]
2024-05-22 12:04:36 +08:00
public static bool IsPointInPolygon(Vector2[] polygon, ref Vector2 point, MeshButton __instance, ref bool __result)
{
2024-05-22 12:04:36 +08:00
__result = RectTransformUtility.RectangleContainsScreenPoint(__instance.GetComponent<RectTransform>(), point, Camera.main);
return false;
}
}
2024-05-22 12:04:36 +08:00
}