using System; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class FairylandCeremonyWin : Window { [SerializeField] FunctionButtonGroup funcBtnGroup; [SerializeField] FunctionButton rechargeFunc; [SerializeField] FunctionButton fireFunc; [SerializeField] FunctionButton peopleToHiFunc; [SerializeField] FunctionButton outofFunc; [SerializeField] Button leftBtn; [SerializeField] Button rightBtn; [SerializeField] Button closeBtn; protected override void BindController() { } protected override void AddListeners() { rechargeFunc.onClick.AddListener(ClickRecharge); fireFunc.onClick.AddListener(ClickFire); peopleToHiFunc.onClick.AddListener(ClickPeopleToHi); outofFunc.onClick.AddListener(ClickOutOf); leftBtn.onClick.AddListener(OnClickLeftBtn); rightBtn.onClick.AddListener(OnClickRightBtn); closeBtn.onClick.AddListener(ClickClose); } protected override void OnPreOpen() { } protected override void OnActived() { base.OnActived(); funcBtnGroup.TriggerByOrder(functionOrder); } protected override void OnAfterOpen() { } protected override void OnPreClose() { } protected override void OnAfterClose() { if(!WindowJumpMgr.Instance.IsJumpState) { WindowCenter.Instance.Open(); } } private void OnClickRightBtn() { funcBtnGroup.TriggerNext(); } private void OnClickLeftBtn() { funcBtnGroup.TriggerLast(); } private void ClickOutOf() { CloseChildWin(); if (windowState == WindowState.Opened) { WindowCenter.Instance.OpenWithoutAnimation(); } else { WindowCenter.Instance.Open(); } functionOrder = 3; } private void ClickPeopleToHi() { CloseChildWin(); if (windowState == WindowState.Opened) { WindowCenter.Instance.OpenWithoutAnimation(); } else { WindowCenter.Instance.Open(); } functionOrder = 2; } private void ClickFire() { CloseChildWin(); if (windowState == WindowState.Opened) { WindowCenter.Instance.OpenWithoutAnimation(); } else { WindowCenter.Instance.Open(); } functionOrder = 1; } private void ClickRecharge() { CloseChildWin(); if (windowState == WindowState.Opened) { WindowCenter.Instance.OpenWithoutAnimation(); } else { WindowCenter.Instance.Open(); } functionOrder = 0; } private void CloseChildWin() { if (WindowCenter.Instance.CheckOpen()) { WindowCenter.Instance.CloseImmediately(); } if (WindowCenter.Instance.CheckOpen()) { WindowCenter.Instance.CloseImmediately(); } if (WindowCenter.Instance.CheckOpen()) { WindowCenter.Instance.CloseImmediately(); } if (WindowCenter.Instance.CheckOpen()) { WindowCenter.Instance.CloseImmediately(); } } private void ClickClose() { CloseChildWin(); CloseClick(); } } }