1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- /// #pkgName FGUI包名
- /// #panelName UIPanel名字
- /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
- /// 该脚本由模板创建
- /// created by cb 2024
- using FairyGUI;
- using FL.Data;
- using XGame.Framework.UI;
- namespace FL.FGUI
- {
- /// <summary>
- /// UI逻辑处理类
- /// </summary>
- /// <typeparam name=""></typeparam>
- public partial class PartnerEpiPlanListItemCtrl : UIController<PartnerEpiPlanListItemVM>
- {
- 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);
- }
- }
- }
|