123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- 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<WidgetItem> _widgetItems = new List<WidgetItem>();
- 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<DaoyouLevelupConfig>(configId);
- DaoyouModelConfig daoyouModelConfig = ConfigComponent.Instance.Get<DaoyouModelConfig>(daoYouData.id);
- Text_Level.text = configId.ToString();
- for (var i = 0; i < _daoyouLevelupConfig.prizeID?.Length; i++)
- {
- WidgetItem widgetItem = await UIManager.Instance.CreateGComponent<WidgetItem>(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<WidgetItem>(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();
- }
- }
- }
|