From 4c2b7203add52bc8da07952262fb2429cbd16134 Mon Sep 17 00:00:00 2001 From: mnjnhuang <1090031856@qq.com> Date: Tue, 18 Nov 2025 16:46:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=8B=E4=BB=B6=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/00_scripts/Events/EventSvcHandler.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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