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/Main/AutoFightModel.cs         |   19 ---
 Main/System/HeroUI/HeroUIManager.OnTeam.cs |  155 +++++++++++++++++++++++++
 Main/System/Main/FightPowerManager.cs      |    4 
 Main/System/MainLevel/MainBossEnterWin.cs  |    6 
 Main/System/Setting/QuickSetting.cs        |    2 
 Main/System/Equip/BlessLVManager.cs        |    4 
 Main/System/MainLevel/MainLevelManager.cs  |   21 +++
 Main/System/HeroUI/HeroPosWin.cs           |    2 
 Main/System/Main/HeroFightingCardCell.cs   |   42 ++++++
 Main/System/Main/HomeWin.cs                |   13 +
 Main/System/Scroll/ScrollerController.cs   |    6 +
 Main/Component/UI/Effect/EffectPlayer.cs   |    9 
 Main/System/Team/TeamBase.cs               |   46 ++++++
 Main/System/HeroUI/HeroPosHeadCell.cs      |    2 
 Main/System/HeroUI/HeroUIManager.cs        |    5 
 15 files changed, 292 insertions(+), 44 deletions(-)

diff --git a/Main/Component/UI/Effect/EffectPlayer.cs b/Main/Component/UI/Effect/EffectPlayer.cs
index 8af5bbd..3fdbc6c 100644
--- a/Main/Component/UI/Effect/EffectPlayer.cs
+++ b/Main/Component/UI/Effect/EffectPlayer.cs
@@ -416,10 +416,11 @@
             spineComp.enabled = false;
             isPlaying = false;
             onComplete?.Invoke();
-            if (isReleaseImmediately)
-            {
-                Release();
-            }
+            // TODO 浼氭姤閿欐殏鏃舵敞閲�
+            // if (isReleaseImmediately)
+            // {
+            //     Release();
+            // }
 
         }
     }
diff --git a/Main/System/Equip/BlessLVManager.cs b/Main/System/Equip/BlessLVManager.cs
index 93ee8c1..d20c137 100644
--- a/Main/System/Equip/BlessLVManager.cs
+++ b/Main/System/Equip/BlessLVManager.cs
@@ -100,6 +100,10 @@
         redpointTreeFree.state = RedPointState.None;
         redpointTreeItem.state = RedPointState.None;
         redpointTree.state = RedPointState.None;
+        if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.BlessLV))
+        {
+            return;
+        }
         var config = TreeLVConfig.Get(m_TreeLV);
         if (config == null) return;
         //闈炲崌绾т腑妫�鏌ュ崌绾ф潗鏂�
diff --git a/Main/System/HeroUI/HeroPosHeadCell.cs b/Main/System/HeroUI/HeroPosHeadCell.cs
index faeba92..ba6249a 100644
--- a/Main/System/HeroUI/HeroPosHeadCell.cs
+++ b/Main/System/HeroUI/HeroPosHeadCell.cs
@@ -41,7 +41,7 @@
             return;
         }
 
