using System; using System.Collections.Generic; using Excel2Json; using GameLogic.Bag; namespace Fort23.Mono { [UIBinding(prefab = "SummonScoreAwardWidget")] public partial class SummonScoreAwardWidget : UIComponent { List _widgetItems = new List(); public OpenBoxProgressReward _openBoxProgressReward = new OpenBoxProgressReward(); private Action lingquCallBack; private void Init() { } public override void AddEvent() { } public override void DelEvent() { } public override void AddButtonEvent() { Btn_LingQu.onClick.AddListener(() => { lingquCallBack?.Invoke(); Btn_LingQu.gameObject.SetActive(false); }); } public async void CustomInit(OpenBoxProgressReward openBoxProgressReward,Action lingquCallBack) { this.lingquCallBack = lingquCallBack; _openBoxProgressReward = openBoxProgressReward; Text_Name.text = $"累计达到 {openBoxProgressReward.TotalScore}"; for (var i = 0; i < openBoxProgressReward.PrizeID.Length; i++) { WidgetItem widgetItem = await UIManager.Instance.CreateGComponent(null, ItemRoot); widgetItem.InitWidget(new ItemInfo(openBoxProgressReward.PrizeID[i], openBoxProgressReward.PrizeCount[i])); _widgetItems.Add(widgetItem); } } public override void DormancyObj() { foreach (var widgetItem in _widgetItems) { UIManager.Instance.DormancyGComponent(widgetItem); } _widgetItems.Clear(); Icon_Select.gameObject.SetActive(false); Btn_LingQu.gameObject.SetActive(false); base.DormancyObj(); } } }