123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- /// #pkgName FGUI包名
- /// #panelName UIPanel名字
- /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
- /// 该脚本由模板创建
- /// created by cb 2024
- using System.Collections.Generic;
- 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 PartnerMwDetailNoIconNestedCtrl
- : UIController<PartnerMwDetailNoIconNestedVM>
- {
- protected override void OnEnable(object intent)
- {
- AddUIListenres();
- }
- protected override void OnDisable()
- {
- RemoveUIListenres();
- }
- #region UI事件
- private void AddUIListenres() { }
- private void RemoveUIListenres() { }
- #endregion
- private int _mwId;
- public void ShowUI(int mwId)
- {
- _mwId = mwId;
- var table = EpigraphTableRepo.Get(_mwId);
- XGame.Framework.Assert.IsNotNull(table, $"铭文表不存在,id:{_mwId}");
- var attr = EpigraphData.Instance.GetEpigraphAttrByTableId(_mwId);
- var star = attr?.StarLv ?? 1;
- VM.AttrLabel.text = $"+{table.Own_attr[1] / 100f}%";
- //
- ShowSkillBaseInfo(table.Skill[0]);
- //
- if (table.Element > 0)
- {
- VM.ElementLoader.visible = true;
- VM.ElementLoader.url = AddressableDefine.SbElementType(((int)table.Element));
- }
- else
- {
- VM.ElementLoader.visible = false;
- }
- ShowBuff(star);
- //
- var pos = PartnersData.Instance.UpSbPosMap.GetValueOrDefault(_mwId, -1);
- VM.IsUp.selectedIndex = pos < 0 ? 0 : 1;
- }
- /// <summary>
- /// 基础技能描述
- /// </summary>
- /// <param name="skillId"></param>
- private void ShowSkillBaseInfo(int skillId)
- {
- var skillInfo = SkillTableRepo.Get(skillId);
- XGame.Framework.Assert.IsNotNull(skillInfo, $"技能表不存在,id{skillId}");
- VM.DescLabel.text = skillInfo.Desc;
- }
- private void ShowBuff(int starLv)
- {
- var table = EpigraphTableRepo.Get(_mwId);
- XGame.Framework.Assert.IsNotNull(table, $"铭文表tableId {_mwId} 不存在");
- var starSkillIds = table?.Skill;
- var dataList = new List<PartnerSbDetailSkillListItemParam>();
- if (starSkillIds?.Length > 0)
- {
- for (int i = 2; i < starSkillIds.Length; i += 2)
- {
- var data = new PartnerSbDetailSkillListItemParam()
- {
- SkillId = starSkillIds[i],
- NeedStarLevel = starSkillIds[i + 1],
- CurStarLevel = starLv,
- };
- dataList.Add(data);
- }
- }
- VM.SkillList.BindDatas(dataList);
- }
- }
- }
|