12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- /// #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 PartnerEpiBagListItemCtrl : UIController<PartnerEpiBagListItemVM>
- {
- protected override void OnEnable(object intent)
- {
- AddUIListenres();
- }
- protected override void OnDisable()
- {
- RemoveUIListenres();
- }
- #region UI事件
- private void AddUIListenres()
- {
- VM.Panel.onClick.Add(OnClickBagEpigraph);
- }
- private void RemoveUIListenres()
- {
- VM.Panel.onClick.Remove(OnClickBagEpigraph);
- }
- #endregion
- #region 点击事件
- private void OnClickBagEpigraph(EventContext eventContext)
- {
- Context.UI.OpenAsync(UIKeys.PartnerEpiDetailInfo, id);
- }
- #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.GetEpigraphInfo(id);
- if (info != null)
- {
- if (info.partnerId > 0)
- {
- var partnerTable = PartnerTableRepo.Get(info.partnerId);
- 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.GetEpigraphInfo(id);
- var curlv = info != null ? info.starLv : 0;
- var table = epigraphUpTableRepo.GetEpiragphUp(id, curlv);
- if (table != null)
- {
- VM.ChipPbar.max = table.LevelUpCost;
- VM.ChipPbar.value = 0;
- }
- }
- }
- }
|