添加 ShopForm 下的 StatForm,展示玩家属性

This commit is contained in:
2026-09-25 00:03:39 +08:00
parent c61eb7fb68
commit 051c075183
29 changed files with 6574 additions and 51 deletions
@@ -0,0 +1,38 @@
using SepCore.Definition;
namespace SepCore.UI
{
public partial class StatForm
{
public void OnInit(StatContext context)
{
RefreshUI(context);
}
public void RefreshUI(StatContext context)
{
if (context == null)
{
UnityGameFramework.Runtime.Log.Error("StatForm.RefreshUI: context is null.");
return;
}
View.maxHpValue.text = context.GetFormattedValue(StatType.MaxHp);
View.hpRegenValue.text = context.GetFormattedValue(StatType.HpRegen);
View.lifeStealValue.text = context.GetFormattedValue(StatType.LifeSteal);
View.damagePercentValue.text = context.GetFormattedValue(StatType.DamagePercent);
View.meleeDamageValue.text = context.GetFormattedValue(StatType.MeleeDamage);
View.rangedDamageValue.text = context.GetFormattedValue(StatType.RangedDamage);
View.elementalDamageValue.text = context.GetFormattedValue(StatType.ElementalDamage);
View.attackSpeedValue.text = context.GetFormattedValue(StatType.AttackSpeed);
View.critChanceValue.text = context.GetFormattedValue(StatType.CritChance);
View.engineeringValue.text = context.GetFormattedValue(StatType.Engineering);
View.rangeValue.text = context.GetFormattedValue(StatType.Range);
View.armorValue.text = context.GetFormattedValue(StatType.Armor);
View.dodgeValue.text = context.GetFormattedValue(StatType.Dodge);
View.moveSpeedValue.text = context.GetFormattedValue(StatType.MoveSpeed);
View.harvestingValue.text = context.GetFormattedValue(StatType.Harvesting);
View.luckValue.text = context.GetFormattedValue(StatType.Luck);
}
}
}