From 2917e8a4eae31c1a1bc4419a9b6f23be7e4fda3e Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 05 八月 2025 19:24:50 +0800
Subject: [PATCH] update team heros

---
 Main/System/Battle/BattleObject/BattleObjMgr.cs |   91 ++++++++++++++++++++++++++++++++++-----------
 1 files changed, 68 insertions(+), 23 deletions(-)

diff --git a/Main/System/Battle/BattleObject/BattleObjMgr.cs b/Main/System/Battle/BattleObject/BattleObjMgr.cs
index ec938e1..f09454d 100644
--- a/Main/System/Battle/BattleObject/BattleObjMgr.cs
+++ b/Main/System/Battle/BattleObject/BattleObjMgr.cs
@@ -21,30 +21,65 @@
         battleField = _battleField;
         CreateTeam(battleField.battleRootNode.redTeamNodeList, redCampDict, _redTeam, BattleCamp.Red);
         CreateTeam(battleField.battleRootNode.blueTeamNodeList, blueCampDict, _blueTeam, BattleCamp.Blue);
-    } 
+    }
+
 
     protected void CreateTeam(List<GameObject> posNodeList, Dictionary<int, BattleObject> campDict, TeamBase teamBase, BattleCamp _Camp)
     {
         DestroyTeam(campDict);
-        for (int i = 0; i < teamBase.teamHeros.Length; i++)
+        if (teamBase == null)
         {
-            TeamHero teamHero = teamBase.teamHeros[i];
+            return;
+        }
+
+        for (int i = 0; i < teamBase.serverHeroes.Length; i++)
+        {
+            TeamHero teamHero = teamBase.serverHeroes[i];
             if (teamHero != null)
             {
                 BattleObject battleObj = BattleObjectFactory.CreateBattleObject(battleField, posNodeList, teamHero, _Camp);
-                allBattleObjDict.Add(battleObj.BattleObjectId, battleObj);
-                campDict.Add(teamHero.heroIndex, battleObj);
+                if (battleObj.ObjID == 0)
+                    continue;
+                allBattleObjDict.Add(battleObj.ObjID, battleObj);
+                campDict.Add(teamHero.positionNum, battleObj);
             }
         }
     }
     
-    public BattleObject GetBattleObject(int battleObjId)
+    public BattleObject GetBattleObject(int objId)
     {
-        if (allBattleObjDict.TryGetValue(battleObjId, out BattleObject battleObj))
+        if (allBattleObjDict.TryGetValue(objId, out BattleObject battleObj))
         {
             return battleObj;
         }
         return null;
+    }
+
+    public List<BattleObject> GetBattleObjList(BattleCamp _Camp)
+    {
+        if (_Camp == BattleCamp.Red)
+        {
+            return redCampList;
+        }
+        else
+        {
+            return blueCampList;
+        }
+    }
+
+    public List<BattleObject> GetBattleObjList(H0604_tagUseSkillAttack tagUseSkillAttack)
+    {
+        List<BattleObject> retList = new List<BattleObject>();
+        foreach (var hurt in tagUseSkillAttack.HurtList)
+        {
+            BattleObject obj = GetBattleObject((int)hurt.ObjID);
+            if (null != obj)
+            {
+                retList.Add(obj);
+            }
+        }
+
+        return retList;
     }
 
     protected void DestroyTeam(Dictionary<int, BattleObject> campDict)
@@ -54,12 +89,32 @@
             BattleObject battleObj = item.Value;
             if (battleObj != null)
             {
-                allBattleObjDict.Remove(battleObj.BattleObjectId);
+                allBattleObjDict.Remove(battleObj.ObjID);
                 BattleObjectFactory.DestroyBattleObject(item.Key, battleObj);
             }
         }
         campDict.Clear();
 
+    }
+
+    //  绌洪棽鐘舵��
+    public void HaveRest(BattleCamp _Camp)
+    {
+        //  浼戞伅鐘舵��
+        if (_Camp == BattleCamp.Red)
+        {
+            foreach (var item in redCampDict.Values)
+            {
+                item.HaveRest();
+            }
+        }
+        else
+        {
+            foreach (var item in blueCampDict.Values)
+            {
+                item.HaveRest();
+            }
+        }
     }
 
     public void Release()
@@ -127,7 +182,7 @@
         return blueCampList;
     }
 
-#if UNITY_EDITOR
+#if UNITY_EDITOR_STOP_USING
     public void ReviveAll()
     {
         foreach (var kv in allBattleObjDict)
@@ -168,7 +223,7 @@
                 //鏆傛椂娌℃湁鍙敜鐗�
                 // 鏀惧湪绗�7鏍肩殑BOSS鍚庢帓鐨勩�傘�備綅缃斁鍦ㄦ涓棿
                 // a)鍓嶆帓,1銆�2銆�3鍙蜂负鍓嶆帓,鍓嶆帓鍏ㄩ儴闃典骸鍚�,4銆�5銆�6鍙峰嵆鏄墠鎺掍篃鏄悗鎺� 7鍏跺疄涔熸槸鍚庢帓
-                List<BattleObject> frontList = new List<BattleObject>(from BO in returnList where BO.teamHero.heroIndex < 3 && !BO.IsDead() select BO);
+                List<BattleObject> frontList = new List<BattleObject>(from BO in returnList where BO.teamHero.positionNum < 3 && !BO.IsDead() select BO);
                 if (frontList.Count == 0)
                 {
                     frontList.AddRange(returnList);
@@ -176,7 +231,7 @@
                 returnList = frontList;                
                 break;
             case SkillTargetRangeType.Back:
-                List<BattleObject> backList = new List<BattleObject>(from BO in returnList where BO.teamHero.heroIndex >= 3 && !BO.IsDead() select BO);
+                List<BattleObject> backList = new List<BattleObject>(from BO in returnList where BO.teamHero.positionNum >= 3 && !BO.IsDead() select BO);
                 if (backList.Count == 0)
                 {
                     backList.AddRange(returnList);
@@ -198,18 +253,8 @@
             case SkillTargetRangeType.HighestAttack:
                 returnList = new List<BattleObject>(from BO in returnList where !BO.IsDead() select BO);
                 BattleObject mostHighestAttckObj = null;
-                for (int i = 0; i < returnList.Count; i++)
-                {
-                    if (mostHighestAttckObj == null)
-                    {
-                        mostHighestAttckObj = returnList[i];
-                        continue;
-                    }
-                    if (returnList[i].teamHero.attack > mostHighestAttckObj.teamHero.attack)
-                    {
-                        mostHighestAttckObj = returnList[i];
-                    }
-                }
+                //  瀹㈡埛绔笉鍖呭惈鏁版嵁 杩欓噷鍙栫涓�涓�
+                mostHighestAttckObj = returnList[0];
                 returnList.Clear();
                 if (mostHighestAttckObj != null)
                     returnList.Add(mostHighestAttckObj);

--
Gitblit v1.8.0