From 8f006f426334f5ca733bfe4be2aa91007e232f55 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 16 十月 2025 22:09:37 +0800
Subject: [PATCH] 50 【主界面】核心主体 - 阵容人数解锁

---
 Main/System/Team/TeamBase.cs |   46 +++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/Main/System/Team/TeamBase.cs b/Main/System/Team/TeamBase.cs
index 3d08780..84d2361 100644
--- a/Main/System/Team/TeamBase.cs
+++ b/Main/System/Team/TeamBase.cs
@@ -248,6 +248,21 @@
         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))
@@ -329,8 +344,8 @@
         }
     }
     
-
-    public void AddHero(HeroInfo heroInfo, int targetPosition)
+    //checkLock 锛氭槸鍚﹂獙璇佷笂闃典汉鏁伴檺鍒�
+    public void AddHero(HeroInfo heroInfo, int targetPosition, bool checkLock)
     {
         if (targetPosition < 0 || targetPosition >= tempHeroes.Length)
         {
@@ -338,22 +353,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