using ET; using ET.EventType; namespace ET { public class UpdateCharacterUIEvent : AEvent { public override async ETTask Run(UpdateCharacterUI args) { var _attributeDic = CharacterUI.AttributeDic; if (_attributeDic == null) return; ClientUnitCharacter unitCharacter = ClientUnitCharacterComponent.Instance.Get(args.Id); Unit unit = UnitComponent.Instance.Get(args.Id); if (!unit) { TipHelper.OpenUI("找不到玩家"); return; } NumericComponent num = unit.GetComponent(); _attributeDic["昵称"].text = unitCharacter.NickName; _attributeDic["性别"].text = unitCharacter.Sex; _attributeDic["阵营"].text = unitCharacter.Camp; _attributeDic["荣誉值"].text = num.Get(NumericType.Honor).FloatToIntString(); _attributeDic["职业"].text = unitCharacter.Job; _attributeDic["家族"].text = unitCharacter.Family; _attributeDic["等级"].text = CharacterHelper.GetLevelString(unit); _attributeDic["经验"].text = MathHelper.FloatToIntString(num.Get(NumericType.Exp)); _attributeDic["力量"].text = MathHelper.FloatToIntString(num.Get(NumericType.Str)); _attributeDic["智慧"].text = MathHelper.FloatToIntString(num.Get(NumericType.Wim)); _attributeDic["体质"].text = MathHelper.FloatToIntString(num.Get(NumericType.Phy)); _attributeDic["耐力"].text = MathHelper.FloatToIntString(num.Get(NumericType.Sta)); _attributeDic["敏捷"].text = MathHelper.FloatToIntString(num.Get(NumericType.Quk)); _attributeDic["精神"].text = MathHelper.FloatToIntString(num.Get(NumericType.Spi)); _attributeDic["生命"].text = $"{MathHelper.FloatToIntString(num.Get(NumericType.Hp))}/{ MathHelper.FloatToIntString(num.Get(NumericType.MaxHp))}"; _attributeDic["精力"].text = $"{MathHelper.FloatToIntString(num.Get(NumericType.Mp))}/{MathHelper.FloatToIntString(num.Get(NumericType.MaxMp))}"; _attributeDic["物理攻击"].text = MathHelper.FloatToIntString(num.Get(NumericType.PhyAtk)); _attributeDic["精神攻击"].text = MathHelper.FloatToIntString(num.Get(NumericType.SpiAtk)); _attributeDic["物理防御"].text = MathHelper.FloatToIntString(num.Get(NumericType.PhyDef)); _attributeDic["精神防御"].text = MathHelper.FloatToIntString(num.Get(NumericType.SpiDef)); _attributeDic["物理暴击率"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Pcrir)); _attributeDic["精神暴击率"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Mcrir)); _attributeDic["物理暴击值"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Pcri)); _attributeDic["精神暴击值"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Mcri)); _attributeDic["抗物理暴击率"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Rpcrir)); _attributeDic["抗精神暴击率"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Rmcrir)); _attributeDic["抗物理暴击值"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Rpcri)); _attributeDic["抗精神暴击值"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Rmcri)); _attributeDic["物理免伤"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Nphyi)); _attributeDic["精神免伤"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Nmeni)); _attributeDic["辅助值"].text = MathHelper.FloatToPercentString(num.Get(NumericType.Dvo)); //!更新属性点 FUI_CharacterUI characterUI = FUIComponent.Instance.Get(FUIPackage.Character_CharacterUI)?.As(); if (characterUI) { characterUI.m_txtPoint.text = "属性点:" + unitCharacter.CharacterPoint; } await ETTask.CompletedTask; } } }