using UnityEngine;

namespace BingoBrain.Core
{
    public sealed class GameBoardk : BaseInterfaceManager<GameBoardk>
    {
        public bool IsPause { get; private set; }
        private float pauseCacheTimeScale = 1;

        #region Game

        public void Restart()
        {
            Debug.Log("[GameMgr]Restart");
            Pva.Restart();
        }

        public void Quit()
        {
            Debug.Log("[GameMgr]Quit");
            Pva.Quit();
        }

        public void Pause()
        {
            Debug.Log("[GameMgr]Pause");
            IsPause = true;
            AppDispatcher.Instance.Dispatch(CsjInfoC.App_GamePause);
            Audio.Instance.PauseAllSource();
            pauseCacheTimeScale = Time.timeScale;
            Time.timeScale = 0;
        }

        public void Resume()
        {
            Debug.Log("[GameMgr]Resume");
            IsPause = false;
            AppDispatcher.Instance.Dispatch(CsjInfoC.App_GameResume);
            Audio.Instance.UnPauseAllSource();
            Time.timeScale = pauseCacheTimeScale;
        }

        #endregion

        #region Scene

        public void InitialMain()
        {
            Debug.Log("[ BingoBrain ] [ GameMgr ] InitialMain");
            SceneBoardk.Instance.InitialMain();
        }

        public void EnterMain()
        {
            Debug.Log("[GameMgr]EnterMain");
            SceneBoardk.Instance.SwitchScene(SceneBoardk.DefaultMainSceneIdx);
        }

        #endregion Scene

        #region Msg

        private void AddListener()
        {
        }

        private void RemoveListener()
        {
        }

        #endregion Msg

        #region Private

        public override void Init()
        {
            base.Init();
            AddListener();
        }

        public override void Dispose()
        {
            base.Dispose();
            RemoveListener();
        }

        #endregion Private
    }
}