1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- using System.Collections.Generic;
- using Core.Language;
- using Fort23.Core;
- using GameLogic.Hero;
- using UnityEngine;
- using UnityEngine.UI;
- namespace Fort23.Mono
- {
- [UIBinding(prefab = "HeroBreakthroughSuccessPanel")]
- public partial class HeroBreakthroughSuccessPanel : UIPanel
- {
- List<UIComponent> heroAttributeWidgets = new List<UIComponent>();
- private void Init()
- {
- }
- protected override void AddEvent()
- {
- }
- protected override void DelEvent()
- {
- }
- public override void AddButtonEvent()
- {
- Btn_Close.onClick.AddListener(() => { UIManager.Instance.HideUIUIPanel(this); });
- }
- int type;
- public async static CTask<HeroBreakthroughSuccessPanel> OpenPanel(int type, List<HeroAttributeData> heroAttributes)
- {
- HeroBreakthroughSuccessPanel heroBreakthroughSuccessPanel = await UIManager.Instance.LoadAndOpenPanel<HeroBreakthroughSuccessPanel>(null, UILayer.Top, isFocus: false);
- heroBreakthroughSuccessPanel.CustomInit(type, heroAttributes);
- return heroBreakthroughSuccessPanel;
- }
- public async void CustomInit(int type, List<HeroAttributeData> heroAttributes)
- {
- HeroInfo heroInfo = new HeroInfo();
- heroInfo.InitHero(PlayerManager.Instance.myHero.heroData.heroModelId, PlayerManager.Instance.myHero.heroData.heroPowerId + 1);
- Text_CurretnJIngjie.text = LanguageManager.Instance.Text(PlayerManager.Instance.myHero.powerUpConfig.jingjieLanIDs[0]) +
- LanguageManager.Instance.Text(PlayerManager.Instance.myHero.powerUpConfig.jingjieLanIDs[1]) +
- LanguageManager.Instance.Text(PlayerManager.Instance.myHero.powerUpConfig.jingjieLanIDs[2]);
- Text_NextJIngjie.text = LanguageManager.Instance.Text(heroInfo.powerUpConfig.jingjieLanIDs[0]) +
- LanguageManager.Instance.Text(heroInfo.powerUpConfig.jingjieLanIDs[1]) +
- LanguageManager.Instance.Text(heroInfo.powerUpConfig.jingjieLanIDs[2]);
- if (type == 1 || type == 2)
- {
- Icon_Tu.gameObject.SetActive(true);
- Icon_Dj.gameObject.SetActive(false);
- }
- else
- {
- Icon_Tu.gameObject.SetActive(false);
- Icon_Dj.gameObject.SetActive(true);
- }
- foreach (var heroAttributeData in heroAttributes)
- {
- if (type == 1)
- {
- HeroAttributeWidgetType1 heroAttributeWidget = await UIManager.Instance.CreateGComponent<HeroAttributeWidgetType1>(null, AttributeRoot);
- heroAttributeWidget.CustomInit(heroAttributeData);
- heroAttributeWidgets.Add(heroAttributeWidget);
- }
- else
- {
- HeroAttributeWidgetType2 heroAttributeWidget = await UIManager.Instance.CreateGComponent<HeroAttributeWidgetType2>(null, AttributeRoot);
- heroAttributeWidget.CustomInit(heroAttributeData);
- heroAttributeWidgets.Add(heroAttributeWidget);
- }
- }
- LayoutRebuilder.ForceRebuildLayoutImmediate(AttributeRoot);
- LayoutRebuilder.ForceRebuildLayoutImmediate(AttributeRoot.parent.GetComponent<RectTransform>());
- }
- public override void Close()
- {
- foreach (var heroAttributeWidget in heroAttributeWidgets)
- {
- UIManager.Instance.DormancyGComponent(heroAttributeWidget);
- }
- heroAttributeWidgets.Clear();
- base.Close();
- }
- }
- }
|