using System.Collections.Generic; using System.Linq; using Excel2Json; using Fort23.UTool; using GameLogic.Bag; namespace Fort23.Mono { [UIBinding(prefab = "DaoYouLevelWidget")] public partial class DaoYouLevelWidget : UIComponent { public DaoyouLevelupConfig _daoyouLevelupConfig; List _widgetItems = new List(); private void Init() { } public override void AddEvent() { } public override void DelEvent() { } public override void AddButtonEvent() { } public async void CustomInit(AccountFileInfo.DaoYouData daoYouData, int configId) { _daoyouLevelupConfig = ConfigComponent.Instance.Get(configId); DaoyouModelConfig daoyouModelConfig = ConfigComponent.Instance.Get(daoYouData.id); Text_Level.text = configId.ToString(); for (var i = 0; i < _daoyouLevelupConfig.prizeID?.Length; i++) { WidgetItem widgetItem = await UIManager.Instance.CreateGComponent(null, ItemRoot); widgetItem.InitWidget(new ItemInfo(_daoyouLevelupConfig.prizeID[i], _daoyouLevelupConfig.prizeNum[i])); _widgetItems.Add(widgetItem); } if (daoyouModelConfig.EmotionLvforspecialGift.Contains(configId)) { int index = daoyouModelConfig.EmotionLvforspecialGift.ToList().IndexOf(configId); WidgetItem widgetItem = await UIManager.Instance.CreateGComponent(null, ItemRoot); widgetItem.InitWidget(new ItemInfo(daoyouModelConfig.specialGiftID[index], daoyouModelConfig.specialGiftNum[index])); _widgetItems.Add(widgetItem); } if (daoYouData.awardLevels.Contains(configId)) { Text_Tips.gameObject.SetActive(true); } else { Text_Tips.gameObject.SetActive(false); } } public override void DormancyObj() { foreach (var widgetItem in _widgetItems) { UIManager.Instance.DormancyGComponent(widgetItem); } _widgetItems.Clear(); base.DormancyObj(); } } }