From 3b2a6bb9047cfce9f501593b3669a9c1af6c5df4 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期三, 05 十一月 2025 17:40:23 +0800
Subject: [PATCH] 130 战斗修改回合样式

---
 Main/System/Team/TeamBase.cs |   75 ++++++++++++++++++++++++++++++++++---
 1 files changed, 69 insertions(+), 6 deletions(-)

diff --git a/Main/System/Team/TeamBase.cs b/Main/System/Team/TeamBase.cs
index fec20d5..13f0f91 100644
--- a/Main/System/Team/TeamBase.cs
+++ b/Main/System/Team/TeamBase.cs
@@ -40,8 +40,13 @@
     }
 
     //  杩欒竟鏉ョ殑鍙互娌℃湁闃熶紞绫诲瀷
-    public TeamBase(HB424_tagSCTurnFightInit.tagSCTurnFightLineup lineUp)
+    public TeamBase(HB424_tagSCTurnFightInit.tagSCTurnFightLineup lineUp, bool isBoss = false)
     {
+        if (isBoss)
+        {
+            tempHeroes = new TeamHero[TeamConst.MaxTeamSlotCount];
+            serverHeroes = new TeamHero[TeamConst.MaxTeamSlotCount];
+        }
         teamIndex = lineUp.Num;
         playerId = lineUp.OwnerID;
         ShapeType = lineUp.ShapeType;
@@ -239,6 +244,30 @@
         return false;
     }
 
+    public TeamHero GetServerHeroByIndex(int index)
+    {
+        if (index < 0 || index >= serverHeroes.Length)
+        {
+            return null;
+        }
+        return serverHeroes[index];
+    }
+
+
+    //鑾峰彇鎵�鏈変笂闃电殑姝﹀皢
+    public List<TeamHero> GetHerosOnTeam()
+    {
+        List<TeamHero> tmpHeros = new List<TeamHero>();
+        foreach (var hero in tempHeroes)
+        {
+            if (hero != null)
+            {
+                tmpHeros.Add(hero);
+            }
+        }
+        return tmpHeros;
+    }
+
     public TeamHero GetNextServerHero(string guid)
     {
         if (string.IsNullOrEmpty(guid))
@@ -286,6 +315,18 @@
         return -1; // No empty position
     }
 
+    public int GetPosition(string guid)
+    { 
+        foreach (var hero in serverHeroes)
+        {
+            if (hero != null && hero.guid == guid)
+            {
+                return hero.positionNum;
+            }
+        }
+        return  -1;
+    }
+
     //  甯冮樀鎺ュ彛
     private void SetTeamHero(int posNum, TeamHero hero)
     {
@@ -308,8 +349,9 @@
         }
     }
     
-
-    public void AddHero(HeroInfo heroInfo, int targetPosition)
+    //checkLock 锛氭槸鍚﹂獙璇佷笂闃典汉鏁伴檺鍒�
+    //targetPosition 浠�0寮�濮�
+    public void AddHero(HeroInfo heroInfo, int targetPosition, bool checkLock)
     {
         if (targetPosition < 0 || targetPosition >= tempHeroes.Length)
         {
@@ -317,22 +359,43 @@
             return;
         }
 
+        if (checkLock)
+        {
+            var lockCnt = HeroUIManager.Instance.lockIndexList.Count;
+            if (lockCnt > 0 && TeamConst.MaxTeamHeroCount - GetHerosOnTeam().Count <= lockCnt)
+            {
+                HeroUIManager.Instance.ShowUnLockTip(HeroUIManager.Instance.lockIndexList[0]);
+                return;
+            }
+        }
+
         SetTeamHero(targetPosition, new TeamHero(heroInfo, targetPosition, this));
     }
 
 
-
+    //checkLock 锛氭槸鍚﹂獙璇佷笂闃典汉鏁伴檺鍒�
     //  add鍙彲鑳芥槸鐐逛笅闈㈠崱鐗�
-    public bool AddHero(HeroInfo heroInfo, out int pos)
+    public bool AddHero(HeroInfo heroInfo, out int pos, bool checkLock)
     {
         pos = -1;
         if (heroInfo == null || heroInfo.itemHero == null) return false;
+
+        if (checkLock)
+        {
+            var lockCnt = HeroUIManager.Instance.lockIndexList.Count;
+            if (lockCnt > 0 && TeamConst.MaxTeamHeroCount - GetHerosOnTeam().Count <= lockCnt)
+            {
+                HeroUIManager.Instance.ShowUnLockTip(HeroUIManager.Instance.lockIndexList[0]);
+                return false;
+            }
+        }
+
 
         // 鍚屼竴鑻遍泟 鍙兘涓婇樀涓�涓�
         if (GetHeroByHeroID(heroInfo.heroId) != null)
         {
             SysNotifyMgr.Instance.ShowTip("HeroFunc2");
-            return false; 
+            return false;
         }
         else
         {

--
Gitblit v1.8.0