From 39001a600fcae2bcf27c225df8752d75fb92fef4 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 31 十月 2025 11:18:26 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
---
Main/System/HeroUI/HeroUIManager.OnTeam.cs | 286 +++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 255 insertions(+), 31 deletions(-)
diff --git a/Main/System/HeroUI/HeroUIManager.OnTeam.cs b/Main/System/HeroUI/HeroUIManager.OnTeam.cs
index b3f4167..73d39ac 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>(); //涓嶅悓涓婇樀鐨勫垪琛ㄦ帓搴�
@@ -148,7 +148,7 @@
{
return heroA.Quality > heroB.Quality ? -1 : 1;
}
- if (heroA.heroStar != heroA.heroStar)
+ if (heroA.heroStar != heroB.heroStar)
{
return heroA.heroStar > heroB.heroStar ? -1 : 1;
}
@@ -171,12 +171,43 @@
var team = TeamManager.Instance.GetTeam(teamType);
if (team == null)
- {
+ {
return heroCountryCount;
}
TeamHero[] teamHeroes = isPreview ? team.tempHeroes : team.serverHeroes;
for (int i = 0; i < teamHeroes.Length; 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 Dictionary<HeroCountry, int> GetCountryHeroCountByTeamHeroList(List<TeamHero> teamHeroes)
+ {
+ Dictionary<HeroCountry, int> heroCountryCount = new Dictionary<HeroCountry, int>();
+ if (teamHeroes == null)
+ {
+ return heroCountryCount;
+ }
+ for (int i = 0; i < teamHeroes.Count; i++)
{
if (teamHeroes[i] == null)
continue;
@@ -220,6 +251,26 @@
return new Int2((int)country, maxValue);
}
+ /// <summary>
+ /// 鑾峰緱鑷畾涔夐槦浼嶄腑姝﹀皢鏁伴噺鏈�澶х殑鍥藉鍜屾暟閲�
+ /// </summary>
+ public Int2 GetMaxCountHeroCountry(List<TeamHero> teamType)
+ {
+ var countryCountDict = GetCountryHeroCountByTeamHeroList(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);
+ }
+
//鍦ㄤ笉鍚岄〉绛句笅閫堿ttackType 0 鏀诲嚮闃靛 1 闃插畧闃靛
public int GetSelectTeamTypeByAttackType(int AttackType)
{
@@ -241,12 +292,8 @@
//鎺ㄨ崘闃靛
public List<string> SelectRecommend()
{
- //鎺ㄨ崘闃靛鐨勭畻娉曢�昏緫
- //鑷姩閫夋嫨浼樺厛绾э細姝﹀皢绛夌骇锛炵獊鐮寸瓑绾э紴姝﹀皢瑙夐啋闃剁骇锛炴灏嗗搧璐紴姝﹀皢鍚炲櫖鏄熺骇锛炴灏咺D
var tmpList = HeroManager.Instance.GetHeroGuidList();
tmpList.Sort(CmpHeroRecommend);
-
-
//鎺ㄨ崘鏈�澶�6涓紝瀛樺湪鐩稿悓heroid锛屽垯璺宠繃
List<string> selectHeroList = new List<string>();
List<int> selectHeroIDList = new List<int>();
@@ -258,6 +305,7 @@
string guid = tmpList[i];
HeroInfo heroInfo = HeroManager.Instance.GetHero(guid);
if (selectHeroIDList.Contains(heroInfo.heroId))
+ //閲嶅鑻遍泟
continue;
//濡傛灉閲嶅浜�,璺宠繃
if (selectHeroList.Contains(guid))
@@ -265,10 +313,16 @@
selectHeroList.Add(guid);
selectHeroIDList.Add(heroInfo.heroId);
}
+
+ // 鍐嶆寜 鑲夌浘>鎺у埗>杈撳嚭>杈呭姪
+ selectHeroList.Sort(CmpByJob);
+
return selectHeroList;
}
-
+ //锛侊紒锛佹柊鎺掑簭瑙勫垯
+ //鑻ュ湪鏂版墜寮曞锛堝紩瀵糏D锛変腑锛屽鏋�5鍙蜂綅涓虹┖锛屽垯浼樺厛鏀剧疆5鍙蜂綅
+ //鎸夋垬鍔涙帓搴�
int CmpHeroRecommend(string guidA, string guidB)
{
HeroInfo heroA = HeroManager.Instance.GetHero(guidA);
@@ -278,34 +332,204 @@
return 0;
}
- // 鎺掑簭瑙勫垯锛氭灏嗙瓑绾э紴绐佺牬绛夌骇锛炴灏嗚閱掗樁绾э紴姝﹀皢鍝佽川锛炴灏嗗悶鍣槦绾э紴姝﹀皢ID
- if (heroA.heroLevel != heroB.heroLevel)
- {
- return heroA.heroLevel > heroB.heroLevel ? -1 : 1;
- }
- if (heroA.breakLevel != heroB.breakLevel)
- {
- return heroA.breakLevel > heroB.breakLevel ? -1 : 1;
- }
- if (heroA.awakeLevel != heroB.awakeLevel)
- {
- return heroA.awakeLevel > heroB.awakeLevel ? -1 : 1;
- }
- if (heroA.Quality != heroB.Quality)
- {
- return heroA.Quality > heroB.Quality ? -1 : 1;
- }
- if (heroA.heroStar != heroA.heroStar)
- {
- return heroA.heroStar > heroB.heroStar ? -1 : 1;
- }
+ // // 鎺掑簭瑙勫垯锛氭灏嗙瓑绾э紴绐佺牬绛夌骇锛炴灏嗚閱掗樁绾э紴姝﹀皢鍝佽川锛炴灏嗗悶鍣槦绾э紴姝﹀皢ID
+ // if (heroA.heroLevel != heroB.heroLevel)
+ // {
+ // return heroA.heroLevel > heroB.heroLevel ? -1 : 1;
+ // }
+ // if (heroA.breakLevel != heroB.breakLevel)
+ // {
+ // return heroA.breakLevel > heroB.breakLevel ? -1 : 1;
+ // }
+ // if (heroA.awakeLevel != heroB.awakeLevel)
+ // {
+ // return heroA.awakeLevel > heroB.awakeLevel ? -1 : 1;
+ // }
+ // if (heroA.Quality != heroB.Quality)
+ // {
+ // return heroA.Quality > heroB.Quality ? -1 : 1;
+ // }
+ // if (heroA.heroStar != heroB.heroStar)
+ // {
+ // return heroA.heroStar > heroB.heroStar ? -1 : 1;
+ // }
- return heroA.heroId.CompareTo(heroB.heroId);
+
+
+ return heroB.CalculateFightPower(false).CompareTo(heroA.CalculateFightPower(false));
+ }
+
+ int CmpByJob(string guidA, string guidB)
+ {
+ HeroInfo heroA = HeroManager.Instance.GetHero(guidA);
+ HeroInfo heroB = HeroManager.Instance.GetHero(guidB);
+ if (heroA == null || heroB == null)
+ {
+ return 0;
+ }
+
+ int indexA = Array.IndexOf(teamSortByJob, heroA.heroConfig.Class);
+ int indexB = Array.IndexOf(teamSortByJob, heroB.heroConfig.Class);
+
+ return indexA.CompareTo(indexB);
}
#endregion
-
+ #region 涓荤晫闈笂鐨勬灏嗕笂闃佃В閿佹樉绀� 鍜� 瑙i攣瑙勫垯
+
+ public int[][] lockHeroCountLimit;
+ public List<int> lockIndexList = new List<int>();
+
+ public int[] teamSortByJob;
+ public int onekeyGuideID;
+ public int[] onekeyGuidePosList; //涓�閿笂闃靛湪寮曞涓嬬殑椤哄簭
+
+ 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
+
}
--
Gitblit v1.8.0