PartnerSbReplacePanelCtrl.cs 2.1 KB

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