diff --git a/Assets/00_scripts/Events/EventSvcHandler.cs b/Assets/00_scripts/Events/EventSvcHandler.cs index d3bacfa..463eb7d 100644 --- a/Assets/00_scripts/Events/EventSvcHandler.cs +++ b/Assets/00_scripts/Events/EventSvcHandler.cs @@ -23,12 +23,12 @@ public class EventSvcHandler { if (!actionBindMap.TryGetValue(eventName, out var value)) { - if (GetNeedDebugLog()) Debug.LogError($"{msg}: 未绑定的数据类型[{eventName}]"); + Debug.LogError($"{msg}: 未绑定的数据类型[{eventName}]"); return false; } if (value == t) return true; - if (GetNeedDebugLog()) Debug.LogError($"{msg}: 未响应的数据类型[{eventName}]"); + Debug.LogError($"{msg}: 未响应的数据类型[{eventName}]"); return false; } @@ -40,6 +40,7 @@ public class EventSvcHandler if (!GET_DEFINE_EVENT(eventName, typeof(T), "注册事件失败")) return; actionBroadcast.TryAdd(eventName, null); actionBroadcast[eventName] = (Action)actionBroadcast[eventName] + callback; + if (GetNeedDebugLog()) Debug.Log($"注册事件成功: [{eventName}]"); } // ================================ @@ -50,6 +51,7 @@ public class EventSvcHandler if (!GET_DEFINE_EVENT(eventName, typeof(T), "注销事件失败")) return; actionBroadcast[eventName] = (Action)actionBroadcast[eventName] - callback; if (actionBroadcast[eventName] == null) actionBroadcast.Remove(eventName); + if (GetNeedDebugLog()) Debug.Log($"注销事件成功: [{eventName}]"); } // ================================ @@ -61,6 +63,11 @@ public class EventSvcHandler if (actionBroadcast.TryGetValue(eventName, out var action)) { (action as Action)?.Invoke(param); + if (GetNeedDebugLog()) Debug.Log($"触发广播事件: [{eventName}]"); + } + else + { + Debug.LogWarning($"触发广播事件错误: 未找到事件[{eventName}]"); } } } \ No newline at end of file