12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- using System.Collections.Generic;
- using Fort23.Core;
- using Mono.Utility;
- namespace Fort23.Mono
- {
- [UIBinding(prefab = "BattleSettlementPanel")]
- public partial class BattleSettlementPanel : UIPanel
- {
- private System.Action callBack;
- List<SkipToWidget> skipToWidgets = new List<SkipToWidget>();
- private void Init()
- {
- isAddStack = false;
- }
- protected override void AddEvent()
- {
- }
- protected override void DelEvent()
- {
- }
- public override void AddButtonEvent()
- {
- Btn_Close.onClick.AddListener(async () =>
- {
- await UIManager.Instance.HideUIUIPanel(this);
- callBack?.Invoke();
- callBack = null;
- });
- }
- public async void CustomInit(bool isWin, System.Action callBack)
- {
- this.callBack = callBack;
- if (isWin)
- {
- WinRoot.SetActive(true);
- FailRoot.SetActive(false);
- // f
- // Text_Desc.gameObject.SetActive(false);
- // Text_Settlement.text = "胜利";
- }
- else
- {
- WinRoot.SetActive(false);
- FailRoot.SetActive(true);
- SkipToWidget skipToWidget = await UIManager.Instance.CreateGComponentForObject<SkipToWidget>(SkipToWidgetGam, null, SkipToContent);
- skipToWidget.CustonInit(1);
- skipToWidgets.Add(skipToWidget);
- skipToWidget.OnClick = OnClick;
- // Text_Desc.gameObject.SetActive(true);
- // Text_Settlement.text = "失败";
- }
- }
- private async void OnClick(ItemWidgetBasic obj)
- {
- SkipToWidget skipToWidget = obj as SkipToWidget;
- await UIManager.Instance.HideUIUIPanel(this);
- callBack?.Invoke();
- callBack = null;
- SkiptoHelper.Skipto(skipToWidget.SkiptoConfig.ID);
- }
- public static async CTask<BattleSettlementPanel> OpenPanel(bool isWin, System.Action callBack)
- {
- BattleSettlementPanel battleSettlementPanel = await UIManager.Instance.LoadAndOpenPanel<BattleSettlementPanel>(null);
- battleSettlementPanel.CustomInit(isWin, callBack);
- return battleSettlementPanel;
- }
- public override void Close()
- {
- foreach (var skipToWidget in skipToWidgets)
- {
- UIManager.Instance.DormancyGComponent(skipToWidget);
- }
- skipToWidgets.Clear();
- base.Close();
- }
- }
- }
|