/// #pkgName FGUI包名 /// #panelName UIPanel名字 /// #UIName = $"{#pkgName}{#panelName}" UIKey名字 /// 该脚本由模板创建 /// created by cb 2024 using XGame.Database; using XGame.Framework.UI; namespace FL.FGUI { public class AttributeParam { public EAttributeType attributeType; public long attributeValue; } /// /// UI逻辑处理类 /// /// public partial class PlayerAttributeItemCtrl : UIController { protected override void OnEnable(object intent) { AddUIListenres(); } protected override void OnDisable() { RemoveUIListenres(); } #region UI事件 private void AddUIListenres() { } private void RemoveUIListenres() { } #endregion public void OnRefresh(int index, AttributeParam attrParam) { var attributeInfo = AttrDescTableRepo.Get((int)attrParam.attributeType); if (attributeInfo != null) { //生命属性 [color=#33CCFF]123456789[/color] string format = attrParam.attributeValue > 0 ? "F3" : "F0"; string desc = attributeInfo.Num_type == 1 ? TableUtils.ToRealDouble(attrParam.attributeValue).ToString(format) + "%" : (attrParam.attributeType == EAttributeType.AtkSpeed ? TableUtils.ToRealDouble(attrParam.attributeValue).ToString("F1") : attrParam.attributeValue.ToString()); VM.AttributeLabel.text = $"{attributeInfo.ShowName} [color=#6699CC]{desc}[/color]"; } } } }