From 5825214a6017396705a4f8b7d8071f689819773f Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期一, 02 二月 2026 21:23:32 +0800
Subject: [PATCH] 0312 武将支持批量吞噬

---
 Main/System/HeroUI/HeroGiftRoleListCell.cs |   42 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/Main/System/HeroUI/HeroGiftRoleListCell.cs b/Main/System/HeroUI/HeroGiftRoleListCell.cs
index e84aec0..d4466f2 100644
--- a/Main/System/HeroUI/HeroGiftRoleListCell.cs
+++ b/Main/System/HeroUI/HeroGiftRoleListCell.cs
@@ -8,6 +8,7 @@
     [SerializeField] HeroShowBaseCell addHeroShow;
     [SerializeField] GiftBaseCell[] addGiftCells;
     [SerializeField] Image onTeamImg;
+    [SerializeField] Toggle selectToggle;
 
     public void Display(int index)
     {
@@ -18,6 +19,9 @@
         HeroUIManager.Instance.RefreshGiftCell(addGiftCells, hero);
 
         onTeamImg.SetActive(hero.IsInAnyTeam());
+        int girdIndex = hero.itemHero.gridIndex;
+        selectToggle.isOn = HeroUIManager.Instance.selectEatHeroIndexList.Contains(girdIndex);
+
     }
 
     void AddHero(int index)
@@ -69,7 +73,8 @@
             return;
         }
 
-
+        int maxStarCnt = HeroUIManager.Instance.GetMaxStarCount(hero.heroId, hero.Quality);
+        int girdIndex = hero.itemHero.gridIndex;
         if (hero.heroStar > 0)
         {
             ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
@@ -77,16 +82,41 @@
                 {
                     if (isOK)
                     {
-                        HeroUIManager.Instance.selectEatHeroGuid = HeroUIManager.Instance.heroEatList[index];
-                        UIManager.Instance.CloseWindow<HeroGiftRoleListWin>();
+                        SelectHero(girdIndex, maxStarCnt);
                     }
                 });
             return;
         }
-    
 
-        HeroUIManager.Instance.selectEatHeroGuid = HeroUIManager.Instance.heroEatList[index];
-        UIManager.Instance.CloseWindow<HeroGiftRoleListWin>();
+        SelectHero(girdIndex, maxStarCnt);
+        
+    }
+
+    void SelectHero(int girdIndex, int maxStarCnt)
+    {
+        if (!selectToggle.isOn)
+        {
+            if (HeroUIManager.Instance.selectEatHeroIndexList.Count >= maxStarCnt)
+            {
+                SysNotifyMgr.Instance.ShowTip("HeroGiftEat1");
+                return;
+            }
+
+            if (!HeroUIManager.Instance.selectEatHeroIndexList.Contains(girdIndex))
+            {
+                HeroUIManager.Instance.selectEatHeroIndexList.Add(girdIndex);
+                selectToggle.isOn = true;
+                
+            }
+        }
+        else
+        {
+            if (HeroUIManager.Instance.selectEatHeroIndexList.Contains(girdIndex))
+            {
+                HeroUIManager.Instance.selectEatHeroIndexList.Remove(girdIndex);
+                selectToggle.isOn = false;
+            }
+        }
     }
 }
 

--
Gitblit v1.8.0