using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; public class BaseController : MonoBehaviour { /// /// 是否在键盘控制中 /// private static bool isKeyOnControl; /// /// 是否在鼠标控制中 /// public static bool IsMouseOnControl; /// /// 是否自动寻路中 /// private static bool isNavOnControl; /// /// 是否在触屏控制中 /// private static bool isTouchOnControl; /// /// 是否在触屏控制中 /// private static bool isJoyStickOnControl; /// /// 是否UI单击 /// public static bool IsUIClicked; /// /// 能否控制 /// public static bool CanControl = false; public static bool IsAnimatorOnControl; public static bool IsAutoNavigating; public static bool IsKeyOnControl { get => isKeyOnControl; set { if (isKeyOnControl != value) { isKeyOnControl = value; if (!isKeyOnControl) OnStatusChanged(); } } } public static bool IsNavOnControl { get => isNavOnControl; set { if (isNavOnControl != value) { isNavOnControl = value; if (!isNavOnControl) OnStatusChanged(); } } } public static bool IsTouchOnControl { get => isTouchOnControl; set { if (isTouchOnControl != value) { isTouchOnControl = value; if (!isTouchOnControl) OnStatusChanged(); } } } public static bool IsJoyStickOnControl { get => isJoyStickOnControl; set { if (isJoyStickOnControl != value) { isJoyStickOnControl = value; if (!isJoyStickOnControl) OnStatusChanged(); } } } public static void HideView() { CanControl = true; if (AudioManager.Instance != null) { AudioManager.Instance.ResumeBackgroundMusic(); } CommonData.ReleaseMemory(); } static void OnStatusChanged() { if(StatusChanged != null) { StatusChanged(); } } public static event UnityAction StatusChanged; }