装备系统完结,修复并加入很多
This commit is contained in:
@@ -59,7 +59,7 @@ public class UI_Idols : MonoBehaviour
|
||||
public idolDocument ido;
|
||||
public idolSkillsHub ish;
|
||||
public idolSkins isk;
|
||||
public idolWeapon iw;
|
||||
public idolEquipments ieqpmt;
|
||||
public idolUpgrade iu;
|
||||
|
||||
[Header("left toggles")]
|
||||
@@ -87,12 +87,14 @@ public class UI_Idols : MonoBehaviour
|
||||
|
||||
private void Start()
|
||||
{
|
||||
BindQuitButton();
|
||||
InitializeSectionToggles();
|
||||
RebuildCards();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
BindQuitButton();
|
||||
btmandtopController.GlobalOverlayPanelVisibilityChanged += HandleOverlayPanelsVisibilityChanged;
|
||||
AllyHeroDeployLedger.EnsureInstance().OnHeroGrowthChanged += HandleHeroGrowthChanged;
|
||||
InitializeSectionToggles();
|
||||
@@ -102,6 +104,7 @@ public class UI_Idols : MonoBehaviour
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
UnbindQuitButton();
|
||||
btmandtopController.GlobalOverlayPanelVisibilityChanged -= HandleOverlayPanelsVisibilityChanged;
|
||||
if (AllyHeroDeployLedger.Instance != null)
|
||||
{
|
||||
@@ -115,6 +118,32 @@ public class UI_Idols : MonoBehaviour
|
||||
UnbindSectionToggles();
|
||||
}
|
||||
|
||||
private void BindQuitButton()
|
||||
{
|
||||
if (quitButton == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
quitButton.onClick.RemoveListener(HandleQuitClicked);
|
||||
quitButton.onClick.AddListener(HandleQuitClicked);
|
||||
}
|
||||
|
||||
private void UnbindQuitButton()
|
||||
{
|
||||
if (quitButton == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
quitButton.onClick.RemoveListener(HandleQuitClicked);
|
||||
}
|
||||
|
||||
private void HandleQuitClicked()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void InitializeSectionToggles()
|
||||
{
|
||||
BindSectionToggles();
|
||||
@@ -401,6 +430,11 @@ public class UI_Idols : MonoBehaviour
|
||||
ish.SetHero(hero);
|
||||
}
|
||||
|
||||
if (ieqpmt != null)
|
||||
{
|
||||
ieqpmt.SetHero(hero);
|
||||
}
|
||||
|
||||
if (rightPanel != null)
|
||||
{
|
||||
rightPanel.SetActive(hero != null);
|
||||
@@ -444,7 +478,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.GetEffectiveLevelForCurrentEXP());
|
||||
ApplyLevelDetails(hero.GetEffectiveLevelInfoWithEquipment(hero.GetEffectiveLevelForCurrentEXP()));
|
||||
ApplyBehaviourRadar(hero);
|
||||
|
||||
PopulateSpecialSkills(hero);
|
||||
@@ -834,12 +868,15 @@ public class UI_Idols : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
SetText(il.hp, levelInfo.maxHP.ToString());
|
||||
SetText(il.attack, levelInfo.attack.ToString());
|
||||
SetText(il.mana, levelInfo.maxMana.ToString());
|
||||
SetText(il.damageResistant, FormatPercent(levelInfo.damageResistance));
|
||||
SetText(il.scoreEfficency, FormatPercent(levelInfo.scoreEfficiency));
|
||||
SetText(il.slotAmount, levelInfo.skill_slot_limited.ToString());
|
||||
AllyHero_SO.AllyLevelInfo baseLevelInfo = currentSelectedHero != null ? currentSelectedHero.GetEffectiveLevelForCurrentEXP() : 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));
|
||||
SetText(il.damageResistant, FormatGrowthPercent(baseLevelInfo != null ? baseLevelInfo.damageResistance : levelInfo.damageResistance, levelInfo.damageResistance));
|
||||
SetText(il.scoreEfficency, FormatGrowthPercent(baseLevelInfo != null ? baseLevelInfo.scoreEfficiency : levelInfo.scoreEfficiency, levelInfo.scoreEfficiency));
|
||||
int baseSlotAmount = baseLevelInfo != null ? baseLevelInfo.skill_slot_limited : levelInfo.skill_slot_limited;
|
||||
int effectiveSlotAmount = currentSelectedHero != null ? currentSelectedHero.GetEffectiveSkillSlotLimit() : levelInfo.skill_slot_limited;
|
||||
SetText(il.slotAmount, FormatGrowthInt(baseSlotAmount, effectiveSlotAmount));
|
||||
SetText(il.miss_mr, levelInfo.manaGainOnMiss.ToString());
|
||||
SetText(il.good_mr, levelInfo.manaGainGood.ToString());
|
||||
SetText(il.great_mr, levelInfo.manaGainGreat.ToString());
|
||||
@@ -850,6 +887,11 @@ public class UI_Idols : MonoBehaviour
|
||||
SetText(il.miss_hl, FormatNumber(levelInfo.missHpLossBase));
|
||||
}
|
||||
|
||||
public void RefreshCurrentHeroDetails()
|
||||
{
|
||||
ApplyHeroDetails(currentSelectedHero, false);
|
||||
}
|
||||
|
||||
private void ApplyBehaviourRadar(AllyHero_SO hero)
|
||||
{
|
||||
if (ido == null || ido.idol_rader == null)
|
||||
@@ -940,6 +982,33 @@ public class UI_Idols : MonoBehaviour
|
||||
return Mathf.RoundToInt(value * 100f) + "%";
|
||||
}
|
||||
|
||||
private static string FormatGrowthInt(int baseValue, int effectiveValue)
|
||||
{
|
||||
int growth = effectiveValue - baseValue;
|
||||
if (growth == 0)
|
||||
{
|
||||
return baseValue.ToString();
|
||||
}
|
||||
|
||||
string sign = growth > 0 ? "+" : "-";
|
||||
string color = growth > 0 ? "#7CFF6B" : "#FF5A5A";
|
||||
return $"{baseValue} <color={color}>{sign} {Mathf.Abs(growth)}</color>";
|
||||
}
|
||||
|
||||
private static string FormatGrowthPercent(float baseValue, float effectiveValue)
|
||||
{
|
||||
float growth = effectiveValue - baseValue;
|
||||
string baseText = FormatPercent(baseValue);
|
||||
if (Mathf.Approximately(growth, 0f))
|
||||
{
|
||||
return baseText;
|
||||
}
|
||||
|
||||
string sign = growth > 0f ? "+" : "-";
|
||||
string color = growth > 0f ? "#7CFF6B" : "#FF5A5A";
|
||||
return $"{baseText} <color={color}>{sign} {FormatPercent(Mathf.Abs(growth))}</color>";
|
||||
}
|
||||
|
||||
private static string FormatNumber(float value)
|
||||
{
|
||||
if (Mathf.Approximately(value, Mathf.Round(value)))
|
||||
|
||||
Reference in New Issue
Block a user