using System.Collections.Generic; using Excel2Json; using Fort23.Core; using Fort23.UTool; using GameLogic.Player; namespace Fort23.Mono { [UIBinding(prefab = "OpenBoxScorePanel")] public partial class OpenBoxScorePanel : UIPanel { List summonScoreRuleWidgets = new List(); List summonScoreAwardWidgets = new List(); AccountFileInfo.SummonData summonData; private void Init() { isAddStack = true; IsShowAppBar = true; } protected override void AddEvent() { } protected override void DelEvent() { } public override void AddButtonEvent() { Btn_Ok.onClick.AddListener(() => { summonData.isSummonSocre = true; AccountFileInfo.Instance.SavePlayerData(); }); } public async override CTask AsyncInit(object[] uiData) { summonData = PlayerManager.Instance.SummonManager.summonDataMap[2]; List openBoxScoreRules = PlayerManager.Instance.SummonManager.openBoxScoreRuleMap[2]; Btn_Ok.gameObject.SetActive(!summonData.isSummonSocre); StartRoot.gameObject.SetActive(summonData.isSummonSocre); if (summonData.isSummonSocre) { Text_JingDu.text = $"当前进度:{summonData.drawHistory.Count}/{300}"; Text_Score.text = $"目前得分:{summonData.score}"; } foreach (var openBoxScoreRule in openBoxScoreRules) { SummonScoreRuleWidget summonScoreRuleWidget = await UIManager.Instance.CreateGComponent(null, Content1); summonScoreRuleWidget.CustomInit(openBoxScoreRule); summonScoreRuleWidgets.Add(summonScoreRuleWidget); } OpenBoxProgressReward[] openBoxProgressRewards = ConfigComponent.Instance.GetAll(); foreach (var openBoxProgressReward in openBoxProgressRewards) { SummonScoreAwardWidget summonScoreAwardWidget = await UIManager.Instance.CreateGComponent(null, Content2); summonScoreAwardWidget.CustomInit(openBoxProgressReward); summonScoreAwardWidgets.Add(summonScoreAwardWidget); } return await base.AsyncInit(uiData); } public async static CTask OpenPanel() { await UIManager.Instance.LoadAndOpenPanel(null, isShowBG: true); } public override void Close() { foreach (var summonScoreRuleWidget in summonScoreRuleWidgets) { UIManager.Instance.DormancyGComponent(summonScoreRuleWidget); } summonScoreRuleWidgets.Clear(); foreach (var summonScoreRuleWidget in summonScoreAwardWidgets) { UIManager.Instance.DormancyGComponent(summonScoreRuleWidget); } summonScoreAwardWidgets.Clear(); base.Close(); } } }