123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- /// #pkgName FGUI包名
- /// #panelName UIPanel名字
- /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
- /// 该脚本由模板创建
- /// created by cb 2024
- using FairyGUI;
- using FL.Data;
- using XGame;
- using XGame.Database;
- using XGame.Framework.UI;
- namespace FL.FGUI
- {
- /// <summary>
- /// UI逻辑处理类
- /// </summary>
- /// <typeparam name=""></typeparam>
- public partial class PartnerEpiBagListItemCtrl : UIController<PartnerEpiBagListItemVM>
- {
- protected override void OnEnable(object intent)
- {
- AddUIListenres();
- }
- protected override void OnDisable()
- {
- RemoveUIListenres();
- }
- #region UI事件
- private void AddUIListenres()
- {
- VM.EpiIcon.VM.PanelEvent.Add(OnClickBagEpigraph);
- }
- private void RemoveUIListenres()
- {
- VM.EpiIcon.VM.PanelEvent.Remove(OnClickBagEpigraph);
- }
- #endregion
- #region 点击事件
- private void OnClickBagEpigraph(EventContext eventContext)
- {
- Context.UI.OpenAsync(
- UIKeys.PartnerEpiDetailInfo,
- new PartnerEpiDetailInfoParam()
- {
- EpigraphId = _id,
- PlanId = PartnersData.Instance.UsePlanId,
- SlotId = -1,
- PartnerId = 0
- }
- );
- }
- #endregion
- #region 属性
- private int _id;
- #endregion
- public void OnRefresh(int index, EpigraphTable table)
- {
- _id = table.Id;
- VM.EpiIcon.Ctrl.SetEpiIcon(_id, true);
- var info = EpigraphData.Instance.GetEpigraphAttrByTableId(_id);
- if (info != null)
- {
- if (info.PartnerId > 0)
- {
- var partnerTable = PartnerTableRepo.Get(info.PartnerId);
- if(partnerTable == null)
- {
- Log.Error($"圣兵表不存在,${info.PartnerId}");
- return;
- }
- VM.IsBind.selectedIndex = 0;
- VM.PzLoader.url = AddressableDefine.EpigraphTypePz(table.Quality);
- VM.IconLoader.url = partnerTable?.Icon2;
- }
- else
- {
- VM.IsBind.selectedIndex = 1;
- }
- }
- else
- {
- VM.IsBind.selectedIndex = 1;
- }
- OnUpdateProgress();
- }
- private void OnUpdateProgress()
- {
- var info = EpigraphData.Instance.GetEpigraphAttrByTableId(_id);
- var curlv = info != null ? info.StarLv : 1;
- var table = epigraphUpTableRepo.GetEpiragphUp(_id, curlv);
- if (table == null)
- {
- Log.Error($"铭文升级表不存在,id:{_id}, lv:{curlv}");
- return;
- }
- VM.ChipPbar.max = table.LevelUpCost;
- VM.ChipPbar.value = ItemData.Instance.GetItemNum(table.PetId);
- }
- }
- }
|