PartnerSbUpListItemCtrl.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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;
  10. using XGame.Framework.UI;
  11. namespace FL.FGUI
  12. {
  13. /// <summary>
  14. /// UI逻辑处理类
  15. /// </summary>
  16. /// <typeparam name=""></typeparam>
  17. public partial class PartnerSbUpListItemCtrl : UIController<PartnerSbUpListItemVM>
  18. {
  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.PanelEvent.Add(OnClickSbItem);
  31. VM.SbItem.VM.EpiSetBase.VM.PanelEvent.Add(OnClickMwSetBtn);
  32. }
  33. private void RemoveUIListenres()
  34. {
  35. VM.PanelEvent.Remove(OnClickSbItem);
  36. VM.SbItem.VM.EpiSetBase.VM.PanelEvent.Remove(OnClickMwSetBtn);
  37. }
  38. private void OnClickMwSetBtn(EventContext eventContext)
  39. {
  40. eventContext.StopPropagation();
  41. EventSingle.Instance.Notify(EventDefine.PartnerMainMwSelect, _posId);
  42. }
  43. private void OnClickSbItem()
  44. {
  45. EventSingle.Instance.Notify(EventDefine.PartnerMainSbSelect, _posId);
  46. }
  47. #endregion
  48. #region 属性
  49. private int _posId;
  50. private int _sbId;
  51. private int _mwId;
  52. #endregion
  53. public void OnRefresh(int index, PartnerSbUpListItemParam param)
  54. {
  55. _posId = param.PosId;
  56. _sbId = PartnersData.Instance.UpSbMap.GetValueOrDefault(_posId, 0);
  57. VM.SbItem.Ctrl.ShowUI(_sbId);
  58. VM.SbItem.VM.Type.selectedIndex = param.SelectType;
  59. if (param.CurSelectPos == _posId)
  60. {
  61. VM.SbItem.VM.Select.selectedIndex = 1;
  62. }
  63. else
  64. {
  65. VM.SbItem.VM.Select.selectedIndex = 0;
  66. }
  67. }
  68. }
  69. }