1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- /// #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 PartnerMwBagListItemCtrl : UIController<PartnerMwBagListItemVM>
- {
- protected override void OnEnable(object intent)
- {
- AddUIListenres();
- }
- protected override void OnDisable()
- {
- RemoveUIListenres();
- }
- #region UI事件
- private void AddUIListenres()
- {
- VM.PanelEvent.Add(OnClickBagItem);
- }
- private void RemoveUIListenres()
- {
- VM.PanelEvent.Remove(OnClickBagItem);
- }
- private void OnClickBagItem()
- {
- Context.UI.OpenAsync(UIKeys.PartnerMwStrengthPanel, _id);
- }
- #endregion
- private int _id;
- public void OnRefresh(int index, int mwID)
- {
- _id = mwID;
- var table = EpigraphTableRepo.Get(mwID);
- XGame.Framework.Assert.IsNotNull(table, $"铭文表不存在,id:{_id}");
- //VM.NameLabel.text = table.Name;
- VM.EpiLabel.Ctrl.SetEpiIcon(_id);
- if (EpigraphData.Instance.TryGetEpigraphAttrByTableId(_id, out var data))
- {
- VM.Have.selectedIndex = 0;
- if (data.PartnerId > 0)
- {
- VM.IsSet.selectedIndex = 0;
- VM.PzLoader.url = AddressableDefine.EpigraphTypePz(table.Quality);
- var sbTable = PartnerTableRepo.Get(data.PartnerId);
- VM.SbIconLoader.url = sbTable.Icon2;
- }
- else
- {
- VM.IsSet.selectedIndex = 1;
- }
- }
- else
- {
- VM.Have.selectedIndex = 1;
- }
- }
- }
- }
|