| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 | using System.Collections.Generic;using Core.Audio;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;            });            Btn_Close2.onClick.AddListener(async() =>            {                await UIManager.Instance.HideUIUIPanel(this);                callBack?.Invoke();                callBack = null;            });        }        public async void CustomInit(bool isWin, System.Action callBack)        {            this.callBack = callBack;            AudioManager.Instance.PauseBGM();            if (isWin)            {                Btn_Close.enabled = true;                AudioManager.Instance.PlayAudio("combat_win.wav");                WinRoot.SetActive(true);                FailRoot.SetActive(false);                // f                // Text_Desc.gameObject.SetActive(false);                // Text_Settlement.text = "胜利";            }            else            {                Btn_Close.enabled = false;                AudioManager.Instance.PlayAudio("shibai.wav");                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, isShowBG: true);            battleSettlementPanel.CustomInit(isWin, callBack);            return battleSettlementPanel;        }        public async override CTask Close()        {            AudioManager.Instance.UnPauseBGM();            foreach (var skipToWidget in skipToWidgets)            {                UIManager.Instance.DormancyGComponent(skipToWidget);            }            skipToWidgets.Clear();            await base.Close();        }    }}
 |