客户端rsa,冗余清理,bug修复,安卓build问题
This commit is contained in:
@@ -98,7 +98,9 @@ public class UI_Idols : MonoBehaviour
|
||||
{
|
||||
BindQuitButton();
|
||||
btmandtopController.GlobalOverlayPanelVisibilityChanged += HandleOverlayPanelsVisibilityChanged;
|
||||
AllyHeroDeployLedger.EnsureInstance().InitializeIfNeeded();
|
||||
AllyHeroDeployLedger.EnsureInstance().OnHeroGrowthChanged += HandleHeroGrowthChanged;
|
||||
StoreOwnershipLedger.EnsureInstance().OnOwnershipChanged += HandleOwnershipChanged;
|
||||
InitializeSectionToggles();
|
||||
RebuildCards();
|
||||
HandleOverlayPanelsVisibilityChanged(btmandtopController.CurrentOverlayPanelsVisible);
|
||||
@@ -112,6 +114,10 @@ public class UI_Idols : MonoBehaviour
|
||||
{
|
||||
AllyHeroDeployLedger.Instance.OnHeroGrowthChanged -= HandleHeroGrowthChanged;
|
||||
}
|
||||
if (StoreOwnershipLedger.Instance != null)
|
||||
{
|
||||
StoreOwnershipLedger.Instance.OnOwnershipChanged -= HandleOwnershipChanged;
|
||||
}
|
||||
if (idolExpBarTween != null && idolExpBarTween.IsActive())
|
||||
{
|
||||
idolExpBarTween.Kill();
|
||||
@@ -485,7 +491,7 @@ public class UI_Idols : MonoBehaviour
|
||||
SetText(finishGameTimes, FormatSevenDigitCount(hero.ally_finishCount));
|
||||
SetText(mvpGetTimes, FormatSevenDigitCount(hero.ally_mvpCount));
|
||||
SetText(joinTeamTimes, FormatJoinDate(hero.ally_joinDateUtcTicks));
|
||||
ApplyLevelDetails(hero.GetEffectiveLevelInfoWithEquipment(hero.GetEffectiveLevelForCurrentEXP()));
|
||||
ApplyLevelDetails(GetEffectiveLevelInfoFromLedger(hero));
|
||||
ApplyBehaviourRadar(hero);
|
||||
|
||||
PopulateSpecialSkills(hero);
|
||||
@@ -558,8 +564,9 @@ public class UI_Idols : MonoBehaviour
|
||||
|
||||
levels.Sort((left, right) => left.requiredEXP.CompareTo(right.requiredEXP));
|
||||
|
||||
int currentExp = Mathf.Max(0, hero.ally_currentEXP);
|
||||
int displayIndex = Mathf.Clamp(hero.GetUnlockedLevelIndex(), 0, levels.Count - 1);
|
||||
AllyHeroDeployLedger ledger = AllyHeroDeployLedger.EnsureInstance();
|
||||
int currentExp = hero.ally_heroID > 0 ? ledger.GetCurrentExp(hero.ally_heroID) : Mathf.Max(0, hero.ally_currentEXP);
|
||||
int displayIndex = ResolveUnlockedLevelIndexFromLedger(hero, levels, ledger);
|
||||
AllyHero_SO.AllyLevelInfo currentLevel = levels[displayIndex];
|
||||
int tierIndex = ResolveTierIndex(currentLevel, displayIndex, levels.Count);
|
||||
snapshot.levelIcon = GetLevelIconByIndex(tierIndex);
|
||||
@@ -874,7 +881,7 @@ public class UI_Idols : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
AllyHero_SO.AllyLevelInfo baseLevelInfo = currentSelectedHero != null ? currentSelectedHero.GetEffectiveLevelForCurrentEXP() : levelInfo;
|
||||
AllyHero_SO.AllyLevelInfo baseLevelInfo = currentSelectedHero != null ? GetBaseLevelInfoFromLedger(currentSelectedHero) : levelInfo;
|
||||
SetText(il.hp, FormatGrowthInt(baseLevelInfo != null ? baseLevelInfo.maxHP : levelInfo.maxHP, levelInfo.maxHP));
|
||||
SetText(il.attack, FormatGrowthInt(baseLevelInfo != null ? baseLevelInfo.attack : levelInfo.attack, levelInfo.attack));
|
||||
SetText(il.mana, FormatGrowthInt(baseLevelInfo != null ? baseLevelInfo.maxMana : levelInfo.maxMana, levelInfo.maxMana));
|
||||
@@ -893,6 +900,61 @@ public class UI_Idols : MonoBehaviour
|
||||
SetText(il.miss_hl, FormatNumber(levelInfo.missHpLossBase));
|
||||
}
|
||||
|
||||
private AllyHero_SO.AllyLevelInfo GetEffectiveLevelInfoFromLedger(AllyHero_SO hero)
|
||||
{
|
||||
AllyHero_SO.AllyLevelInfo baseLevelInfo = GetBaseLevelInfoFromLedger(hero);
|
||||
return hero != null ? hero.GetEffectiveLevelInfoWithEquipment(baseLevelInfo) : null;
|
||||
}
|
||||
|
||||
private AllyHero_SO.AllyLevelInfo GetBaseLevelInfoFromLedger(AllyHero_SO hero)
|
||||
{
|
||||
if (hero == null || hero.levelStats == null || hero.levelStats.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<AllyHero_SO.AllyLevelInfo> levels = new List<AllyHero_SO.AllyLevelInfo>();
|
||||
for (int i = 0; i < hero.levelStats.Count; i++)
|
||||
{
|
||||
if (hero.levelStats[i] != null)
|
||||
{
|
||||
levels.Add(hero.levelStats[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (levels.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
levels.Sort((left, right) => left.requiredEXP.CompareTo(right.requiredEXP));
|
||||
int index = ResolveUnlockedLevelIndexFromLedger(hero, levels, AllyHeroDeployLedger.EnsureInstance());
|
||||
if (index < 0 || index >= levels.Count)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return levels[index];
|
||||
}
|
||||
|
||||
private int ResolveUnlockedLevelIndexFromLedger(AllyHero_SO hero, List<AllyHero_SO.AllyLevelInfo> levels, AllyHeroDeployLedger ledger)
|
||||
{
|
||||
if (levels == null || levels.Count == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (hero == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int unlockedIndex = hero.ally_heroID > 0
|
||||
? ledger.GetUnlockedTierIndex(hero.ally_heroID)
|
||||
: hero.ally_growthUnlockedTierIndex;
|
||||
return Mathf.Clamp(unlockedIndex, 0, levels.Count - 1);
|
||||
}
|
||||
|
||||
public void RefreshCurrentHeroDetails()
|
||||
{
|
||||
ApplyHeroDetails(currentSelectedHero, false);
|
||||
@@ -945,6 +1007,11 @@ public class UI_Idols : MonoBehaviour
|
||||
RebuildCards(false);
|
||||
}
|
||||
|
||||
private void HandleOwnershipChanged(int _)
|
||||
{
|
||||
RebuildCards(false);
|
||||
}
|
||||
|
||||
private static string FormatSevenDigitCount(int value)
|
||||
{
|
||||
if (value <= 0)
|
||||
|
||||
@@ -67,9 +67,15 @@ public class idolUpgrade : MonoBehaviour
|
||||
private void OnEnable()
|
||||
{
|
||||
BindButtons();
|
||||
BindLedgerEvents();
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
UnbindLedgerEvents();
|
||||
}
|
||||
|
||||
public void SetHero(AllyHero_SO hero)
|
||||
{
|
||||
bool heroChanged = currentHero == null || hero == null || currentHero.ally_heroID != hero.ally_heroID;
|
||||
@@ -83,6 +89,90 @@ public class idolUpgrade : MonoBehaviour
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
private void BindLedgerEvents()
|
||||
{
|
||||
PlayerEconomyLedger.EnsureInstance().OnCoinsChanged -= HandleExternalResourceChanged;
|
||||
PlayerEconomyLedger.EnsureInstance().OnCoinsChanged += HandleExternalResourceChanged;
|
||||
PlayerEconomyLedger.EnsureInstance().OnMaterialChanged -= HandleExternalResourceChanged;
|
||||
PlayerEconomyLedger.EnsureInstance().OnMaterialChanged += HandleExternalResourceChanged;
|
||||
|
||||
ExpBottleLedger.EnsureInstance().OnBottleCountChanged -= HandleBottleLedgerChanged;
|
||||
ExpBottleLedger.EnsureInstance().OnBottleCountChanged += HandleBottleLedgerChanged;
|
||||
ExpBottleLedger.EnsureInstance().OnLedgerReloaded -= HandleExternalLedgerReloaded;
|
||||
ExpBottleLedger.EnsureInstance().OnLedgerReloaded += HandleExternalLedgerReloaded;
|
||||
|
||||
DushMaterialLedger.EnsureInstance().OnMaterialCountChanged -= HandleMaterialLedgerChanged;
|
||||
DushMaterialLedger.EnsureInstance().OnMaterialCountChanged += HandleMaterialLedgerChanged;
|
||||
|
||||
AllyHeroDeployLedger.EnsureInstance().OnHeroGrowthChanged -= HandleHeroGrowthLedgerChanged;
|
||||
AllyHeroDeployLedger.EnsureInstance().OnHeroGrowthChanged += HandleHeroGrowthLedgerChanged;
|
||||
}
|
||||
|
||||
private void UnbindLedgerEvents()
|
||||
{
|
||||
if (PlayerEconomyLedger.Instance != null)
|
||||
{
|
||||
PlayerEconomyLedger.Instance.OnCoinsChanged -= HandleExternalResourceChanged;
|
||||
PlayerEconomyLedger.Instance.OnMaterialChanged -= HandleExternalResourceChanged;
|
||||
}
|
||||
|
||||
if (ExpBottleLedger.Instance != null)
|
||||
{
|
||||
ExpBottleLedger.Instance.OnBottleCountChanged -= HandleBottleLedgerChanged;
|
||||
ExpBottleLedger.Instance.OnLedgerReloaded -= HandleExternalLedgerReloaded;
|
||||
}
|
||||
|
||||
if (DushMaterialLedger.Instance != null)
|
||||
{
|
||||
DushMaterialLedger.Instance.OnMaterialCountChanged -= HandleMaterialLedgerChanged;
|
||||
}
|
||||
|
||||
if (AllyHeroDeployLedger.Instance != null)
|
||||
{
|
||||
AllyHeroDeployLedger.Instance.OnHeroGrowthChanged -= HandleHeroGrowthLedgerChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleExternalResourceChanged(int _)
|
||||
{
|
||||
RefreshViewIfActive();
|
||||
}
|
||||
|
||||
private void HandleBottleLedgerChanged(ExpBottleKind _, int __)
|
||||
{
|
||||
RefreshViewIfActive();
|
||||
}
|
||||
|
||||
private void HandleExternalLedgerReloaded()
|
||||
{
|
||||
RefreshViewIfActive();
|
||||
}
|
||||
|
||||
private void HandleMaterialLedgerChanged(DushMaterialKind _, int __)
|
||||
{
|
||||
RefreshViewIfActive();
|
||||
}
|
||||
|
||||
private void HandleHeroGrowthLedgerChanged(int heroId)
|
||||
{
|
||||
if (currentHero == null || heroId <= 0 || currentHero.ally_heroID != heroId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RefreshViewIfActive();
|
||||
}
|
||||
|
||||
private void RefreshViewIfActive()
|
||||
{
|
||||
if (!isActiveAndEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
public HeroGrowthTier GetCurrentTier()
|
||||
{
|
||||
return AllyHeroGrowthService.GetUnlockedTier(currentHero);
|
||||
|
||||
Reference in New Issue
Block a user