12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- /// #pkgName FGUI包名
- /// #panelName UIPanel名字
- /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
- /// 该脚本由模板创建
- /// created by cb 2024
- using System.Collections.Generic;
- using XGame.Database;
- using XGame.Framework.UI;
- namespace FL.FGUI
- {
- public struct AdvancedMountParam
- {
- public int oldStarLv;
- public int curStarLv;
- public int attrType;
- public int oldAttrValue;
- public int curAttrValue;
- }
- /// <summary>
- /// UI逻辑处理类
- /// </summary>
- /// <typeparam name=""></typeparam>
- public partial class MountUpgradeSuccessfulPanelCtrl : UIController<MountUpgradeSuccessfulPanelVM>
- {
- protected override void OnEnable(object intent)
- {
- AddUIListenres();
- ShowUI();
- }
- protected override void OnDisable()
- {
- RemoveUIListenres();
- }
- #region UI事件
- private void AddUIListenres()
- {
- }
- private void RemoveUIListenres()
- {
- }
- #endregion
- private void ShowUI()
- {
- int mountId = MountService.Instance.upgradeMountId;
- int oldStarLv = MountService.Instance.mountStarLv;
- int curStarLv = MountData.Instance.GetAdvancedMountLv(mountId);
- var oldStarInfo = zuoqiStarTableRepo.Get(mountId * 10000 + oldStarLv);
- if (oldStarInfo == null)
- {
- XGame.Log.Error($"坐骑表zuoqiStar中不存在id:{mountId * 10000 + oldStarLv}");
- return;
- }
- int[] oldStarOwnAttr = oldStarInfo.LevelOwnAttr;
- var curStarInfo = zuoqiStarTableRepo.Get(mountId * 10000 + curStarLv);
- if (curStarInfo == null)
- {
- XGame.Log.Error($"坐骑表zuoqiStar中不存在id:{mountId * 10000 + curStarLv}");
- return;
- }
- ShowAttrUI(oldStarLv, curStarLv, oldStarOwnAttr, curStarInfo.LevelOwnAttr);
- }
- private void ShowAttrUI(int oldStarLv, int curStarLv, int[] oldStarOwnAttr, int[] curStarOwnAttr)
- {
- var attrDataList = new List<AdvancedMountParam>();
- for (int i = 0; i < curStarOwnAttr.Length; i+=2)
- {
- attrDataList.Add(new AdvancedMountParam()
- {
- oldStarLv = oldStarLv,
- curStarLv = curStarLv,
- attrType = curStarOwnAttr[i],
- oldAttrValue = oldStarOwnAttr[i+1],
- curAttrValue = curStarOwnAttr[i+1]
- });
- }
- VM.AttrList.BindDatas(attrDataList);
- }
- }
- }
|