1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- /// #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
- {
- /// <summary>
- /// UI逻辑处理类
- /// </summary>
- /// <typeparam name=""></typeparam>
- public partial class PartnerEpiPlanLineItemCtrl : UIController<PartnerEpiPlanLineItemVM>
- {
- 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<PartnerPlanParam>();
- for (int i = 0; i < PartnersData.GoneUpLimit; i++)
- {
- var param = new PartnerPlanParam()
- {
- planId = plan.Id,
- slotId = i,
- };
- dataList.Add(param);
- }
- VM.PartnerList.BindDatas(dataList);
- }
- }
- }
|