using System; using System.Collections; using System.Collections.Generic; using JetBrains.Annotations; using UnityEngine; public class CombatScenarioEventOS : MonoBehaviour { public static CombatScenarioEventOS Instance { get; private set; } private EventLockSvc eventLockSvc; private EventHandlerSvc eventHandlerSvc; [SerializeField] private bool needDebugLog = true; public void SetDebugLog(bool value) => needDebugLog = value; public bool GetNeedDebugLog() => needDebugLog; private void Awake() { if (Instance != null && Instance != this) { Destroy(gameObject); return; } Instance = this; eventLockSvc = new EventLockSvc(); eventHandlerSvc = new EventHandlerSvc(); DontDestroyOnLoad(gameObject); } // *************** 锁 **************** public bool LOCK_APPLY(EventLock.LOCK_EXCLUSIVE_CARD_ENUM lock_name) => eventLockSvc.LOCK_APPLY(lock_name); public void LOCK_RELEASE(EventLock.LOCK_EXCLUSIVE_CARD_ENUM lock_name) => eventLockSvc.LOCK_RELEASE(lock_name); public bool LOCK_GET(EventLock.LOCK_EXCLUSIVE_CARD_ENUM lock_name) => eventLockSvc.LOCK_GET(lock_name); // *************** 事件系统 **************** public void EVENT_REGISTER(EventData.EVENT_REGISTER_EVENT_ENUM event_name, Action callback) where T : struct => eventHandlerSvc.EVENT_REGISTER(event_name, callback); public void EVENT_TRIGGER(EventData.EVENT_REGISTER_EVENT_ENUM event_name, object data) => eventHandlerSvc.EVENT_TRIGGER(event_name, data); public void EVENT_UNREGISTER(EventData.EVENT_REGISTER_EVENT_ENUM event_name, Action callback) where T : struct => eventHandlerSvc.EVENT_UNREGISTER(event_name, callback); }