PartnerSbUpListItemCtrl.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 PartnerSbUpListItemCtrl : UIController<PartnerSbUpListItemVM>
  17. {
  18. protected override void OnEnable(object intent)
  19. {
  20. AddUIListenres();
  21. }
  22. protected override void OnDisable()
  23. {
  24. RemoveUIListenres();
  25. }
  26. #region UI事件
  27. private void AddUIListenres() {
  28. VM.PanelEvent.Add(OnClickSbItem);
  29. }
  30. private void RemoveUIListenres() {
  31. VM.PanelEvent.Remove(OnClickSbItem);
  32. }
  33. private void OnClickSbItem(EventContext eventContext)
  34. {
  35. EventSingle.Instance.Notify(EventDefine.PartnerMainSelect, _posId);
  36. }
  37. #endregion
  38. #region 属性
  39. private int _posId;
  40. private int _sbId;
  41. #endregion
  42. public void OnRefresh(int index, PartnerSbUpListItemParam param)
  43. {
  44. _posId = param.PosId;
  45. _sbId = PartnersData.Instance.UpSbMap.GetValueOrDefault(_posId, 0);
  46. VM.IsSelect.selectedIndex = param.PosId == param.CurSelectPos ? 0 : 1;
  47. VM.SbItem.Ctrl.ShowUI(_sbId);
  48. }
  49. }
  50. }