zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Unity/Assets/HotfixView/Event/UI/UpdateCharacterUIEvent.cs

65 lines
4.2 KiB
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
using ET;
using ET.EventType;
namespace ET
{
public class UpdateCharacterUIEvent : AEvent<UpdateCharacterUI>
{
public override async ETTask Run(UpdateCharacterUI args)
{
var zoneScene = args.zoneScene;
2021-04-08 20:09:59 +08:00
var _attributeDic = CharacterUI.AttributeDic;
if (_attributeDic == null) return;
2021-04-11 19:50:39 +08:00
ClientUnitCharacter unitCharacter = ClientUnitCharacterComponent.Instance.Get(args.Id);
Unit unit = zoneScene.GetComponent<UnitComponent>().Get(args.Id);
2021-04-08 20:09:59 +08:00
if (!unit)
{
TipHelper.OpenUI("找不到玩家");
return;
}
2021-04-11 19:50:39 +08:00
NumericComponent num = unit.GetComponent<NumericComponent>();
2021-04-08 20:09:59 +08:00
_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));
//!更新属性点
2021-04-11 19:50:39 +08:00
FUI_CharacterUI characterUI = FUIComponent.Instance.Get(FUIPackage.Character_CharacterUI)?.As<FUI_CharacterUI>();
2021-04-08 20:09:59 +08:00
if (characterUI)
{
characterUI.m_txtPoint.text = "属性点:" + unitCharacter.CharacterPoint;
}
await ETTask.CompletedTask;
}
}
}