/// #pkgName FGUI包名 /// #panelName UIPanel名字 /// #UIName = $"{#pkgName}{#panelName}" UIKey名字 /// 该脚本由模板创建 /// created by cb 2024 using FairyGUI; using FL.Data; using XGame.Framework.UI; namespace FL.FGUI { /// /// UI逻辑处理类 /// /// public partial class PartnerEpiPlanListItemCtrl : UIController { protected override void OnEnable(object intent) { AddUIListenres(); } protected override void OnDisable() { RemoveUIListenres(); } #region UI事件 private void AddUIListenres() { VM.PartnerItem.VM.PartnerBase.VM.PanelEvent.Add(OnClickPartner); VM.PartnerItem.VM.EpiSetBase.VM.PanelEvent.Add(OnClickEpiSet); } private void RemoveUIListenres() { VM.PartnerItem.VM.PartnerBase.VM.PanelEvent.Remove(OnClickPartner); VM.PartnerItem.VM.EpiSetBase.VM.PanelEvent.Remove(OnClickEpiSet); } private void OnClickEpiSet(EventContext eventContext) { if (_sbId == 0) { Context.ShowTips(StringDefine.PartnerCurSlotNoSbTips); return; } Context.UI.OpenAsync( UIKeys.PartnerEpiChangePanel, new PartnerEpiChangePanelCtrlParam() { PlanId = _planId, SlotId = _slotId, SbId = _sbId, } ); } private void OnClickPartner(EventContext eventContext) { Context.UI.OpenAsync( UIKeys.PartnerReplacePartnerPanel, new PartnerReplacePartnerPanelCtrlParam() { PlanId = _planId, SlotId = _slotId } ); } #endregion #region 属性 private int _planId; private int _slotId; private int _sbId; #endregion public void OnRefresh(int index, PartnerPlanParam param) { _planId = param.planId; _slotId = param.slotId; var slot = PartnersData.Instance.GetPlanSlot(_planId, _slotId); _sbId = slot?.SbId ?? 0; VM.IsEmpty.selectedIndex = _sbId > 0 ? 0 : 1; VM.PartnerItem.Ctrl.ShowUI(_sbId, _planId, _slotId); } } }