From 484239463e0802b47070d5df8d7b6931a64b0a67 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期一, 30 三月 2026 17:03:52 +0800
Subject: [PATCH] 492 武将返场
---
Main/System/HeroDebut/HeroDebutManager.cs | 65 +++++++++++---------------------
1 files changed, 22 insertions(+), 43 deletions(-)
diff --git a/Main/System/HeroDebut/HeroDebutManager.cs b/Main/System/HeroDebut/HeroDebutManager.cs
index d966740..5a32e8f 100644
--- a/Main/System/HeroDebut/HeroDebutManager.cs
+++ b/Main/System/HeroDebut/HeroDebutManager.cs
@@ -77,9 +77,9 @@
private void OnBeforePlayerDataInitializeEventOnRelogin()
{
isSendFirst = true;
- starHeroIndexDict.Clear();
+ starHeroIndex = 0;
+ callHeroIndex = 0;
starFreeAwardDict.Clear();
- callHeroIndexDict.Clear();
}
private void OnPlayerLoginOk()
@@ -243,22 +243,23 @@
OnNowCallChooseHeroIDChangeEvent?.Invoke();
}
}
- public event Action<int> OnUpdateHeroAppearPlayerInfoEvent;
+ public int starHeroIndex = 0;
+ public int callHeroIndex = 0;
+ //<鍗囨槦璁″垝閫夋嫨鐨勬灏咺D绱㈠紩,鍗囨槦璁″垝鍏嶈垂濂栧姳璁板綍>
+ Dictionary<int, uint> starFreeAwardDict = new();
+
+ public event Action OnUpdateHeroAppearPlayerInfoEvent;
public void UpdateHeroAppearPlayerInfo(HAA22_tagSCActHeroAppearPlayerInfo vNetData)
{
if (vNetData == null) return;
- int actNum = vNetData.ActNum;
- starHeroIndexDict[actNum] = vNetData.StarHeroIndex;
- callHeroIndexDict[actNum] = vNetData.CallHeroIndex;
+ if (vNetData.ActNum != this.actNum) return;
- if (!starFreeAwardDict.TryGetValue(actNum, out var dict))
- {
- dict = new Dictionary<int, uint>();
- starFreeAwardDict[actNum] = dict;
- }
- dict[vNetData.StarHeroIndex] = vNetData.StarFreeAward;
+ int actNum = vNetData.ActNum;
+ starHeroIndex = vNetData.StarHeroIndex;
+ callHeroIndex = vNetData.CallHeroIndex;
+ starFreeAwardDict[starHeroIndex] = vNetData.StarFreeAward;
UpdateRedpoint();
- OnUpdateHeroAppearPlayerInfoEvent?.Invoke(actNum);
+ OnUpdateHeroAppearPlayerInfoEvent?.Invoke();
}
public void SendHeroAppearStarHeroSelect(int actNum, int starHeroIndex)
@@ -432,12 +433,6 @@
#region 鍗囨槦璁″垝
- //<娲诲姩缂栧彿,鍗囨槦璁″垝閫夋嫨鐨勬灏咺D绱㈠紩>
- public Dictionary<int, int> starHeroIndexDict = new();
-
- //<娲诲姩缂栧彿,<鍗囨槦璁″垝閫夋嫨鐨勬灏咺D绱㈠紩,鍗囨槦璁″垝鍏嶈垂濂栧姳璁板綍>>
- public Dictionary<int, Dictionary<int, uint>> starFreeAwardDict = new();
-
/// <summary>
/// 褰撳墠鍗囨槦璁″垝閫変腑鐨勬灏咺D
/// </summary>
@@ -445,12 +440,11 @@
{
var act = GetOperationHeroAppearInfo();
if (act == null) return 0;
- if (!starHeroIndexDict.TryGetValue(actNum, out int index)) return 0;
var config = ActHeroAppearConfig.Get(act.CfgID);
- if (config == null || config.ActHeroIDList?.Length <= index) return 0;
+ if (config == null || config.ActHeroIDList?.Length <= starHeroIndex) return 0;
- return config.ActHeroIDList[index];
+ return config.ActHeroIDList[starHeroIndex];
}
private Dictionary<int, Dictionary<int, int[][]>> showHeroGiftItemInfoDict = new();
@@ -508,16 +502,14 @@
// 娌¤幏寰楁灏嗘湰浣撲笉鍙鍙�
if (!HeroManager.Instance.HasHero(heroId))return 0;
- if (!starHeroIndexDict.TryGetValue(actNum, out int index)) return 0;
- if (IsStarUpFreeHave(index, config.AwardIndex)) return 2;
+ if (IsStarUpFreeHave(starHeroIndex, config.AwardIndex)) return 2;
if (IsHeroStarCntOk(heroConfig.HeroID, config.NeedStar)) return 1;
return 0;
}
private bool IsStarUpFreeHave(int starHeroIndex, int awardIndex)
{
- if (!starFreeAwardDict.TryGetValue(actNum, out var dict)) return false;
- if (!dict.TryGetValue(starHeroIndex, out uint freeAward)) return false;
+ if (!starFreeAwardDict.TryGetValue(starHeroIndex, out uint freeAward)) return false;
return ((freeAward >> awardIndex) & 1u) == 1u;
}
@@ -544,7 +536,7 @@
public bool TryGetStarUpStateIndex(int starGiftTempID, int tarState, out int index)
{
index = 0;
- var list = ActHeroAppearStarConfig.GetAwardIndexSortList(starGiftTempID);
+ var list = ActHeroAppearStarConfig.GetHeroDebutAwardIndexSortList(starGiftTempID);
if (list == null) return false;
for (int i = 0; i < list.Count; i++)
@@ -733,7 +725,7 @@
}
private string GetCallSkipKey(int cfgID, OperationDate startDate, OperationDate endDate)
{
- return string.Concat("HeroDebutManager_CallSkip_", cfgID, ToInt(startDate), ToInt(endDate), PlayerDatas.Instance.PlayerId);
+ return string.Concat("HeroDebutManager_CallSkip_", cfgID, "_", ToInt(startDate), "_", ToInt(endDate), "_", PlayerDatas.Instance.PlayerId);
}
public bool LoadCallSkipData(int cfgID, OperationDate startDate, OperationDate endDate)
@@ -746,9 +738,6 @@
LocalSave.SetBool(GetCallSkipKey(cfgID, startDate, endDate), value);
}
- //<娲诲姩缂栧彿,鎷涘嫙閫夋嫨鐨勬灏咺D绱㈠紩>
- public Dictionary<int, int> callHeroIndexDict = new();
-
/// <summary>
/// 褰撳墠鎷涘嫙閫変腑鐨勬灏咺D
/// </summary>
@@ -756,12 +745,11 @@
{
var act = GetOperationHeroAppearInfo();
if (act == null) return 0;
- if (!callHeroIndexDict.TryGetValue(actNum, out int index)) return 0;
var config = ActHeroAppearConfig.Get(act.CfgID);
- if (config == null || config.ActHeroIDList?.Length <= index) return 0;
+ if (config == null || config.ActHeroIDList?.Length <= callHeroIndex) return 0;
- return config.ActHeroIDList[index];
+ return config.ActHeroIDList[callHeroIndex];
}
@@ -960,19 +948,10 @@
{
return gameRecDict;
}
- public List<HeroDebutGameRec> GetLastFourRecords()
- {
- if (gameRecDict == null || gameRecDict.Count == 0) return new List<HeroDebutGameRec>();
-
- int count = gameRecDict.Count;
- int takeCount = Math.Min(4, count);
- return gameRecDict.GetRange(count - takeCount, takeCount);
- }
public event Action OnUpdateGameRecInfo;
public void UpdateGameRecInfo(HA009_tagSCGameRecInfo vNetData)
{
-
var act = GetOperationHeroAppearInfo();
if (act == null) return;
--
Gitblit v1.8.0