123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- /// #pkgName FGUI包名
- /// #panelName UIPanel名字
- /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
- /// 该脚本由模板创建
- /// created by cb 2024
- using FairyGUI;
- using FL.Data;
- using XGame.Database;
- using XGame.Framework.UI;
- namespace FL.FGUI
- {
- /// <summary>
- /// UI逻辑处理类
- /// </summary>
- /// <typeparam name=""></typeparam>
- public partial class PartnerPartnerListItemCtrl : UIController<PartnerPartnerListItemVM>
- {
- private int _lineupPlanIndex;
- private long _partnerId;
- protected override void OnEnable(object intent)
- {
- AddUIListenres();
- }
- protected override void OnDisable()
- {
- RemoveUIListenres();
- }
- #region UI事件
- private void AddUIListenres()
- {
- VM.ClickBtn.onClick.Add(OnClickBtn);
- }
- private void RemoveUIListenres()
- {
- VM.ClickBtn.onClick.Remove(OnClickBtn);
- }
- private void OnClickBtn(EventContext context)
- {
- EventSingle.Instance.Notify(EventDefine.ShowTips, "显示圣兵替换界面");
- Context.UI.OpenAsync(UIKeys.PartnerReplacePartnerPanel, new PartnerParam()
- {
- partnerId = _partnerId,
- lineupPlanIndex = _lineupPlanIndex
- });
- }
- #endregion
- public void OnRefresh(int index, PartnerParam param)
- {
- _partnerId = param.partnerId;
- _lineupPlanIndex = param.lineupPlanIndex;
- VM.StateCtrl.selectedIndex = _partnerId > 0 ? 1 : 0;
- if (_partnerId > 0)
- {
- PartnerAttributes partnerData = PartnersData.Instance.PartnersMap[_partnerId];
- if (partnerData != null)
- {
- VM.PartnerItem.Ctrl.ShowUI(partnerData.TableId);
- }
- }
- }
- }
- }
|