From 68869f5b4b4139958942294522471ff9f9f6c8f9 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期三, 27 五月 2026 14:56:13 +0800
Subject: [PATCH] 656 布阵阵型增加混搭武将组合
---
Main/System/HeroUI/HeroFormationCell.cs | 93 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 93 insertions(+), 0 deletions(-)
diff --git a/Main/System/HeroUI/HeroFormationCell.cs b/Main/System/HeroUI/HeroFormationCell.cs
index 2ab74ca..1fa3f1a 100644
--- a/Main/System/HeroUI/HeroFormationCell.cs
+++ b/Main/System/HeroUI/HeroFormationCell.cs
@@ -1,3 +1,4 @@
+using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
@@ -12,6 +13,13 @@
public void Display(int index)
{
+ // 绗�5涓牸瀛愪负娣锋惌闃靛瀷
+ if (index == 4)
+ {
+ DisplayMixedFormation();
+ return;
+ }
+
Int2 result;
if (HeroUIManager.Instance.isCustonHeroFormation)
{
@@ -75,5 +83,90 @@
}
attrText.text = text;
}
+
+ void DisplayMixedFormation()
+ {
+ // 鑾峰彇褰撳墠婵�娲荤殑娣锋惌閰嶇疆
+ HeroLineupHaloConfig activeMixedConfig;
+ List<TeamHero> teamHeroes = null;
+ if (HeroUIManager.Instance.isCustonHeroFormation)
+ teamHeroes = HeroUIManager.Instance.custonTeamHeroes;
+
+ if (teamHeroes != null)
+ activeMixedConfig = HeroUIManager.Instance.GetMixedFormationConfig(teamHeroes);
+ else
+ activeMixedConfig = HeroUIManager.Instance.GetMixedFormationConfig(HeroUIManager.Instance.selectTeamType, true);
+
+ bool hasActive = activeMixedConfig != null;
+ activeImg.SetActive(hasActive);
+ countryOnImg.SetSprite("heroTeamCountryHe");
+
+ // 婵�娲荤偣鏄剧ず锛氫娇鐢ㄥ綋鍓嶆縺娲婚厤缃殑闃佃惀棰滆壊
+ List<int> participatingCountries = null;
+ if (teamHeroes != null)
+ participatingCountries = HeroUIManager.Instance.GetParticipatingCountriesByPriority(teamHeroes);
+ else
+ participatingCountries = HeroUIManager.Instance.GetParticipatingCountriesByPriority(HeroUIManager.Instance.selectTeamType, true);
+
+ if (activeMixedConfig != null && participatingCountries != null && participatingCountries.Count > 0)
+ {
+ int totalPoints = activeMixedConfig.Countrys * activeMixedConfig.NeedHeroCount;
+ for (int i = 0; i < OnCountImgs.Length; i++)
+ {
+ if (i < totalPoints)
+ {
+ int countryIndex = i / activeMixedConfig.NeedHeroCount;
+ OnCountImgs[i].SetActive(true);
+ OnCountImgs[i].SetSprite("heroTeamCountryPoint" + participatingCountries[countryIndex]);
+ }
+ else
+ {
+ OnCountImgs[i].SetActive(false);
+ }
+ }
+ }
+ else
+ {
+ for (int i = 0; i < OnCountImgs.Length; i++)
+ OnCountImgs[i].SetActive(false);
+ }
+
+ // 鑾峰彇鎵�鏈夋贩鎼厤缃苟灞曞钩锛屾寜 Countrys 鎺掑簭
+ var allMixedConfigs = HeroLineupHaloConfig.GetAllMixedConfigs();
+ List<HeroLineupHaloConfig> sortedConfigs = new List<HeroLineupHaloConfig>();
+ if (allMixedConfigs != null)
+ {
+ foreach (var kvp in allMixedConfigs)
+ {
+ foreach (var innerKvp in kvp.Value)
+ {
+ sortedConfigs.Add(innerKvp.Value);
+ }
+ }
+ sortedConfigs.Sort((a, b) =>
+ {
+ if (a.Countrys != b.Countrys) return a.Countrys.CompareTo(b.Countrys);
+ return a.NeedHeroCount.CompareTo(b.NeedHeroCount);
+ });
+ }
+
+ // 灞炴�ф枃鏈細閬嶅巻鎵�鏈夋贩鎼厤缃紝婵�娲荤殑楂樹寒锛屾湭婵�娲荤殑鐏拌壊
+ string text = string.Empty;
+ for (int k = 0; k < sortedConfigs.Count; k++)
+ {
+ var config = sortedConfigs[k];
+ bool isActive = activeMixedConfig != null && activeMixedConfig.Id == config.Id;
+ string lineText = (k == 0 ? "" : "</r>") + Language.Get("herocard74", config.Countrys, config.NeedHeroCount);
+
+ for (int i = 0; i < config.AttrIDList.Length; i++)
+ {
+ string format = !isActive ? "{0}+{1}" : "{0}+" + UIHelper.AppendColor(TextColType.Green, "{1}");
+ lineText += " " + PlayerPropertyConfig.GetFullDescription(config.AttrIDList[i], config.AttrValueList[i], format);
+ }
+
+ text += UIHelper.AppendColor(isActive ? TextColType.NavyBrown : TextColType.Gray, lineText);
+ }
+ attrText.text = text;
+ }
}
--
Gitblit v1.8.0