/// #pkgName FGUI包名 /// #panelName UIPanel名字 /// #UIName = $"{#pkgName}{#panelName}" UIKey名字 /// 该脚本由模板创建 /// created by cb 2024 using FairyGUI; using FL.Data; using System.Collections.Generic; using XGame.Framework.UI; namespace FL.FGUI { /// /// UI逻辑处理类 /// /// public partial class PartnerEpiPlanLineItemCtrl : UIController { private int _planId; protected override void OnEnable(object intent) { AddUIListenres(); } protected override void OnDisable() { RemoveUIListenres(); } #region UI事件 private void AddUIListenres() { VM.ChangeLineupPlanBtn.onClick.Add(OnClickChangeLineupPlanBtn); VM.EditBtn.onClick.Add(OnClickEdit); } private void RemoveUIListenres() { VM.ChangeLineupPlanBtn.onClick.Remove(OnClickChangeLineupPlanBtn); VM.EditBtn.onClick.Remove(OnClickEdit); } private void OnClickEdit(EventContext context) { Context.UI.OpenAsync(UIKeys.PartnerPlanRenamePanel, _planId); } private void OnClickChangeLineupPlanBtn(EventContext context) { if (_planId == PartnersData.Instance.CurUsePlan.Id) { Context.ShowTips(StringDefine.PartnerCurPlanTips); return; } PartnersService.Instance.RequestChangePlan(_planId); } #endregion public void OnRefresh(int index, PartnerPlan plan) { VM.ShowLine.selectedIndex = index > 0 ? 0 : 1; VM.CurPlan.selectedIndex = plan.Id == PartnersData.Instance.UsePlanId ? 1 : 0; _planId = plan.Id; VM.NameLabel.text = plan.Name.Length > 0 ? plan.Name : string.Format(StringDefine.partnerInitPlanName, plan.Id); var dataList = new List(); for (int i = 0; i < PartnersData.GoneUpLimit; i++) { var param = new PartnerPlanParam() { planId = plan.Id, slotId = i, }; dataList.Add(param); } VM.PartnerList.BindDatas(dataList); } } }