/// #pkgName FGUI包名 /// #panelName UIPanel名字 /// #UIName = $"{#pkgName}{#panelName}" UIKey名字 /// 该脚本由模板创建 /// created by cb 2024 using System.Collections.Generic; using FL.Data; using XGame; using XGame.Database; using XGame.Framework.UI; namespace FL.FGUI { /// /// UI逻辑处理类 /// /// public partial class PartnerSbDetailNoIconNestedCtrl : UIController { protected override void OnEnable(object intent) { AddUIListenres(); } protected override void OnDisable() { RemoveUIListenres(); } #region UI事件 private void AddUIListenres() { } private void RemoveUIListenres() { } #endregion private int _sbId; public void ShowUI(int sbId) { _sbId = sbId; var table = PartnerTableRepo.Get(_sbId); if (table == null) { Log.Error($"圣兵表不存在,id:{_sbId}"); return; } var attr = PartnersData.Instance.GetPartnerAttrByTableId(_sbId); var level = attr?.Level ?? 1; var star = attr?.RisingStarLv ?? 1; VM.AttrLabel.text = $"+{table.Own_attr[1]/100f}%"; // ShowSkillBaseInfo(table.Skill[0]); // ShowAttr(level); // VM.ElementLoader.url = AddressableDefine.SbElementType(((int)table.Element)); VM.TypeLoader.url = AddressableDefine.SbTypeIcon(table.Type); ShowBuff(star); // var pos = PartnersData.Instance.UpSbPosMap.GetValueOrDefault(_sbId, -1); VM.IsUp.selectedIndex = pos < 0 ? 0 : 1; } private void ShowAttr(int level) { var lvTable = partnerLvUpTableRepo.GetPartnerLvUpTable(_sbId, level); if (lvTable == null) { Log.Error($"圣兵等级不存在,id:{_sbId},level:{level}"); return; } var atkVal = lvTable.LvAttr[1]; //var attributeInfo = AttrDescTableRepo.Get(attrType); string descAtk = atkVal > 0 ? TableUtils.ToRealDouble(atkVal).ToString("F1") : "0"; VM.AtkValLabel.text = descAtk; var atkSpeed = lvTable.LvAttr[3]; string descSpeed = atkSpeed > 0 ? TableUtils.ToRealDouble(atkSpeed).ToString("F1") : "0"; VM.SpeedValLabel.text = descSpeed; } /// /// 基础技能描述 /// /// private void ShowSkillBaseInfo(int skillId) { var skillInfo = SkillTableRepo.Get(skillId); if (skillInfo == null) { Log.Error($"技能表不存在,id{skillId}"); return; } VM.DescLabel.text = skillInfo.Desc; } private void ShowBuff(int starLv) { var table = PartnerTableRepo.Get(_sbId); if (table == null) { Log.Error($"圣兵tableId {_sbId} 不存在"); return; } var starSkillIds = table?.Skill; var dataList = new List(); 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); } } }