PartnerEpiPlanNestedCtrl.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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.Framework.UI;
  9. namespace FL.FGUI
  10. {
  11. /// <summary>
  12. /// UI逻辑处理类
  13. /// </summary>
  14. /// <typeparam name=""></typeparam>
  15. public partial class PartnerEpiPlanNestedCtrl : UIController<PartnerEpiPlanNestedVM>
  16. {
  17. protected override void OnEnable(object intent)
  18. {
  19. AddUIListenres();
  20. }
  21. protected override void OnDisable()
  22. {
  23. RemoveUIListenres();
  24. }
  25. #region UI事件
  26. private void AddUIListenres()
  27. {
  28. EventSingle.Instance.AddListener(EventDefine.PartnerUpdatePlan, OnInfoUpdate);
  29. EventSingle.Instance.AddListener(EventDefine.PartnerUp, OnInfoUpdate);
  30. EventSingle.Instance.AddListener(EventDefine.PartnerDown, OnInfoUpdate);
  31. EventSingle.Instance.AddListener(EventDefine.PartnerPlanChange, OnInfoUpdate);
  32. EventSingle.Instance.AddListener(EventDefine.PartnerBinding, OnInfoUpdate);
  33. }
  34. private void RemoveUIListenres()
  35. {
  36. EventSingle.Instance.RemoveListener(EventDefine.PartnerUpdatePlan, OnInfoUpdate);
  37. EventSingle.Instance.RemoveListener(EventDefine.PartnerUp, OnInfoUpdate);
  38. EventSingle.Instance.RemoveListener(EventDefine.PartnerDown, OnInfoUpdate);
  39. EventSingle.Instance.RemoveListener(EventDefine.PartnerPlanChange, OnInfoUpdate);
  40. EventSingle.Instance.RemoveListener(EventDefine.PartnerBinding, OnInfoUpdate);
  41. }
  42. #endregion
  43. private void OnInfoUpdate(int eventId, object args)
  44. {
  45. ShowUI();
  46. }
  47. public void ShowUI()
  48. {
  49. VM.PlanList.BindDatas(PartnersData.Instance.PlanList);
  50. }
  51. }
  52. }