From 0d226a53cc7a1b93ee6a494be5965c37f98310ae Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期一, 29 十二月 2025 23:21:24 +0800
Subject: [PATCH] 0312 武将招募增加心愿符

---
 Main/System/Arena/HeroCountryComponent.cs |   96 +++++------------------------------------------
 1 files changed, 11 insertions(+), 85 deletions(-)

diff --git a/Main/System/Arena/HeroCountryComponent.cs b/Main/System/Arena/HeroCountryComponent.cs
index 0f01ce0..10f3d5b 100644
--- a/Main/System/Arena/HeroCountryComponent.cs
+++ b/Main/System/Arena/HeroCountryComponent.cs
@@ -4,100 +4,26 @@
 
 public class HeroCountryComponent : MonoBehaviour
 {
+    [SerializeField] Button countryOnBtn;
     [SerializeField] Image countryOnImg;    //涓婇樀闃靛瀷婵�娲诲浗瀹�
     [SerializeField] UIEffectPlayer countryEffect;
     [SerializeField] List<Image> OnCountImgs;    //涓婇樀鏁伴噺婵�娲�
-
-    /// <summary>
-    /// 涓婇樀闃熶紞涓悇涓浗瀹剁殑姝﹀皢鏁伴噺
-    /// </summary>
-    public Dictionary<HeroCountry, int> GetCountryHeroCountByTeamType(List<TeamHero> teamHeroes)
+    List<TeamHero> teamHeroes;
+    void Awake()
     {
-        Dictionary<HeroCountry, int> heroCountryCount = new Dictionary<HeroCountry, int>();
-        if (teamHeroes == null)
+        countryOnBtn.AddListener(() =>
         {
-            return heroCountryCount;
-        }
-        for (int i = 0; i < teamHeroes.Count; i++)
-        {
-            if (teamHeroes[i] == null)
-                continue;
-            var country = teamHeroes[i].Country;
-
-            if (!heroCountryCount.ContainsKey(country))
-            {
-                heroCountryCount.Add(country, 1);
-            }
-            else
-            {
-                heroCountryCount[country] += 1;
-            }
-
-        }
-
-
-        return heroCountryCount;
-    }
-
-    /// <summary>
-    /// 鑾峰緱涓婇樀涓灏嗘暟閲忔渶澶х殑鍥藉鍜屾暟閲�
-    /// </summary>
-    public Int2 GetMaxCountHeroCountry(List<TeamHero> teamType)
-    {
-        var countryCountDict = GetCountryHeroCountByTeamType(teamType);
-        //鎵惧埌鏈�澶х殑鍥藉鍜屾暟閲�
-        HeroCountry country = HeroCountry.None;
-        int maxValue = 0;
-        foreach (var data in countryCountDict)
-        {
-            if (data.Value > maxValue)
-            {
-                country = data.Key;
-                maxValue = data.Value;
-            }
-        }
-        return new Int2((int)country, maxValue);
+            HeroUIManager.Instance.isCustonHeroFormation = true;
+            HeroUIManager.Instance.custonTeamHeroes = teamHeroes;
+            UIManager.Instance.OpenWindow<HeroFormationWin>();
+        });
     }
 
     //涓婇樀姝﹀皢鍥藉鍏夌幆婵�娲�
-    public void RefreshOnTeamCountry(List<TeamHero> teamType, bool playEffect = false)
+    public void RefreshOnTeamCountry(List<TeamHero> teamHeroes, bool playEffect = false)
     {
-        Int2 result = GetMaxCountHeroCountry(teamType);
-
-        var config = HeroLineupHaloConfig.GetConfig(result.x, result.y);
-        if (config == null)
-        {
-            countryOnImg.SetSprite("heroTeamCountry0");
-            for (int i = 0; i < OnCountImgs.Count; i++)
-            {
-                OnCountImgs[i].SetActive(false);
-            }
-        }
-        else
-        {
-            countryOnImg.SetSprite("heroTeamCountry" + result.x);
-            for (int i = 0; i < OnCountImgs.Count; i++)
-            {
-                if (i < result.y)
-                {
-                    OnCountImgs[i].SetActive(true);
-                    OnCountImgs[i].SetSprite("heroTeamCountryPoint" + result.x);
-                }
-                else
-                {
-                    OnCountImgs[i].SetActive(false);
-                }
-            }
-            if (playEffect)
-                countryEffect.Play();
-        }
-
-    }
-
-    //涓婇樀姝﹀皢鍥藉鍏夌幆婵�娲�
-    public void RefreshOnTeamCountry(TeamType selectTeamType, bool playEffect = false)
-    {
-        Int2 result = HeroUIManager.Instance.GetMaxCountHeroCountry(selectTeamType, true);
+        this.teamHeroes = teamHeroes;
+        Int2 result = HeroUIManager.Instance.GetMaxCountHeroCountry(teamHeroes);
 
         var config = HeroLineupHaloConfig.GetConfig(result.x, result.y);
         if (config == null)

--
Gitblit v1.8.0