PartnerEpiChangeListItemCtrl.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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.Database;
  9. using XGame.Framework.UI;
  10. namespace FL.FGUI
  11. {
  12. /// <summary>
  13. /// UI逻辑处理类
  14. /// </summary>
  15. /// <typeparam name=""></typeparam>
  16. public partial class PartnerEpiChangeListItemCtrl : UIController<PartnerEpiChangeListItemVM>
  17. {
  18. protected override void OnEnable(object intent)
  19. {
  20. AddUIListenres();
  21. }
  22. protected override void OnDisable()
  23. {
  24. RemoveUIListenres();
  25. }
  26. #region UI事件
  27. private void AddUIListenres()
  28. {
  29. VM.Panel.onClick.Add(OnClick);
  30. }
  31. private void RemoveUIListenres()
  32. {
  33. VM.Panel.onClick.Remove(OnClick);
  34. }
  35. private void OnClick(EventContext eventContext)
  36. {
  37. EventSingle.Instance.Notify(EventDefine.EpigraphChangeListClick, attr.id);
  38. }
  39. #endregion
  40. #region 属性
  41. private int sbId;
  42. private EpigraphAttributes attr;
  43. #endregion
  44. #region 页面
  45. public void OnRefresh(int index, EpiChangeListData data)
  46. {
  47. sbId = data.sbId;
  48. attr = data.attrs;
  49. UpEpiInfo();
  50. }
  51. private void UpEpiInfo()
  52. {
  53. var table = EpigraphTableRepo.Get(sbId);
  54. if (table == null)
  55. return;
  56. VM.EpiLabel.Ctrl.SetEpiIcon(sbId, true);
  57. VM.NameLabel.text = table.Name;
  58. var info = EpigraphData.Instance.GetEpigraphInfo(sbId);
  59. VM.IsUp.selectedIndex = info?.partnerId > 0 ? 1 : 0;
  60. }
  61. #endregion
  62. }
  63. }