From cde46100ff870dab5fbc79a1db6925b725aae22a Mon Sep 17 00:00:00 2001 From: BobSong <605277374@qq.com> Date: Sun, 14 Sep 2025 21:22:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=84=9A=E6=9C=AC=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Fishing2.meta | 7 ++++++- .../Scripts/Fishing2/Message/Event/NumericChangeEvent.cs | 1 + .../Message/Map2C_RolePropertyChangeNotifyHandler.cs | 1 + Assets/Scripts/Fishing2/Unit/Unity/UnitUnityComponent.cs | 3 ++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Fishing2.meta b/Assets/Scripts/Fishing2.meta index 7a0b13523..079701c61 100644 --- a/Assets/Scripts/Fishing2.meta +++ b/Assets/Scripts/Fishing2.meta @@ -1,3 +1,8 @@ fileFormatVersion: 2 guid: 370fe07e6dd1446298721033a240b4fd -timeCreated: 1756363974 \ No newline at end of file +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Fishing2/Message/Event/NumericChangeEvent.cs b/Assets/Scripts/Fishing2/Message/Event/NumericChangeEvent.cs index 97daaa896..08c5af9bf 100644 --- a/Assets/Scripts/Fishing2/Message/Event/NumericChangeEvent.cs +++ b/Assets/Scripts/Fishing2/Message/Event/NumericChangeEvent.cs @@ -9,6 +9,7 @@ namespace NBF.Fishing2 { protected override void Handler(NumericChange self) { + if (self.Old == self.New) return; if (self.NumericType == NumericType.Flashlight) { var flashlight = self.MapUnit.GetComponent(); diff --git a/Assets/Scripts/Fishing2/Message/Map2C_RolePropertyChangeNotifyHandler.cs b/Assets/Scripts/Fishing2/Message/Map2C_RolePropertyChangeNotifyHandler.cs index 610e6e3c3..f27be2f69 100644 --- a/Assets/Scripts/Fishing2/Message/Map2C_RolePropertyChangeNotifyHandler.cs +++ b/Assets/Scripts/Fishing2/Message/Map2C_RolePropertyChangeNotifyHandler.cs @@ -8,6 +8,7 @@ namespace NBF.Fishing2 { protected override async FTask Run(Session session, Map2C_RolePropertyChangeNotify message) { + Log.Info($"收到角色属性推送 id={message.Id}"); var map = App.Main.GetComponent(); var unit = map.Units[message.Id]; var numericComponent = unit.GetComponent(); diff --git a/Assets/Scripts/Fishing2/Unit/Unity/UnitUnityComponent.cs b/Assets/Scripts/Fishing2/Unit/Unity/UnitUnityComponent.cs index 37aa72c82..9ed80f509 100644 --- a/Assets/Scripts/Fishing2/Unit/Unity/UnitUnityComponent.cs +++ b/Assets/Scripts/Fishing2/Unit/Unity/UnitUnityComponent.cs @@ -23,7 +23,8 @@ namespace NBF.Fishing2 GameObject = gameObject; Transform = gameObject.transform; Asset = gameObject.GetComponent(); - Parent.AddComponent(); + Parent.GetOrAddComponent(); + Parent.GetOrAddComponent(); }