Files
TaiWan/Assets/Roaming/Scripts/Controller/Camera/BaseController.cs
2025-10-31 15:20:38 +08:00

113 lines
2.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public class BaseController : MonoBehaviour
{
/// <summary>
/// 是否在键盘控制中
/// </summary>
private static bool isKeyOnControl;
/// <summary>
/// 是否在鼠标控制中
/// </summary>
public static bool IsMouseOnControl;
/// <summary>
/// 是否自动寻路中
/// </summary>
private static bool isNavOnControl;
/// <summary>
/// 是否在触屏控制中
/// </summary>
private static bool isTouchOnControl;
/// <summary>
/// 是否在触屏控制中
/// </summary>
private static bool isJoyStickOnControl;
/// <summary>
/// 是否UI单击
/// </summary>
public static bool IsUIClicked;
/// <summary>
/// 能否控制
/// </summary>
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;
}