PartnerSbUpPanelCtrl.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 PartnerSbUpPanelCtrl : UIController<PartnerSbUpPanelVM>
  17. {
  18. protected override void OnEnable(object intent)
  19. {
  20. AddUIListenres();
  21. _pos = (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, OnSelectUpSb);
  32. }
  33. private void RemoveUIListenres()
  34. {
  35. Context.RemoveListener(EventDefine.PartnerSbMwUpSelect, OnSelectUpSb);
  36. }
  37. private void OnSelectUpSb(int eventId, object args)
  38. {
  39. var id = (int)args;
  40. PartnersService.Instance.RequestPartnerUpNew(_pos, id);
  41. Context.ClosePanel();
  42. }
  43. #endregion
  44. private bool _init = false;
  45. private int _pos;
  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 = PartnersData.Instance.PartnerList;
  56. var sbId = PartnersData.Instance.UpSbMap.GetValueOrDefault(_pos, 0);
  57. var dataList = new List<int>();
  58. foreach (var item in list)
  59. {
  60. if (item.Status > 0)
  61. continue;
  62. dataList.Add(item.TableId);
  63. }
  64. VM.List.BindDatas(dataList);
  65. }
  66. }
  67. }