PartnerPartnerBookListItemCtrl.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /// #pkgName FGUI包名
  2. /// #panelName UIPanel名字
  3. /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
  4. /// 该脚本由模板创建
  5. /// created by cb 2024
  6. using FairyGUI;
  7. using FL.Data;
  8. using XGame;
  9. using XGame.Database;
  10. using XGame.Framework.UI;
  11. namespace FL.FGUI
  12. {
  13. /// <summary>
  14. /// UI逻辑处理类
  15. /// </summary>
  16. /// <typeparam name=""></typeparam>
  17. public partial class PartnerPartnerBookListItemCtrl : UIController<PartnerPartnerBookListItemVM>
  18. {
  19. protected override void OnEnable(object intent)
  20. {
  21. AddUIListenres();
  22. }
  23. protected override void OnDisable()
  24. {
  25. RemoveUIListenres();
  26. }
  27. #region UI事件
  28. private void AddUIListenres() { }
  29. private void RemoveUIListenres() { }
  30. #endregion
  31. public void OnRefresh(int index, int id)
  32. {
  33. var table = PartnerTableRepo.Get(id);
  34. if (table == null)
  35. {
  36. Log.Error($"圣兵表不存在,id:{id}");
  37. return;
  38. }
  39. VM.SbLoader.icon = table.Icon;
  40. VM.NameLabel.text = table.Name;
  41. if (!PartnersData.Instance.TryGetPartnerAttrByTableId(id, out var attr))
  42. {
  43. VM.StarRating.Disable();
  44. }
  45. else
  46. {
  47. VM.StarRating.Enable(null);
  48. VM.StarRating.Ctrl.ShowStarUI(attr.RisingStarLv);
  49. }
  50. }
  51. }
  52. }