MountTrainingAreaNestedCtrl.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. using XGame.Framework.Utils;
  9. namespace FL.FGUI
  10. {
  11. public struct TrainParam
  12. {
  13. public int level;
  14. public zuoqiBuweiTable trainInfo;
  15. }
  16. /// <summary>
  17. /// UI逻辑处理类
  18. /// </summary>
  19. /// <typeparam name=""></typeparam>
  20. public partial class MountTrainingAreaNestedCtrl : UIController<MountTrainingAreaNestedVM>
  21. {
  22. protected override void OnEnable(object intent)
  23. {
  24. AddUIListenres();
  25. }
  26. protected override void OnDisable()
  27. {
  28. RemoveUIListenres();
  29. }
  30. #region UI事件
  31. private void AddUIListenres()
  32. {
  33. }
  34. private void RemoveUIListenres()
  35. {
  36. }
  37. #endregion
  38. public void ShowUI(TrainParam data)
  39. {
  40. VM.TrainLvLabel.text = data.level.ToString();
  41. if (data.trainInfo != null)
  42. {
  43. var attributeInfo = AttrDescTableRepo.Get(data.trainInfo.LevelOwnAttr[0]);
  44. if (attributeInfo != null)
  45. {
  46. var sb = StringBuilderUtils.Acquire();
  47. sb.Append(attributeInfo.ShowName);
  48. sb.Append("+");
  49. sb.Append(data.trainInfo.LevelOwnAttr[1].ToRealFloatPercentage());
  50. VM.EffectLabel.text = sb.ToString();
  51. StringBuilderUtils.Release(sb);
  52. }
  53. }
  54. }
  55. }
  56. }