PartnerLineupPlanListItemCtrl.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 System.Collections.Generic;
  9. using XGame.Framework.UI;
  10. namespace FL.FGUI
  11. {
  12. /// <summary>
  13. /// UI逻辑处理类
  14. /// </summary>
  15. /// <typeparam name=""></typeparam>
  16. public partial class PartnerLineupPlanListItemCtrl : UIController<PartnerLineupPlanListItemVM>
  17. {
  18. private int _index; // 方案索引
  19. protected override void OnEnable(object intent)
  20. {
  21. AddUIListenres();
  22. }
  23. protected override void OnDisable()
  24. {
  25. RemoveUIListenres();
  26. }
  27. #region UI事件
  28. private void AddUIListenres()
  29. {
  30. VM.ChangeLineupPlanBtn.onClick.Add(OnClickChangeLineupPlanBtn);
  31. }
  32. private void RemoveUIListenres()
  33. {
  34. VM.ChangeLineupPlanBtn.onClick.Remove(OnClickChangeLineupPlanBtn);
  35. }
  36. private void OnClickChangeLineupPlanBtn(EventContext context)
  37. {
  38. PartnersService.Instance.RequestToChangeLineupPlan(_index);
  39. }
  40. #endregion
  41. public void OnRefresh(int index, List<long> partnerIdList)
  42. {
  43. _index = index;
  44. VM.NameLabel.text = PartnersData.Instance.LineupPlanNameList[index];
  45. var dataList = new List<PartnerParam>();
  46. foreach (long item in partnerIdList)
  47. {
  48. dataList.Add(new PartnerParam()
  49. {
  50. lineupPlanIndex = index,
  51. partnerId = item
  52. });
  53. }
  54. VM.PartnerList.BindDatas(dataList);
  55. }
  56. }
  57. }