PartnerMwReplacePanelCtrl.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 PartnerMwReplacePanelCtrl : UIController<PartnerMwReplacePanelVM>
  17. {
  18. protected override void OnEnable(object intent)
  19. {
  20. _posId = (int)intent;
  21. _sbId = PartnersData.Instance.UpSbMap.GetValueOrDefault(_posId, 0);
  22. var sbData = PartnersData.Instance.GetPartnerAttrByTableId(_sbId);
  23. _mwId = sbData.EpigraphId;
  24. AddUIListenres();
  25. InitView();
  26. ShowUI();
  27. }
  28. protected override void OnDisable()
  29. {
  30. RemoveUIListenres();
  31. }
  32. #region UI事件
  33. private void AddUIListenres()
  34. {
  35. Context.AddListener(EventDefine.PartnerSbMwUpSelect, OnSelectUpMw);
  36. }
  37. private void RemoveUIListenres()
  38. {
  39. Context.RemoveListener(EventDefine.PartnerSbMwUpSelect, OnSelectUpMw);
  40. }
  41. private void OnSelectUpMw(int eventId, object args)
  42. {
  43. var id = (int)args;
  44. EpigraphService.Instance.RequestEpiInset(_sbId, id);
  45. Context.ClosePanel();
  46. }
  47. #endregion
  48. private int _sbId;
  49. private int _posId;
  50. private int _mwId;
  51. private bool _initView;
  52. private void InitView()
  53. {
  54. if (_initView)
  55. return;
  56. _initView = true;
  57. VM.List.ListType = EGListType.Virtual;
  58. }
  59. private void ShowUI()
  60. {
  61. VM.DetailNested.VM.SpGroup.visible = false;
  62. VM.DetailNested.Ctrl.ShowUI(_mwId);
  63. var list = EpigraphData.Instance.EpiList;
  64. var dataList = new List<int>();
  65. foreach (var item in list)
  66. {
  67. if (item.PartnerId > 0)
  68. continue;
  69. dataList.Add(item.TableId);
  70. }
  71. VM.List.BindDatas(dataList);
  72. }
  73. }
  74. }