コード例 #1
0
    IEnumerator _LoadScene(ESceneName scene)
    {
        if (GameManager.Setting.AllowLockScreen)
        {
            //dont allow sleep all sences
            Screen.sleepTimeout = SleepTimeout.NeverSleep;

            //if (scene == ESceneName.Gameplay)
            //    Screen.sleepTimeout = SleepTimeout.NeverSleep;
            //else if (Screen.sleepTimeout != SleepTimeout.SystemSetting)
            //    Screen.sleepTimeout = SleepTimeout.SystemSetting;
        }

        _oldScene     = _currentScene;
        _currentScene = scene;
        Debug.LogWarning("Loading Scene: " + scene.ToString());

        //AsyncOperation async = Application.LoadLevelAsync(scene.ToString());

        Application.LoadLevel(scene.ToString());

        yield return(new WaitForFixedUpdate());

        if (scene == ESceneName.LoginScreen)
        {
            GameObject.Destroy(HeaderMenu.Instance.gameObject);
        }
        if (scene == ESceneName.GameplayChan || scene == ESceneName.LoginScreen)
        {
            GPChatView.listMessage.Clear();
            BroadcastView.Destroy();
        }
        HeaderMenu.Instance.isClickedBtnBack = false;
        System.GC.Collect();
        PlaySameDevice.ClearCache();
        TournamentInfo item = GameManager.Instance.currentTournamentInfo;
    }
コード例 #2
0
 public static void LoadScene(ESceneName scene)
 {
     Instance.StartCoroutine(Instance._LoadScene(scene));
 }