123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- /// #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.Database;
- using XGame.Framework.UI;
- namespace FL.FGUI
- {
- /// <summary>
- /// UI逻辑处理类
- /// </summary>
- /// <typeparam name=""></typeparam>
- public partial class PartnerSbDetailNestedCtrl : UIController<PartnerSbDetailNestedVM>
- {
- protected override void OnEnable(object intent)
- {
- AddUIListenres();
- }
- protected override void OnDisable()
- {
- RemoveUIListenres();
- }
- #region UI事件
- private void AddUIListenres() { }
- private void RemoveUIListenres() { }
- #endregion
- private int _id;
- public void ShowUI(int id)
- {
- _id = id;
- if (_id == 0)
- {
- VM.IsEmpty.selectedIndex = 1;
- return;
- }
- else
- {
- VM.IsEmpty.selectedIndex = 0;
- }
- var table = PartnerTableRepo.Get(_id);
- if (table == null)
- {
- Log.Error($"圣兵表不存在,id:{_id}");
- return;
- }
- var attr = PartnersData.Instance.GetPartnerAttrByTableId(_id);
- var level = attr?.Level ?? 1;
- var star = attr?.RisingStarLv ?? 1;
- var upLevelTable = partnerStarUpTableRepo.GetPartnerStarTable(_id, star);
- if (upLevelTable == null)
- {
- Log.Error($"圣兵升星表不存在,id:{_id},level:{level}");
- return;
- }
- //
- VM.SpPbar.max = upLevelTable.StarUpCost;
- VM.SpPbar.value = ItemData.Instance.GetItemNum(upLevelTable.PetId);
- //
- var starStep = PartnersService.Instance.GetStarStep(star);
- var starLv = PartnersService.Instance.GetStarLv(star);
- var list = new List<int>();
- for (int i = 0; i < starLv; i++)
- {
- list.Add(starStep);
- }
- VM.StarList.BindDatas(list);
- //
- VM.NameLabel.text = table.Name;
- ShowSkillBaseInfo(table.Skill[0]);
- //
- var lvTable = partnerLvUpTableRepo.GetPartnerLvUpTable(_id, level);
- if (lvTable == null)
- {
- Log.Error($"圣兵等级不存在,id:{_id},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;
- //
- //VM.ItemBase.Ctrl.ShowUI()
- VM.ElementLoader.url = AddressableDefine.SbElementType(((int)table.Element));
- VM.TypeLoader.url = AddressableDefine.SbTypeIcon(table.Type);
- }
- /// <summary>
- /// 基础技能描述
- /// </summary>
- /// <param name="skillId"></param>
- private void ShowSkillBaseInfo(int skillId)
- {
- var skillInfo = SkillTableRepo.Get(skillId);
- if (skillInfo == null)
- {
- Log.Error($"技能表不存在,id{skillId}");
- return;
- }
- VM.DescLabel.text = skillInfo.Desc;
- }
- }
- }
|