Browse Source

增加支持战斗服的自定义消息ClientMsgEvent,单位死亡处理移动到BattleMgr

大爷 1 year ago
parent
commit
a05ebff88c

BIN
GameEditor/Debug/CommonAI.dll


BIN
GameEditor/Debug/CommonAI.pdb


BIN
Unity/Assets/Plugins/BattlePlugin/CommonAI.dll


BIN
Unity/Assets/Plugins/BattlePlugin/CommonAI.pdb


BIN
Unity/Assets/Res/CodeDll/CommonAI.dll.bytes


+ 7 - 0
Unity/Assets/Res/Config/GenFromExcel/MonsterCategory.bytes.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: ee066fd7d87f22841976e661a5293082
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 20 - 0
Unity/Assets/Scripts/Codes/Hotfix/Client/battle/BattleMgr.cs

@@ -152,6 +152,21 @@ namespace ET
             });
             eventHandler.AddListener<UnitDeadEvent>((ev) =>
             {
+                var e = ev as UnitDeadEvent;
+                Log.Debug($"Unit({e.object_id}) dead");
+                EventSystem.Instance.Publish<PlayAnimatorEvent>(PlayAnimatorEvent.Static.Clone(
+                    e.ObjectID, AnimatorEventType.Dead));
+
+                var unit = UnitMgr.Instance.GetUnit(e.ObjectID);
+                if(unit != null && unit is BattleUnit bunit)
+                {
+                    var launcheffect = bunit.ZUnit.Info.DeadActionEffect;
+                    if (launcheffect != null)
+                    {
+                        EventSystem.Instance.Publish<PlayEffectEvent>(PlayEffectEvent.Static.Clone(launcheffect, unit.Id, CommonLang.Geometry.Vector3.Zero));
+                    }
+                }
+                //TODO: 过几秒后,自行清理尸体
             });
             eventHandler.AddListener<UnitRebirthEvent>((ev) =>
             {
@@ -254,6 +269,11 @@ namespace ET
                     EventSystem.Instance.Publish(PlayEffectEvent.Static.Clone(e.effect, e.hostId, vecTemp));
                 }
             });
+            eventHandler.AddListener<ClientMsgEvent>((ev) =>
+            {
+                var e = ev as ClientMsgEvent;
+                Log.Debug($">>>Battle client event: {e.Message}");
+            });
             /*BubbleTalkEvent
             AddEffectEvent
             SyncEnvironmentVarEvent

+ 1 - 11
Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattleUnit.cs

@@ -217,17 +217,7 @@ public class BattleUnit : BattleObject
 
         var stun = actionChangeHandler.AddListener(UnitActionStatus.Stun, (o) => { });
         actionChangeHandler.AddListener(UnitActionStatus.HitMove, stun);
-        actionChangeHandler.AddListener(UnitActionStatus.Dead, (o) => {
-            Log.Debug($"Unit({Id}) dead");
-            EventSystem.Instance.Publish<PlayAnimatorEvent>(PlayAnimatorEvent.Static.Clone(
-                Id, AnimatorEventType.Dead ));
-            var launcheffect = ZUnit.Info.DeadActionEffect;
-            if (launcheffect != null)
-            {
-                EventSystem.Instance.Publish<PlayEffectEvent>(PlayEffectEvent.Static.Clone(launcheffect, Id, CommonLang.Geometry.Vector3.Zero));
-            }
-            //TODO: 过几秒后,自行清理尸体
-        });
+        actionChangeHandler.AddListener(UnitActionStatus.Dead, (o) => { });
         actionChangeHandler.AddListener(UnitActionStatus.Damage, (o) => { });
         actionChangeHandler.AddListener(UnitActionStatus.Pick, (o) => { });
         actionChangeHandler.AddListener(UnitActionStatus.Spawn, (o) => { });

+ 11 - 0
Unity/Assets/Scripts/Codes/Model/Client/Generate/Config/Monster.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 92b0ebd750366684ab45ecfa914c3229
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 11 - 0
Unity/Assets/Scripts/Codes/Model/Client/Generate/Message/OuterMessage_C_10001.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 26923f18a432ab740b53d6d218076c02
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: