Explorar o código

增加了手动释放技能功能

大爷 %!s(int64=2) %!d(string=hai) anos
pai
achega
6b422d570f
Modificáronse 36 ficheiros con 234 adicións e 215 borrados
  1. 6 6
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/BattleMgr.cs
  2. 0 40
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/UnitListComponentSystem.cs
  3. 60 0
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/UnitMgr.cs
  4. 1 1
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/UnitMgr.cs.meta
  5. 1 1
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/skill.meta
  6. 73 0
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/skill/SkillMgr.cs
  7. 1 1
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/skill/SkillMgr.cs.meta
  8. 1 1
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit.meta
  9. 13 0
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattleActor.cs
  10. 1 1
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattleActor.cs.meta
  11. 3 3
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattleObject.cs
  12. 1 1
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattleObject.cs.meta
  13. 0 0
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattlePlayer.cs
  14. 1 1
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattlePlayer.cs.meta
  15. 3 2
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattleUnit.cs
  16. 1 1
      Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattleUnit.cs.meta
  17. 0 8
      Unity/Assets/Scripts/Codes/Hotfix/Share/Module/Unit.meta
  18. 0 18
      Unity/Assets/Scripts/Codes/Hotfix/Share/Module/Unit/UnitComponentSystem.cs
  19. 0 11
      Unity/Assets/Scripts/Codes/Hotfix/Share/Module/Unit/UnitSystem.cs
  20. 0 11
      Unity/Assets/Scripts/Codes/Hotfix/Share/Module/Unit/UnitSystem.cs.meta
  21. 1 1
      Unity/Assets/Scripts/Codes/HotfixView/Client/Scene/AfterCreateCurrentScene_AddComponent.cs
  22. 3 3
      Unity/Assets/Scripts/Codes/HotfixView/Client/Scene/SceneChangeStart_AddComponent.cs
  23. 40 21
      Unity/Assets/Scripts/Codes/HotfixView/Client/UI/HUD/SceneChangeFinishEvent_CreateHUD.cs
  24. 6 1
      Unity/Assets/Scripts/Codes/HotfixView/Client/UI/UIHelper.cs
  25. 1 1
      Unity/Assets/Scripts/Codes/HotfixView/Client/Unit/AnimatorComponentSystem.cs
  26. 5 4
      Unity/Assets/Scripts/Codes/HotfixView/Client/Unit/OnDestroyZoneObject.cs
  27. 4 4
      Unity/Assets/Scripts/Codes/HotfixView/Client/Unit/OnNewZoneObject.cs
  28. 0 9
      Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattleMonster.cs
  29. 0 11
      Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattleMonster.cs.meta
  30. 0 5
      Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattleSpell.cs
  31. 0 11
      Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattleSpell.cs.meta
  32. 8 2
      Unity/Assets/Scripts/Codes/Model/Client/EventTypeClient.cs
  33. 0 8
      Unity/Assets/Scripts/Codes/Model/Client/Unit.meta
  34. 0 15
      Unity/Assets/Scripts/Codes/Model/Client/Unit/UnitListComponent.cs
  35. 0 11
      Unity/Assets/Scripts/Codes/Model/Client/Unit/UnitListComponent.cs.meta
  36. 0 1
      Unity/Assets/Scripts/Codes/Model/Share/EventType.cs

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

@@ -7,7 +7,7 @@ using XmdsCommon.Message;
 
 namespace ET
 {
-    [FriendOf(typeof(UnitListComponent))]
+    [FriendOf(typeof(UnitMgr))]
     public class BattleMgr : Singleton<BattleMgr>, ISingletonUpdate, ILayerClient
     {
         private bool isInited = false;
@@ -88,11 +88,11 @@ namespace ET
             var unit = BattleUnitFactory.Instance.Create(obj);
             if(unit != null )
             {
-                if(unit is BattleActor)
+                UnitMgr.Instance.PutUnit(obj.ObjectID, unit);
+                if (unit is BattleActor)
                 {
-                    UnitListComponent.Instance.Actor = unit as BattleActor;
+                    UnitMgr.Instance.Actor = unit as BattleActor;
                 }
-                UnitListComponent.Instance.UnitList.Add(obj.ObjectID, unit);
                 unit.OnAwake(obj);
             }
             else
@@ -106,7 +106,7 @@ namespace ET
         {
             Log.Debug($"OnObjectLeave: {obj.Name}");
 
-            var unit = UnitListComponent.Instance.UnitList.Get(obj.ObjectID);
+            var unit = UnitMgr.Instance.GetUnit(obj.ObjectID);
             if(unit == null)
             {
                 Log.Error($"LayerEvent_ObjectLeave not exist:{obj.Name}:{obj.ObjectID}");
@@ -114,7 +114,7 @@ namespace ET
             }
 
             unit.OnSleep();
-            UnitListComponent.Instance.UnitList.Remove(obj.ObjectID);
+            UnitMgr.Instance.RemoveUnit(obj.ObjectID);
         }
 
         protected void LayerEvent_DecorationChanged(CommonAI.ZoneClient.ZoneLayer layer, CommonAI.ZoneClient.ZoneEditorDecoration ed)

+ 0 - 40
Unity/Assets/Scripts/Codes/Hotfix/Client/battle/UnitListComponentSystem.cs

@@ -1,40 +0,0 @@
-
-namespace ET.Client
-{
-    [ObjectSystem]
-    public class UnitListComponentAwakeSystem : AwakeSystem<UnitListComponent>
-    {
-        protected override void Awake(UnitListComponent self)
-        {
-            UnitListComponent.Instance = self;
-            self.RecycleUnits();
-            self.UnitList = new();
-        }
-    }
-
-    [ObjectSystem]
-    public class UnitListComponentDestroySystem : DestroySystem<UnitListComponent>
-    {
-        protected override void Destroy(UnitListComponent self)
-        {
-            self.RecycleUnits();
-            UnitListComponent.Instance = null;
-        }
-    }
-
-    [FriendOf(typeof(UnitListComponent))]
-    public static class UnitListComponentExt
-    {
-        public static void RecycleUnits(this UnitListComponent self)
-        {
-            if(self.UnitList != null)
-            {
-                foreach(var kp in self.UnitList)
-                {
-                    kp.Value.OnSleep();
-                }
-                self.UnitList = null;
-            }
-        }
-    }
-}

+ 60 - 0
Unity/Assets/Scripts/Codes/Hotfix/Client/battle/UnitMgr.cs

@@ -0,0 +1,60 @@
+
+using CommonLang;
+
+namespace ET.Client
+{
+    [ComponentOf(typeof(Scene))]
+    public class UnitMgr : Entity, IAwake, IDestroy
+    {
+        public static UnitMgr Instance;
+
+        public BattleActor Actor { get; set; }
+        private HashMap<uint, BattleObject> UnitList = new();
+
+        public BattleObject GetUnit(uint id)
+        {
+            return UnitList.ContainsKey(id) ? UnitList[id] : null;
+        }
+        public void PutUnit(uint id, BattleObject obj)
+        {
+            UnitList[id] = obj;
+        }
+        public void RemoveUnit(uint id)
+        {
+            if (UnitList.ContainsKey(id))
+            {
+                UnitList.Remove(id);
+            }
+        }
+
+        public void RecycleUnits()
+        {
+            foreach (var kp in UnitList)
+            {
+                kp.Value.OnSleep();
+            }
+            UnitList.Clear();
+        }
+    }
+
+    [ObjectSystem]
+    public class UnitMgrAwakeSystem : AwakeSystem<UnitMgr>
+    {
+        protected override void Awake(UnitMgr self)
+        {
+            UnitMgr.Instance = self;
+            self.RecycleUnits();
+        }
+    }
+
+    [ObjectSystem]
+    public class UnitMgrDestroySystem : DestroySystem<UnitMgr>
+    {
+        protected override void Destroy(UnitMgr self)
+        {
+            self.RecycleUnits();
+            UnitMgr.Instance = null;
+        }
+    }
+
+}

+ 1 - 1
Unity/Assets/Scripts/Codes/Hotfix/Share/Module/Unit/UnitComponentSystem.cs.meta → Unity/Assets/Scripts/Codes/Hotfix/Client/battle/UnitMgr.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: f7fbe1de137b21e4e88024c1411f792d
+guid: baf4773e49619214ab2922e3091dc108
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 1 - 1
Unity/Assets/Scripts/Codes/Model/Client/Battle.meta → Unity/Assets/Scripts/Codes/Hotfix/Client/battle/skill.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 20f2e04a5e28ac64f9bd8e97a6ff568f
+guid: ad60d31f9e21a964c9ec3ead49af83c2
 folderAsset: yes
 DefaultImporter:
   externalObjects: {}

+ 73 - 0
Unity/Assets/Scripts/Codes/Hotfix/Client/battle/skill/SkillMgr.cs

@@ -0,0 +1,73 @@
+
+using CommonAI.Zone;
+using CommonLang;
+using ET.EventType;
+
+namespace ET.Client
+{
+    public class SkillMgr : Singleton<SkillMgr>
+    {
+        private bool inited = false;
+        public bool Inited { get { return inited; } }
+
+        private HashMap<int, SkillKeyStruct> SkillLisst = new();
+        public SkillKeyStruct GetSkill(int index)
+        {
+           return SkillLisst[index];
+        }
+
+        public void Init(params int[] skills)
+        {
+            inited = true;
+            SkillLisst.Clear();
+
+            var CFG = UnitMgr.Instance.Actor.ZUnit.Templates;
+            for (int i = 0; i < skills.Length; i++)
+            {
+                int skid = skills[i];
+                if (skid != 0)
+                {
+                    SkillTemplate skt = CFG.getSkill(skid);
+                    SkillLisst[i] = new SkillKeyStruct()
+                    {
+                        keyPos = i,
+                        baseSkillId = skid,
+                        icon = skt.IconName
+                    };
+                }
+            }
+
+            EventSystem.Instance.Publish<SkillChangeEvent>();
+        }
+
+        private UnitLaunchSkillAction launchSkillAction = new UnitLaunchSkillAction();
+        public void LanchSkill(int skillId)
+        {
+            launchSkillAction.SkillID = skillId;
+            launchSkillAction.object_id = UnitMgr.Instance.Actor.Id;
+            launchSkillAction.TargetObjID = 0;
+            launchSkillAction.SpellTargetPos = null;
+            launchSkillAction.IsAutoFocusNearTarget = false;
+            launchSkillAction.Direction = 0;
+            BattleMgr.Instance.SendAction(launchSkillAction);
+        }
+    }
+
+    [Event(SceneType.None)]
+    public class LaunchSkillEventHandler : BEvent<LaunchSkillEvent>
+    {
+        public override async ETTask OnEvent(LaunchSkillEvent a)
+        {
+            var skillinfo = SkillMgr.Instance.GetSkill(a.index);
+            if (skillinfo != null)
+            {
+                SkillMgr.Instance.LanchSkill(skillinfo.baseSkillId);
+            }
+            else
+            {
+                Log.Error($"skill info not exist @index: {a.index}");
+            }
+            await ETTask.CompletedTask;
+        }
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Codes/Hotfix/Client/battle/UnitListComponentSystem.cs.meta → Unity/Assets/Scripts/Codes/Hotfix/Client/battle/skill/SkillMgr.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 2490c144653ac9248b255aaca60aea85
+guid: 64612897b77341940b93332eee853b22
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 1 - 1
Unity/Assets/Scripts/Codes/Model/Client/Battle/unit.meta → Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: b0c6cb43bbac1704bacdb6ab68c2c986
+guid: a4a5004971ab3774980c55c55c6fdf04
 folderAsset: yes
 DefaultImporter:
   externalObjects: {}

+ 13 - 0
Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattleActor.cs → Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattleActor.cs

@@ -1,5 +1,6 @@
 using CommonAI.ZoneClient;
 using ET;
+using ET.Client;
 
 public class BattleActor : BattlePlayer
 {
@@ -21,6 +22,18 @@ public class BattleActor : BattlePlayer
         //SkillOpetion.Active不明意义,未处理
         if (op == ZoneUnit.SkillOption.Reset)
         {
+            if(baseSkillID != 0)
+            {
+                if(skills.Length > 0)
+                {
+                    skills[0] = baseSkillID;
+                }
+                else
+                {
+                    skills = new int[] { baseSkillID };
+                }
+            }
+            SkillMgr.Instance.Init(skills);
         }
         else if (op == ZoneUnit.SkillOption.Add || op == ZoneUnit.SkillOption.Remove)
         {

+ 1 - 1
Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattleActor.cs.meta → Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattleActor.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 67904abe943bc48488d0e3e99ecf6220
+guid: 3e5a3d496328eac4db4422f947706c24
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 3 - 3
Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattleObject.cs → Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattleObject.cs

@@ -13,7 +13,7 @@ public class BattleObject
     public virtual void OnAwake(ZoneObject zo)
     {
         ZoneObject = zo;
-        EventSystem.Instance.Publish(CurrentScene, new OnNewZoneObject() { Object = this });
+        EventSystem.Instance.Publish(CurrentScene, new OnNewZoneObject() { ObjectId = Id });
     }
 
     public virtual void OnSleep()
@@ -22,7 +22,7 @@ public class BattleObject
     }
     protected async ETTask AsyncSleep()
     {
-        await EventSystem.Instance.PublishAsync(CurrentScene, new OnDestroyZoneObject() { Object = this });
+        await EventSystem.Instance.PublishAsync(CurrentScene, new OnDestroyZoneObject() { ObjectId = Id });
         ObjectPool.Instance.Recycle(this);
     }
 
@@ -33,7 +33,7 @@ public class BattleObject
         {
             if (_CurrentSceneCache == null)
             {
-                var cs = ClientSceneManagerComponent.Instance.GetChild<Scene>(UnitListComponent.Instance.DomainZone());
+                var cs = ClientSceneManagerComponent.Instance.GetChild<Scene>(UnitMgr.Instance.DomainZone());
                 _CurrentSceneCache = cs.GetComponent<CurrentScenesComponent>().Scene;
             }
             return _CurrentSceneCache;

+ 1 - 1
Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattleObject.cs.meta → Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattleObject.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 246b30b31167cc440ae8703cdfaa68e4
+guid: c322bec22484c134fa8217bb95a4697d
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 0 - 0
Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattlePlayer.cs → Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattlePlayer.cs


+ 1 - 1
Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattlePlayer.cs.meta → Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattlePlayer.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 9fb851996969f8b43858ca0744bd91f3
+guid: ed84dd67997b8ab4cba3a57e6bcecdd5
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 3 - 2
Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattleUnit.cs → Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattleUnit.cs

@@ -62,7 +62,7 @@ public class BattleUnit : BattleObject
         return ++ groupId;
     }
 
-    protected virtual void OnLaunchSkill(ZoneUnit unit, ZoneUnit.SkillState skill, UnitLaunchSkillEvent ev)
+    protected virtual void OnLaunchSkill(ZoneUnit _, ZoneUnit.SkillState __, UnitLaunchSkillEvent ___)
     {
         CommonAI.ZoneClient.ZoneUnit.ISkillAction action = ZUnit.CurrentSkillAction;
         SkillTemplate skillTemplate = action.SkillData;
@@ -72,6 +72,7 @@ public class BattleUnit : BattleObject
             Log.Error("Enter Skill state error> ({0})>CurrentActionIndex>{1}", skillTemplate.TemplateID, curActionIndex);
             return;
         }
+        Log.Debug($"OnLaunchSkill({Id}), skill({skillTemplate.TemplateID}), actionIndex:{curActionIndex}");
         
         if (skillTemplate.IsSingleAction)
         {
@@ -163,7 +164,7 @@ public class BattleUnit : BattleObject
 
     protected virtual void OnActionChanged(ZoneUnit unit, UnitActionStatus status, object evt)
     {
-        Log.Debug($"ActionChange2: {status}, zobject status:{ZUnit.CurrentState}");
+        Log.Debug($"ActionChange: {status}, zobject status:{ZUnit.CurrentState}");
         if(!actionChangeHandler.Notify(status, evt))
         {
             Log.Error($"unhandle action changed: {status}");

+ 1 - 1
Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattleUnit.cs.meta → Unity/Assets/Scripts/Codes/Hotfix/Client/battle/unit/BattleUnit.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 6d2cdde9765f7bd4ea00f5bbbd54fa6b
+guid: 36f95e2707be42d47810970a1588ef41
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 0 - 8
Unity/Assets/Scripts/Codes/Hotfix/Share/Module/Unit.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 151803197aee1fd4c9eed75afb1b6b12
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 18
Unity/Assets/Scripts/Codes/Hotfix/Share/Module/Unit/UnitComponentSystem.cs

@@ -1,18 +0,0 @@
-namespace ET
-{
-    [FriendOfAttribute(typeof(ET.UnitComponent))]
-    public static class UnitComponentSystem
-    {
-        public static Unit Get(this UnitComponent self, long id)
-        {
-            Unit unit = self.GetChild<Unit>(id);
-            return unit;
-        }
-
-        public static void Remove(this UnitComponent self, long id)
-        {
-            Unit unit = self.GetChild<Unit>(id);
-            unit?.Dispose();
-        }
-    }
-}

+ 0 - 11
Unity/Assets/Scripts/Codes/Hotfix/Share/Module/Unit/UnitSystem.cs

@@ -1,11 +0,0 @@
-namespace ET
-{
-    [ObjectSystem]
-    public class UnitSystem: AwakeSystem<Unit, int>
-    {
-        protected override void Awake(Unit self, int configId)
-        {
-            self.ConfigId = configId;
-        }
-    }
-}

+ 0 - 11
Unity/Assets/Scripts/Codes/Hotfix/Share/Module/Unit/UnitSystem.cs.meta

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

+ 1 - 1
Unity/Assets/Scripts/Codes/HotfixView/Client/Scene/AfterCreateCurrentScene_AddComponent.cs

@@ -8,7 +8,7 @@
             //scene.AddComponent<UIComponent>();
             //scene.AddComponent<ResourcesLoaderComponent>();
             scene.AddComponent<ModelViewComponent>();
-            scene.AddComponent<UnitListComponent>();
+            scene.AddComponent<UnitMgr>();
             await ETTask.CompletedTask;
         }
     }

+ 3 - 3
Unity/Assets/Scripts/Codes/HotfixView/Client/Scene/SceneChangeStart_AddComponent.cs

@@ -1,4 +1,4 @@
-using Cysharp.Threading.Tasks;
+using Cysharp.Threading.Tasks;
 
 namespace ET.Client
 {
@@ -21,7 +21,7 @@ namespace ET.Client
             currentScene.AddComponent<OperaComponent>();
 
             // 通知等待场景切换的协程
-            EventSystem.Instance.Publish(scene, new EventType.SceneLoadFinish());
+            EventSystem.Instance.Publish<EventType.SceneLoadFinish>();
         }
     }
-}
+}

+ 40 - 21
Unity/Assets/Scripts/Codes/HotfixView/Client/UI/HUD/SceneChangeFinishEvent_CreateHUD.cs

@@ -1,37 +1,56 @@
-using FairyGUI;
+using CommonAI.Zone;
+using ET.EventType;
+using FairyGUI;
 
 namespace ET.Client
 {
     [Event(SceneType.Client)]
-    public class SceneChangeFinishEvent_CreateUIHelp : AEvent<EventType.SceneLoadFinish>
+    public class SceneChangeFinishEvent_CreateUIHelp : BEvent<SceneLoadFinish>
     {
-        protected override async ETTask Run(Scene scene, EventType.SceneLoadFinish args)
+        public override async ETTask OnEvent(SceneLoadFinish a)
         {
             Log.Debug("loading HUD");
             var view = await UIHelper.Create("HUD");
-            InitView(scene, view);
+            HUDMgr.InitView(view);
         }
+    }
 
-        private void InitView(Scene scene, GComponent view)
+    [Event(SceneType.None)]
+    public class SkillChangeEventHandler : BEvent<SkillChangeEvent>
+    {
+        public override async ETTask OnEvent(SkillChangeEvent a)
         {
+            var view = UIHelper.GetUI("HUD") as GComponent;
+            if(view != null)
+            {
+                HUDMgr.InitView(view);
+            }
+            await ETTask.CompletedTask;
+        }
+    }
+
+    public static class HUDMgr
+    {
+        public static void InitView(GComponent view)
+        {
+            var btn1 = view.GetChild("btn_skill1");
+            var btn2 = view.GetChild("btn_skill2");
+            if (!SkillMgr.Instance.Inited)
+            {
+                btn1.visible = false;
+                btn2.visible = false;
+                return;
+            }
+            btn1.visible = SkillMgr.Instance.GetSkill(0) != null;
+            btn2.visible = SkillMgr.Instance.GetSkill(1) != null;
+
             var img = view.GetChild("img_direction");
-            view.GetChild("btn_skill1").onClick.Add(() => {
-                /*Scene currentScene = scene.GetComponent<CurrentScenesComponent>().Scene;
-                var component = currentScene.GetComponent<UnitComponent>();
-                var actor = component.GetChild<Unit>(component.MyUnitId);
-                if(actor != null)
-                {
-                    actor.GetComponent<AnimatorComponent>().AppendCommand(AnimatorComponent.CommandType.Skill0);
-                }*/
+            btn1.onClick.Set(() => {
+                EventSystem.Instance.Publish<LaunchSkillEvent>(new LaunchSkillEvent() { index = 0 }) ;
             });
-            view.GetChild("btn_skill2").onClick.Add(() => {
-                /*Scene currentScene = scene.GetComponent<CurrentScenesComponent>().Scene;
-                var component = currentScene.GetComponent<UnitComponent>();
-                var actor = component.GetChild<Unit>(component.MyUnitId);
-                if (actor != null)
-                {
-                    actor.GetComponent<AnimatorComponent>().AppendCommand(AnimatorComponent.CommandType.Skill1);
-                }*/
+
+            btn2.onClick.Set(() => {
+                EventSystem.Instance.Publish<LaunchSkillEvent>(new LaunchSkillEvent() { index = 1 });
             });
         }
     }

+ 6 - 1
Unity/Assets/Scripts/Codes/HotfixView/Client/UI/UIHelper.cs

@@ -42,5 +42,10 @@ namespace ET.Client
             }
             return false;
         }
+
+        public static GObject GetUI(string uiName)
+        {
+            return GRoot.inst.GetChild(uiName);
+        }
     }
-}
+}

+ 1 - 1
Unity/Assets/Scripts/Codes/HotfixView/Client/Unit/AnimatorComponentSystem.cs

@@ -18,7 +18,7 @@ namespace ET.Client
             }
             if(args.CommandType == CMDType.Skill)
             {
-                var m = Regex.Match(args.SkillName, "Skill(\\d+)");
+                var m = Regex.Match(args.SkillName, "[Ss]kill(\\d+)");
                 if (m.Success)
                 {
                     int n = System.Convert.ToInt32(m.Groups[1].Value, 10);

+ 5 - 4
Unity/Assets/Scripts/Codes/HotfixView/Client/Unit/OnDestroyZoneObject.cs

@@ -3,17 +3,18 @@
 namespace ET.Client
 {
     [Event(SceneType.Current)]
-    public class OnDestroyZoneObject : AEvent<EventType.OnDestroyZoneObject>
+    public class OnDestroyZoneObjectHandler : AEvent<EventType.OnDestroyZoneObject>
     {
         protected override async ETTask Run(Scene scene, EventType.OnDestroyZoneObject args)
         {
-            await DestroyUnitModel(args.Object);
+            await DestroyUnitModel(args.ObjectId);
         }
 
-        private async ETTask DestroyUnitModel(BattleObject unit)
+        private async ETTask DestroyUnitModel(uint unitid)
         {
-            ModelViewComponent.Instance.RemoveChild(unit.Id);
+            ModelViewComponent.Instance?.RemoveChild(unitid);
 
+            var unit = UnitMgr.Instance.GetUnit(unitid);
             if (unit is BattleActor)
             {
                 //相机跟随主角

+ 4 - 4
Unity/Assets/Scripts/Codes/HotfixView/Client/Unit/OnNewZoneObject.cs

@@ -3,14 +3,14 @@
 namespace ET.Client
 {
     [Event(SceneType.Current)]
-    public class OnNewZoneObject : AEvent<EventType.OnNewZoneObject>
+    public class OnNewZoneObjectHandler : AEvent<EventType.OnNewZoneObject>
     {
         protected override async ETTask Run(Scene scene, EventType.OnNewZoneObject args)
         {
-            var bo = args.Object;
-            if(bo is BattleUnit)
+            var obj = UnitMgr.Instance.GetUnit(args.ObjectId);
+            if(obj is BattleUnit)
             {
-                await CreatUnitModel(bo as BattleUnit);
+                await CreatUnitModel(obj as BattleUnit);
             }
             else
             {

+ 0 - 9
Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattleMonster.cs

@@ -1,9 +0,0 @@
-using CommonAI.ZoneClient;
-
-public class BattleMonster : BattleUnit
-{
-    public override void OnAwake(ZoneObject zo)
-    {
-        base.OnAwake(zo);
-    }
-}

+ 0 - 11
Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattleMonster.cs.meta

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

+ 0 - 5
Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattleSpell.cs

@@ -1,5 +0,0 @@
-using CommonAI.ZoneClient;
-
-public class BattleSpell : BattleObject
-{
-}

+ 0 - 11
Unity/Assets/Scripts/Codes/Model/Client/Battle/unit/BattleSpell.cs.meta

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

+ 8 - 2
Unity/Assets/Scripts/Codes/Model/Client/EventTypeClient.cs

@@ -4,11 +4,11 @@
     {
         public struct OnNewZoneObject
         {
-            public BattleObject Object;
+            public uint ObjectId;
         }
         public struct OnDestroyZoneObject
         {
-            public BattleObject Object;
+            public uint ObjectId;
         }
         public struct PlayAnimatorEvent
         {
@@ -31,6 +31,12 @@
                 Loop = loop;
             }
         }
+        public class SkillChangeEvent { }
+        public class SceneLoadFinish { }
+        public class LaunchSkillEvent
+        {
+            public int index;
+        }
     }
 
     //状态指令

+ 0 - 8
Unity/Assets/Scripts/Codes/Model/Client/Unit.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 15dd51027995db94f8a3869cc2f10bc5
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 15
Unity/Assets/Scripts/Codes/Model/Client/Unit/UnitListComponent.cs

@@ -1,15 +0,0 @@
-
-using CommonLang;
-
-namespace ET.Client
-{
-    [ComponentOf(typeof(Scene))]
-    public class UnitListComponent : Entity, IAwake, IDestroy
-    {
-        [StaticField]
-        public static UnitListComponent Instance;
-
-        public BattleActor Actor { get; set; }
-        public HashMap<uint, BattleObject> UnitList;
-    }
-}

+ 0 - 11
Unity/Assets/Scripts/Codes/Model/Client/Unit/UnitListComponent.cs.meta

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

+ 0 - 1
Unity/Assets/Scripts/Codes/Model/Share/EventType.cs

@@ -5,7 +5,6 @@ namespace ET
     {
         public struct SceneChangeStart { }
         public struct SceneChangeFinish { }
-        public struct SceneLoadFinish { }
         public struct AfterCreateClientScene { }
         public struct AfterCreateCurrentScene { }
         public struct AppStartInitFinish { }