PartnerEpiMainPanelCtrl.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 PartnerEpiMainPanelCtrl : UIController<PartnerEpiMainPanelVM>
  17. {
  18. private bool _initialized = false;
  19. protected override void OnEnable(object intent)
  20. {
  21. AddUIListenres();
  22. InitList();
  23. EpigraphService.Instance.RequestEpiInto();
  24. UpView();
  25. }
  26. protected override void OnDisable()
  27. {
  28. RemoveUIListenres();
  29. }
  30. #region UI事件
  31. private void AddUIListenres()
  32. {
  33. VM.OneUpBtn.onClick.Add(OnClickOneUpBtn);
  34. VM.OneStrongBtn.onClick.Add(OnClickOneStrongBtn);
  35. EventSingle.Instance.AddListener(EventDefine.EpigraphHaveInfoUpdate, OnUpView);
  36. }
  37. private void RemoveUIListenres()
  38. {
  39. VM.OneUpBtn.onClick.Remove(OnClickOneUpBtn);
  40. VM.OneStrongBtn.onClick.Remove(OnClickOneStrongBtn);
  41. EventSingle.Instance.RemoveListener(EventDefine.EpigraphHaveInfoUpdate, OnUpView);
  42. }
  43. private void OnClickOneUpBtn(EventContext context) { }
  44. private void OnClickOneStrongBtn(EventContext context) { }
  45. #endregion
  46. private void InitList()
  47. {
  48. if (_initialized)
  49. return;
  50. VM.UpList.ListType = EGListType.None;
  51. VM.BagList.ListType = EGListType.Virtual;
  52. _initialized = true;
  53. }
  54. private void OnUpView(int eventId, object args)
  55. {
  56. UpView();
  57. }
  58. private void UpView()
  59. {
  60. UpList();
  61. UpPlan();
  62. }
  63. private void UpPlan()
  64. {
  65. //VM.SchemeLabel.text =
  66. }
  67. private void UpList()
  68. {
  69. var list = EpigraphTableRepo.GetAll();
  70. VM.BagList.BindDatas(list);
  71. }
  72. }
  73. }