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 skipToWidgets = new List(); 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(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 OpenPanel(bool isWin, System.Action callBack) { BattleSettlementPanel battleSettlementPanel = await UIManager.Instance.LoadAndOpenPanel(null); battleSettlementPanel.CustomInit(isWin, callBack); return battleSettlementPanel; } public override void Close() { foreach (var skipToWidget in skipToWidgets) { UIManager.Instance.DormancyGComponent(skipToWidget); } skipToWidgets.Clear(); base.Close(); } } }