using System; using System.Collections.Generic; using BehaviorDesigner.Runtime; using MoleMole.Config; using UnityEngine; using UnityEngine.UI; using proto; namespace MoleMole { public class LevelEndPageContext : BasePageContext { private const float WAIT_TIME = 10f; private CanvasTimer _timer; private int ANIMATOR_LEVEL_WIN_BOOL_ID = Animator.StringToHash("LevelWin"); private int ANIMATOR_TRIGGER_PLAY_ID = Animator.StringToHash("TriggerPlay"); public readonly bool isSuccess; public readonly EvtLevelState.LevelEndReason endReason; private int _cgId; private bool _forceEnableWhenSetup; public LevelEndPageContext(bool isSuccess) { config = new ContextPattern { contextName = "LevelEndPageContext", viewPrefabPath = "UI/Menus/Page/InLevel/LevelEndPage" }; this.isSuccess = isSuccess; _cgId = 0; if (Singleton.Instance != null) { Singleton.Instance.isLevelSuccess = isSuccess; } } public LevelEndPageContext(EvtLevelState.LevelEndReason reason, bool forceEnableWhenSetup = false, int cgId = 0) { config = new ContextPattern { contextName = "LevelEndPageContext", viewPrefabPath = "UI/Menus/Page/InLevel/LevelEndPage" }; endReason = reason; isSuccess = reason == EvtLevelState.LevelEndReason.EndWin; if (Singleton.Instance != null) { Singleton.Instance.isLevelSuccess = isSuccess; } _forceEnableWhenSetup = forceEnableWhenSetup; _cgId = cgId; } protected override void BindViewCallbacks() { BindViewCallback(base.view.transform.Find("Button").GetComponent