-        team.AddHero(hero, out pos);
+        team.AddHero(hero, out pos, true);
         if (pos != -1)
         {
             selectRect.SetActive(true);
diff --git a/Main/System/HeroUI/HeroPosWin.cs b/Main/System/HeroUI/HeroPosWin.cs
index 38565aa..d4c6359 100644
--- a/Main/System/HeroUI/HeroPosWin.cs
+++ b/Main/System/HeroUI/HeroPosWin.cs
@@ -459,7 +459,7 @@
         team.RemoveAllHeroes();
         for (int i = 0; i < guidList.Count; i++)
         {
-            team.AddHero(HeroManager.Instance.GetHero(guidList[i]), i);
+            team.AddHero(HeroManager.Instance.GetHero(guidList[i]), i, true);
         }
 
         TeamChangeEvent(new List<int>() { 0, 1, 2, 3, 4, 5 }, -1, Vector3.zero);
diff --git a/Main/System/HeroUI/HeroUIManager.OnTeam.cs b/Main/System/HeroUI/HeroUIManager.OnTeam.cs
index 6a5846a..f0a9734 100644
--- a/Main/System/HeroUI/HeroUIManager.OnTeam.cs
+++ b/Main/System/HeroUI/HeroUIManager.OnTeam.cs
@@ -6,7 +6,7 @@
 
 public partial class HeroUIManager : GameSystemManager<HeroUIManager>
 {
-    
+
 
     #region 甯冮樀鐣岄潰
     public List<string> heroOnTeamSortList { get; private set; } = new List<string>();    //涓嶅悓涓婇樀鐨勫垪琛ㄦ帓搴�
@@ -171,7 +171,7 @@
 
         var team = TeamManager.Instance.GetTeam(teamType);
         if (team == null)
-        { 
+        {
             return heroCountryCount;
         }
         TeamHero[] teamHeroes = isPreview ? team.tempHeroes : team.serverHeroes;
@@ -306,6 +306,155 @@
 
     #endregion
 
-    
+    #region 涓荤晫闈笂鐨勬灏嗕笂闃佃В閿佹樉绀� 鍜� 瑙i攣瑙勫垯
+
+    public int[][] lockHeroCountLimit;
+    public List<int> lockIndexList = new List<int>();
+
+    public Action OnUnLockHeroCountEvent;
+    public int lockState
+    {
+        get
+        {
+            return QuickSetting.Instance.GetQuickSettingValue<int>(QuickSettingType.HeroCountLock, 0);
+        }
+        set
+        {
+            QuickSetting.Instance.SetQuickSetting(QuickSettingType.HeroCountLock, value, 0);
+            QuickSetting.Instance.SendPackage();
+            RefreshServerLockIndex();
+        }
+    }
+
+    //瑙i攣涓婇樀鑻遍泟鐨勬暟閲忛檺鍒�, 瑙i攣鏉′欢鍦ㄧ晫闈笂鏄寜椤哄簭鎺掑簭鐨勶紝浣嗘槸閿佸畾鐨勪綅缃槸鍔ㄦ�佸彉鍖栫殑
+    //姣斿 绗�4锛�5锛�6鏍煎瓙閿佷綇浜嗭紝浣嗙6涓殑閿佸厛瀹屾垚浜嗚В閿佹潯浠讹紝瑙i攣鍚庨攣浣忕殑浣嶇疆寰�鍚庨『鎺�
+    //鍒� 绗�4鐨勪綅缃樉绀轰负瑙i攣鐘舵�侊紝5鍜�6鏄攣浣忕姸鎬侊紝5鐨勮В閿佹潯浠舵寜閰嶇疆鍒楄〃鐨勯『搴忚В閿侊紙鍗充负鍘�4鐨勮В閿佹潯浠讹級
+
+    // 妯℃嫙鏈嶅姟绔� 杩欓噷鐨刬ndex 瀵瑰簲鐨勬槸閰嶈〃鐨�
+    public bool IsUnLock(int configIndex)
+    {
+        //鎸塴ockState鐨勪綅鍒ゆ柇
+        return (lockState & (1 << configIndex)) != 0;
+    }
+
+    public bool SetUnLock(int configIndex)
+    {
+        if (!CanUnLock(configIndex, true))
+        {
+            return false;
+        }
+        lockState |= 1 << configIndex;
+        return true;
+    }
+
+    // 瑙i攣绫诲瀷
+    // 1.涓诲叕绛夌骇杈綳绾у紑鍚紱
+    // 2.閫氬叧涓荤嚎X-X寮�鍚紱鍚屼换鍔¢厤娉�
+    // 3.寮�鏈嶆椂闂磋揪鍒癤澶╁紑鍚紱
+    public bool CanUnLock(int configIndex, bool notify = false)
+    {
+        int type = lockHeroCountLimit[configIndex][0];
+        int value = lockHeroCountLimit[configIndex][1];
+        if (type == 1)
+        {
+            if (PlayerDatas.Instance.baseData.LV < value)
+            {
+                if (notify)
+                    SysNotifyMgr.Instance.ShowTip("HeroCountUnLock1", value);
+                return false;
+            }
+        }
+        else if (type == 2)
+        {
+            //濡侲xAttr1鍊间负20103浠h〃褰撳墠宸茬粡杩囦簡绗�2绔犵1鍏崇3娉紱 value涓�201
+            if (PlayerDatas.Instance.baseData.ExAttr1 / 100 <= value)
+            {
+                if (notify)
+                    SysNotifyMgr.Instance.ShowTip("HeroCountUnLock2", value / 100, value % 100);
+                return false;
+            }
+        }
+        else if (type == 3)
+        {
+            if (TimeUtility.OpenDay < value - 1)
+            {
+                if (notify)
+                    SysNotifyMgr.Instance.ShowTip("HeroCountUnLock3", value);
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+
+    public void ShowUnLockTip(int configIndex)
+    {
+        int type = lockHeroCountLimit[configIndex][0];
+        int value = lockHeroCountLimit[configIndex][1];
+        if (type == 1)
+        {
+            if (PlayerDatas.Instance.baseData.LV < value)
+            {
+                SysNotifyMgr.Instance.ShowTip("HeroCountUnLock1", value);
+                return;
+            }
+        }
+        else if (type == 2)
+        {
+            //濡侲xAttr1鍊间负20103浠h〃褰撳墠宸茬粡杩囦簡绗�2绔犵1鍏崇3娉紱 value涓�201
+            if (PlayerDatas.Instance.baseData.ExAttr1 / 100 <= value)
+            {
+                SysNotifyMgr.Instance.ShowTip("HeroCountUnLock2", value / 100, value % 100);
+                return;
+            }
+        }
+        else if (type == 3)
+        {
+            if (TimeUtility.OpenDay < value - 1)
+            {
+                SysNotifyMgr.Instance.ShowTip("HeroCountUnLock3", value);
+                return;
+            }
+        }
+
+        //鍙互瑙i攣锛屼絾鏈В閿�
+        if (!IsUnLock(configIndex))
+        {
+            SysNotifyMgr.Instance.ShowTip("HeroCountUnLock4");
+        }
+    }
+
+
+    // 鍒锋柊鏈В閿佹灏嗕笂闄愮殑閰嶇疆绱㈠紩鍒楄〃
+    public void RefreshServerLockIndex()
+    {
+        lockIndexList.Clear();
+        for (int i = 0; i < lockHeroCountLimit.Length; i++)
+        {
+            if (!IsUnLock(i))
+            {
+                lockIndexList.Add(i);
+            }
+        }
+    }
+
+    public bool UnLockHeroCnt(int lockIndex)
+    {
+        if (lockIndex < 0 || lockIndex >= lockIndexList.Count)
+        {
+            return false;
+        }
+
+        return SetUnLock(lockIndexList[lockIndex]);
+
+    }
+
+    void OnQuickSettingUpdate()
+    {
+        RefreshServerLockIndex();
+    }
+    #endregion
+
 }
 
diff --git a/Main/System/HeroUI/HeroUIManager.cs b/Main/System/HeroUI/HeroUIManager.cs
index 0380453..290919f 100644
--- a/Main/System/HeroUI/HeroUIManager.cs
+++ b/Main/System/HeroUI/HeroUIManager.cs
@@ -32,6 +32,7 @@
         GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
         PackManager.Instance.RefreshItemEvent += RefreshItemEvent;
         TeamManager.Instance.OnTeamChange += OnTeamChangeEvent;
+        QuickSetting.Instance.onQuickSettingUpdate += OnQuickSettingUpdate;
         ParseConfig();
         InitHeroOnTeamRedpointList();
         InitHeroBookRedpointList();
@@ -45,6 +46,7 @@
         GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent;
         PackManager.Instance.RefreshItemEvent -= RefreshItemEvent;
         TeamManager.Instance.OnTeamChange -= OnTeamChangeEvent;
+        QuickSetting.Instance.onQuickSettingUpdate -= OnQuickSettingUpdate;
     }
 
     void ParseConfig()
@@ -60,6 +62,9 @@
 
         config = FuncConfigConfig.Get("HeroRedpoint");
         heroRedpointItemList = JsonMapper.ToObject<int[]>(config.Numerical1);
+
+        config = FuncConfigConfig.Get("HeroOnTeam");
+        lockHeroCountLimit = JsonMapper.ToObject<int[][]>(config.Numerical1);
     }
 
     public void OnBeforePlayerDataInitialize()
diff --git a/Main/System/Main/AutoFightModel.cs b/Main/System/Main/AutoFightModel.cs
index 752b95b..d538613 100644
--- a/Main/System/Main/AutoFightModel.cs
+++ b/Main/System/Main/AutoFightModel.cs
@@ -260,26 +260,7 @@
         OnFightEvent?.Invoke(true);
     }
 
-    public bool CanChallengeBoss()
-    {
-        //鏈�鍚庝竴娉㈤�氳繃锛屼笖褰撳墠娉㈣繕鏄渶鍚庝竴娉紱鍊掗��鍙�掗��娉笉浼氬�掗��鍏冲崱
-        if (PlayerDatas.Instance.baseData.ExAttr2 != PlayerDatas.Instance.baseData.ExAttr1)
-        {
-            return false;
-        }
-        var value = PlayerDatas.Instance.baseData.ExAttr2;
-        var chapterID = value / 10000;
-        var levelNum = value % 10000 / 100;
-        var waveID = value % 100;
 
-        var config = MainLevelConfig.GetMainLevelConfig(chapterID, levelNum);
-        if (waveID < MainLevelConfig.GetwaveCount(config))
-        {
-            return false;
-        }
-
-        return true;
-    }
 
     #endregion
 
diff --git a/Main/System/Main/FightPowerManager.cs b/Main/System/Main/FightPowerManager.cs
index 063da9e..7272789 100644
--- a/Main/System/Main/FightPowerManager.cs
+++ b/Main/System/Main/FightPowerManager.cs
@@ -498,11 +498,11 @@
             var index = team.GetEmptyPosition();
             if (index < 0)
             {
-                team.AddHero(heroInfo, 5);
+                team.AddHero(heroInfo, 5, false);
             }
             else
             {
-                team.AddHero(heroInfo, index);
+                team.AddHero(heroInfo, index, false);
             }
         }
 
diff --git a/Main/System/Main/HeroFightingCardCell.cs b/Main/System/Main/HeroFightingCardCell.cs
index 1108afd..410c72c 100644
--- a/Main/System/Main/HeroFightingCardCell.cs
+++ b/Main/System/Main/HeroFightingCardCell.cs
@@ -17,7 +17,9 @@
     [SerializeField] FillTween cdTween;
 
     [SerializeField] Button clickEmptyBtn;
-
+    [SerializeField] Image emptyLockImg;
+    [SerializeField] Image redPointImg;
+    [SerializeField] UIEffectPlayer unlockEffect;
 
     void OnEnable()
     {
@@ -30,16 +32,35 @@
     }
 
     string guid;
-    public void Display(int index)
+    int lockIndex;
+    public void Display(int index, List<TeamHero> heros)
     {
-        var team = TeamManager.Instance.GetTeam(TeamType.Story);
-        var teamHero = team.GetServerHeroByIndex(index);
+        TeamHero teamHero = null;
+        if (index < heros.Count)
+        {
+            teamHero = heros[index];
+        }
         guid = teamHero != null ? teamHero.guid : "";
         if (guid == "")
         {
             clickHeroBtn.SetActive(false);
             clickEmptyBtn.SetActive(true);
             clickEmptyBtn.AddListener(ClickEmpty);
+            emptyLockImg.SetActive(false);
+            redPointImg.SetActive(false);
+
+            int lockCnt = HeroUIManager.Instance.lockIndexList.Count;
+            //鏍规嵁閿佹暟閲� 鍊掑簭鍒ゆ柇閿佷綇
+            if (lockCnt > 0)
+            {
+                lockIndex = lockCnt - (TeamConst.MaxTeamHeroCount - 1 - index) - 1;
+                if (lockIndex >= 0 && lockIndex < lockCnt)
+                {
+                    emptyLockImg.SetActive(true);
+                    redPointImg.SetActive(HeroUIManager.Instance.CanUnLock(HeroUIManager.Instance.lockIndexList[lockIndex]));
+                }
+            }
+
             return;
         }
         else
@@ -106,6 +127,19 @@
 
     void ClickEmpty()
     {
+        if (emptyLockImg.isActiveAndEnabled)
+        {
+            if (HeroUIManager.Instance.UnLockHeroCnt(lockIndex))
+            {
+                unlockEffect.onComplete = () =>
+                {
+                    HeroUIManager.Instance.OnUnLockHeroCountEvent?.Invoke();
+                    SysNotifyMgr.Instance.ShowTip("HeroCountUnLock5", TeamConst.MaxTeamHeroCount - HeroUIManager.Instance.lockIndexList.Count);
+                };
+                unlockEffect.Play();
+            }
+            return;
+        }
         UIManager.Instance.OpenWindow<HeroCallWin>();
     }
     void OnSkillCast(bool isfighting)
diff --git a/Main/System/Main/HomeWin.cs b/Main/System/Main/HomeWin.cs
index 064f759..a05fdd2 100644
--- a/Main/System/Main/HomeWin.cs
+++ b/Main/System/Main/HomeWin.cs
@@ -142,6 +142,7 @@
         FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChange;
         FirstChargeManager.Instance.OnUpdateFirstChargeInfo += OnUpdateFirstChargeInfo;
         GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
+        HeroUIManager.Instance.OnUnLockHeroCountEvent += OnUnLockHeroCountEvent;
         Display();
         DisplayFirstChargeBtn();
 
@@ -163,6 +164,7 @@
         FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChange;
         FirstChargeManager.Instance.OnUpdateFirstChargeInfo -= OnUpdateFirstChargeInfo;
         GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent;
+        HeroUIManager.Instance.OnUnLockHeroCountEvent -= OnUnLockHeroCountEvent;
 
         //  鍏抽棴鐨勬椂鍊欐妸鎴樻枟鐣岄潰涔熺粰鍏充簡 铏界劧鏄湪澶栭潰寮�鐨�
         UIManager.Instance.CloseWindow<BattleWin>();
@@ -298,10 +300,12 @@
     {
         if (teamType != TeamType.Story)
             return;
+        var team = TeamManager.Instance.GetTeam(teamType);
+        var heros = team.GetHerosOnTeam();
         //鏄剧ず鍗$墝
         for (int i = 0; i < heroFightingCardCells.Length; i++)
         {
-            heroFightingCardCells[i].Display(i);
+            heroFightingCardCells[i].Display(i, heros);
         }
     }
 
@@ -343,7 +347,7 @@
         //銆愭櫘閫氥�戝叧鍗″悕瀛�1-6
         levelName.text = Language.Get("mainui7", chapterConfig.Level, chapterConfig.ChapterName, chapterID, levelNum);
 
-        bool canChallengeBoss = AutoFightModel.Instance.CanChallengeBoss();
+        bool canChallengeBoss = MainLevelManager.Instance.CanChallengeBoss();
         //BOSS
         if (canChallengeBoss)
         {
@@ -432,4 +436,9 @@
     {
         DisplayFirstChargeBtn();
     }
+
+    void OnUnLockHeroCountEvent()
+    {
+        DisplayCard(TeamType.Story);
+    }
 }
\ No newline at end of file
diff --git a/Main/System/MainLevel/MainBossEnterWin.cs b/Main/System/MainLevel/MainBossEnterWin.cs
index 058acbf..9c23ddf 100644
--- a/Main/System/MainLevel/MainBossEnterWin.cs
+++ b/Main/System/MainLevel/MainBossEnterWin.cs
@@ -106,7 +106,7 @@
 
         fightPowerText.text = UIHelper.ReplaceLargeArtNum(levelConfig.FightPower);
 
-        var canChallengeBoss = AutoFightModel.Instance.CanChallengeBoss();
+        var canChallengeBoss = MainLevelManager.Instance.CanChallengeBoss();
 
         fightBtn.SetInteractable(canChallengeBoss);
         fightIcon.SetActive(canChallengeBoss);
@@ -134,7 +134,7 @@
 
     void FightBoss()
     {
-        if (AutoFightModel.Instance.CanChallengeBoss())
+        if (MainLevelManager.Instance.CanChallengeBoss())
         {
             var pack = new CB410_tagCMTurnFight();
             pack.MapID = 2;
@@ -152,7 +152,7 @@
         {
             case PlayerDataType.ExAttr1:
             case PlayerDataType.ExAttr2:
-                var canChallengeBoss = AutoFightModel.Instance.CanChallengeBoss();
+                var canChallengeBoss = MainLevelManager.Instance.CanChallengeBoss();
 
                 fightBtn.SetInteractable(canChallengeBoss);
                 fightIcon.SetActive(canChallengeBoss);
diff --git a/Main/System/MainLevel/MainLevelManager.cs b/Main/System/MainLevel/MainLevelManager.cs
index a4bc494..492f4ea 100644
--- a/Main/System/MainLevel/MainLevelManager.cs
+++ b/Main/System/MainLevel/MainLevelManager.cs
@@ -32,5 +32,26 @@
         }
         OnUpdateDayBooty?.Invoke();
     }
+
+    public bool CanChallengeBoss()
+    {
+        //鏈�鍚庝竴娉㈤�氳繃锛屼笖褰撳墠娉㈣繕鏄渶鍚庝竴娉紱鍊掗��鍙�掗��娉笉浼氬�掗��鍏冲崱
+        if (PlayerDatas.Instance.baseData.ExAttr2 != PlayerDatas.Instance.baseData.ExAttr1)
+        {
+            return false;
+        }
+        var value = PlayerDatas.Instance.baseData.ExAttr2;
+        var chapterID = value / 10000;
+        var levelNum = value % 10000 / 100;
+        var waveID = value % 100;
+
+        var config = MainLevelConfig.GetMainLevelConfig(chapterID, levelNum);
+        if (waveID < MainLevelConfig.GetwaveCount(config))
+        {
+            return false;
+        }
+
+        return true;
+    }
 	
 }
\ No newline at end of file
diff --git a/Main/System/Scroll/ScrollerController.cs b/Main/System/Scroll/ScrollerController.cs
index e5f466c..c9aab16 100644
--- a/Main/System/Scroll/ScrollerController.cs
+++ b/Main/System/Scroll/ScrollerController.cs
@@ -109,6 +109,12 @@
         return _data.Count;
     }
 
+    // 鑾峰彇鎬荤殑Cell鏁扮洰锛堝惈涓嶆樉绀虹殑锛�
+    public int GetNumberOfCells()
+    {
+        return _data.Count;
+    }
+
     public EnhancedScroller m_Scorller;
     private ScrollRect m_ScrollRect;
     public ScrollRect mScrollRect {
diff --git a/Main/System/Setting/QuickSetting.cs b/Main/System/Setting/QuickSetting.cs
index c1199d5..12dd103 100644
--- a/Main/System/Setting/QuickSetting.cs
+++ b/Main/System/Setting/QuickSetting.cs
@@ -19,6 +19,7 @@
         quickSettingDic.Add(QuickSettingType.AutoFight_Open, new QuickSettingRange(QuickSettingType.AutoFight_Open, 3, 1));
         quickSettingDic.Add(QuickSettingType.AutoGoldRush, new QuickSettingRange(QuickSettingType.AutoGoldRush, 4, 10, 1));  //鑷姩娣橀噾锛�9涓墿鍝佸�硷紝1涓嚜鍔ㄥ埛鏂板紑鍏�
         quickSettingDic.Add(QuickSettingType.BattleSpeed, new QuickSettingRange(QuickSettingType.BattleSpeed, 14, 1));
+        quickSettingDic.Add(QuickSettingType.HeroCountLock, new QuickSettingRange(QuickSettingType.HeroCountLock, 15, 2));
 
         setting = new string(UCharacter, 100);
         DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent;
@@ -163,6 +164,7 @@
     AutoFight_Open,    //鏄惁寮�鍚嚜鍔ㄦ垬鏂�
     AutoGoldRush,   //鑷姩娣橀噾
     BattleSpeed,    //鎴樻枟閫熷害绱㈠紩  闈炰富绾块儴鍒�
+    HeroCountLock,  //涓婇樀浜烘暟鏉′欢閿佸畾
 }
 
 public class QuickSettingRange
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