MountUpgradeAttrListItemCtrl.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /// #pkgName FGUI包名
  2. /// #panelName UIPanel名字
  3. /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
  4. /// 该脚本由模板创建
  5. /// created by cb 2024
  6. using XGame.Database;
  7. using XGame.Framework.UI;
  8. namespace FL.FGUI
  9. {
  10. /// <summary>
  11. /// UI逻辑处理类
  12. /// </summary>
  13. /// <typeparam name=""></typeparam>
  14. public partial class MountUpgradeAttrListItemCtrl : UIController<MountUpgradeAttrListItemVM>
  15. {
  16. protected override void OnEnable(object intent)
  17. {
  18. AddUIListenres();
  19. }
  20. protected override void OnDisable()
  21. {
  22. RemoveUIListenres();
  23. }
  24. #region UI事件
  25. private void AddUIListenres()
  26. {
  27. }
  28. private void RemoveUIListenres()
  29. {
  30. }
  31. #endregion
  32. public void OnRefresh(int index, AdvancedMountParam data)
  33. {
  34. VM.LvLabel.text = string.Format(StringDefine.commonLevel, data.oldStarLv);
  35. VM.NextLvLabel.text = string.Format(StringDefine.commonLevel, data.curStarLv);
  36. var attributeInfo = AttrDescTableRepo.Get(data.attrType);
  37. if (attributeInfo != null)
  38. {
  39. string oldValDesc = data.oldAttrValue.ToRealFloatPercentage();
  40. VM.AttrDescLabel.text = $"{attributeInfo.ShowName}+{oldValDesc}";
  41. string curValDesc = data.curAttrValue.ToRealFloatPercentage();
  42. VM.NextAttrDescLabel.text = $"{attributeInfo.ShowName}+{curValDesc}";
  43. }
  44. else
  45. XGame.Log.Error($"属性表中不存在类型:{data.attrType}");
  46. }
  47. }
  48. }