using System.Collections.Generic; using System.Linq; using Excel2Json; using Fort23.Core; using Fort23.UTool; using Utility; namespace Fort23.Mono { [UIBinding(prefab = "DivineSenceLevelPreviewPanel")] public partial class DivineSenceLevelPreviewPanel : UIPanel { private void Init() { } protected override void AddEvent() { } protected override void DelEvent() { } public override void AddButtonEvent() { Btn_Close.onClick.AddListener(() => { UIManager.Instance.HideUIUIPanel(this); }); } public override CTask AsyncInit(object[] uiData) { DivineSenseConfig divineSenseConfig = ConfigComponent.Instance.Get(AccountFileInfo.Instance.playerData.divineSenseLevel); DivineSenseConfig[] divineSenseConfigs = ConfigComponent.Instance.GetAll(); List probabilities = UtilTools.CalculateProbabilities(divineSenseConfig.QualityBonusChance.ToList()); for (var i = 0; i < CurrentBls.Count; i++) { CurrentBls[i].text = $"{probabilities[i] * 100:F2}%"; } Text_CurrentLevel.text = $"当前等级预览:{AccountFileInfo.Instance.playerData.divineSenseLevel}"; if (divineSenseConfig.ID >= divineSenseConfigs.Length) { for (var i = 0; i < NextBls.Count; i++) { NextBls[i].text = $"Max"; } Text_NextLevel.text = $"Max"; } else { List probabilities1 = UtilTools.CalculateProbabilities(divineSenseConfigs[AccountFileInfo.Instance.playerData.divineSenseLevel].QualityBonusChance.ToList()); for (var i = 0; i < NextBls.Count; i++) { NextBls[i].text = $"{probabilities1[i] * 100:F2}%"; } Text_NextLevel.text = $"下级预览:{AccountFileInfo.Instance.playerData.divineSenseLevel + 1}"; } return base.AsyncInit(uiData); } public static async CTask OpenPanel() { DivineSenceLevelPreviewPanel divineSenceLevelPreviewPanel = await UIManager.Instance.LoadAndOpenPanel(null, UILayer.Top); } } }