123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using System;
- using System.Collections.Generic;
- using Core.Language;
- using Excel2Json;
- using GameLogic.Bag;
- using UnityEngine.UI;
- namespace Fort23.Mono
- {
- [UIBinding(prefab = "SummonScoreAwardWidget")]
- public partial class SummonScoreAwardWidget : UIComponent
- {
- List<WidgetItem> _widgetItems = new List<WidgetItem>();
- 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 = $"{LanguageManager.Instance.Text(10191)} {openBoxProgressReward.TotalScore}";
- for (var i = 0; i < openBoxProgressReward.PrizeID.Length; i++)
- {
- WidgetItem widgetItem =
- await UIManager.Instance.CreateGComponentForObject<WidgetItem>(WidgetItemGam, null, ItemRoot);
- widgetItem.InitWidget(new ItemInfo(openBoxProgressReward.PrizeID[i],
- openBoxProgressReward.PrizeCount[i]));
- _widgetItems.Add(widgetItem);
- }
- LayoutRebuilder.ForceRebuildLayoutImmediate(ItemRoot);
- }
- 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();
- }
- }
- }
|