| | |
| | | using System.Collections.Generic; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | protected override void OnPreOpen() |
| | | { |
| | | base.OnPreOpen(); |
| | | |
| | | UIManager.Instance.OnOpenWindow += OnOpenWindow; |
| | | UIManager.Instance.CloseWindow<MainWin>(); |
| | | isClickSkip = false; |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | base.OnPreClose(); |
| | | |
| | | UIManager.Instance.OnOpenWindow -= OnOpenWindow; |
| | | if (!UIManager.Instance.IsOpened<MainWin>()) |
| | | UIManager.Instance.OpenWindow<MainWin>(); |
| | | |
| | |
| | | bossBattleObject.buffMgr.onBuffChanged -= OnBuffChanged; |
| | | bossBattleObject = null; |
| | | } |
| | | |
| | | if (isClickSkip) |
| | | { |
| | | isClickSkip = false; |
| | | TryPass(); |
| | | } |
| | | } |
| | | |
| | | bool isClickSkip = false; |
| | | protected override void OnClickPass() |
| | | { |
| | | if (!IsPass()) |
| | | return; |
| | | isClickSkip = true; |
| | | clickTime = Time.time; // 记录点击时间 |
| | | battleField.ForceFinish(); |
| | | } |
| | | |
| | | void OnOpenWindow(UIBase win) |
| | | { |
| | | if (win is BattleVictoryWin || win is BattleFailWin) |
| | | { |
| | | isClickSkip = false; |
| | | } |
| | | } |
| | | |
| | | float stayTime = 2f; |
| | | float clickTime = 0f; |
| | | void LateUpdate() |
| | | { |
| | | if (isClickSkip && Time.time - clickTime >= stayTime) |
| | | { |
| | | isClickSkip = false; |
| | | TryPass(); |
| | | } |
| | | } |
| | | |
| | | private void TryPass() |
| | | { |
| | | if (UIManager.Instance.IsOpened<BattleVictoryWin>() || |
| | | UIManager.Instance.IsOpened<BattleFailWin>()) |
| | | return; |
| | | CloseWindow(); |
| | | Debug.LogError($"OnBattleEnd 异常关闭"); |
| | | BattleSettlementManager.Instance.WinShowOver(BattleConst.StoryBossBattleField); |
| | | } |
| | | protected override void OnCreateBattleField(string guid, BattleField field) |
| | | { |
| | | if (field is StoryBossBattleField) |