PartnerMwUpPanelCtrl.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /// #pkgName FGUI包名
  2. /// #panelName UIPanel名字
  3. /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
  4. /// 该脚本由模板创建
  5. /// created by cb 2024
  6. using System.Collections.Generic;
  7. using FairyGUI;
  8. using FL.Data;
  9. using XGame.Framework.UI;
  10. namespace FL.FGUI
  11. {
  12. /// <summary>
  13. /// UI逻辑处理类
  14. /// </summary>
  15. /// <typeparam name=""></typeparam>
  16. public partial class PartnerMwUpPanelCtrl : UIController<PartnerMwUpPanelVM>
  17. {
  18. protected override void OnEnable(object intent)
  19. {
  20. AddUIListenres();
  21. _sbId = (int)intent;
  22. ShowUI();
  23. }
  24. protected override void OnDisable()
  25. {
  26. RemoveUIListenres();
  27. }
  28. #region UI事件
  29. private void AddUIListenres()
  30. {
  31. Context.AddListener(EventDefine.PartnerSbMwUpSelect, OnSelectUpMw);
  32. }
  33. private void RemoveUIListenres()
  34. {
  35. Context.RemoveListener(EventDefine.PartnerSbMwUpSelect, OnSelectUpMw);
  36. }
  37. private void OnSelectUpMw(int eventId, object args)
  38. {
  39. var id = (int)args;
  40. EpigraphService.Instance.RequestEpiInset(_sbId, id);
  41. Context.ClosePanel();
  42. }
  43. #endregion
  44. private bool _init = false;
  45. private int _sbId;
  46. public void Init()
  47. {
  48. if (_init)
  49. return;
  50. _init = true;
  51. VM.List.ListType = EGListType.Virtual;
  52. }
  53. public void ShowUI()
  54. {
  55. var list = EpigraphData.Instance.EpiList;
  56. var dataList = new List<int>();
  57. foreach (var item in list)
  58. {
  59. if (item.PartnerId > 0)
  60. continue;
  61. dataList.Add(item.TableId);
  62. }
  63. VM.List.BindDatas(dataList);
  64. }
  65. }
  66. }