Exemplo n.º 1
0
        public virtual void LoadLevel(string levelName, int loadingSceneIndex = -1)
        {
            ShowLoadInProgress();
            var loadingSceneIndexToUse = (loadingSceneIndex == -1) ? this.loadingSceneIndex : loadingSceneIndex;

            if (useLoadingScene)
            {
                PersistentDataManager.Record();
                LoadingScene.SetDestinationScene(levelName);
                PersistentDataManager.LevelWillBeUnloaded();
                SceneManager.LoadScene(loadingSceneIndexToUse);
            }
            else
            {
                FindLevelManager();
                if (levelManager != null)
                {
                    levelManager.LoadLevel(levelName);
                }
                else
                {
                    PersistentDataManager.Record();
                    PersistentDataManager.LevelWillBeUnloaded();
                    SceneManager.LoadScene(levelName);
                    PersistentDataManager.Apply();
                }
            }
        }
        public void Start()
        {
            string levelName = GetParameter(0);

            /*;*/
            if (string.IsNullOrEmpty(levelName))
            {
                if (DialogueDebug.LogWarnings)
                {
                    Debug.LogWarning(string.Format("{0}: Sequencer: LoadLevel() level name is an empty string", DialogueDebug.Prefix));
                }
            }
            else
            {
                if (DialogueDebug.LogInfo)
                {
                    Debug.Log(string.Format("{0}: Sequencer: LoadLevel({1})", DialogueDebug.Prefix, levelName));
                }
                var levelManager = FindObjectOfType <LevelManager>();
                if (levelManager != null)
                {
                    levelManager.LoadLevel(levelName);
                }
                else
                {
                    PersistentDataManager.Record();
                    PersistentDataManager.LevelWillBeUnloaded();
                    GameObject.Find("Loader").SendMessage("LoadLevel", levelName);                    //Application.LoadLevel(levelName);
                    PersistentDataManager.Apply();
                }
            }
            Stop();
        }
Exemplo n.º 3
0
        public void Start()
        {
            string levelName  = GetParameter(0);
            string spawnpoint = GetParameter(1);
            bool   additive   = string.Equals(GetParameter(2), "additive", System.StringComparison.OrdinalIgnoreCase);

            if (string.IsNullOrEmpty(levelName))
            {
                if (DialogueDebug.logWarnings)
                {
                    Debug.LogWarning(string.Format("{0}: Sequencer: LoadLevel() level name is an empty string", DialogueDebug.Prefix));
                }
            }
            else
            {
                if (DialogueDebug.logInfo)
                {
                    Debug.Log(string.Format("{0}: Sequencer: LoadLevel({1})", DialogueDebug.Prefix, GetParameters()));
                }
                DialogueLua.SetActorField("Player", "Spawnpoint", spawnpoint);
                var saveSystem = FindObjectOfType <SaveSystem>();
                if (saveSystem != null)
                {
                    if (additive)
                    {
                        SaveSystem.LoadAdditiveScene(levelName);
                    }
                    else
                    {
                        PersistentDataManager.LevelWillBeUnloaded();
                        SaveSystem.LoadScene(string.IsNullOrEmpty(spawnpoint) ? levelName : levelName + "@" + spawnpoint);
                    }
                }
                else
                {
                    if (additive)
                    {
                        UnityEngine.SceneManagement.SceneManager.LoadScene(levelName, UnityEngine.SceneManagement.LoadSceneMode.Additive);
                    }
                    else
                    {
                        var levelManager = FindObjectOfType <LevelManager>();
                        if (levelManager != null)
                        {
                            levelManager.LoadLevel(levelName);
                        }
                        else
                        {
                            PersistentDataManager.Record();
                            PersistentDataManager.LevelWillBeUnloaded();
                            UnityEngine.SceneManagement.SceneManager.LoadScene(levelName, UnityEngine.SceneManagement.LoadSceneMode.Single);
                            PersistentDataManager.Apply();
                        }
                    }
                }
            }
            Stop();
        }
Exemplo n.º 4
0
 private IEnumerator DoneLoadingLevelCoroutine()
 {
     Fsm.Event(loadedEvent);
     for (int i = 0; i < framesToWaitBeforeApplyData; i++)
     {
         yield return(null);
     }
     if (applyPersistentData)
     {
         PersistentDataManager.Apply();
     }
     Finish();
 }
Exemplo n.º 5
0
        private IEnumerator Start()
        {
            if (hideDialogueManagerCanvases)
            {
                HideDialogueManagerCanvases();
            }
            if (minDurationToShowLoadingScene > 0)
            {
                yield return(new WaitForSeconds(minDurationToShowLoadingScene));
            }
            inLoadingScene = true;
            var levelManager = FindObjectOfType <LevelManager>();

            if (s_sceneBuildIndex != -1)
            {
                levelManager.LoadLevel(s_sceneBuildIndex);
            }
            else if (!string.IsNullOrEmpty(s_sceneName))
            {
                levelManager.LoadLevel(s_sceneName);
            }
            else
            {
                if (string.IsNullOrEmpty(s_saveData))
                {
                    var mySceneIndex = SceneManager.GetActiveScene().buildIndex;
                    var asyncOp      = StartLoadSceneAsync();
                    yield return(asyncOp);

#if UNITY_5_5_OR_NEWER
                    SceneManager.UnloadSceneAsync(mySceneIndex);
#else
                    SceneManager.UnloadScene(mySceneIndex);
#endif
                    PersistentDataManager.Apply();
                }
                else
                {
                    levelManager.LoadGame(s_saveData);
                }
            }
        }
        public void Start()
        {
            string levelName  = GetParameter(0);
            string spawnpoint = GetParameter(1);

            if (string.IsNullOrEmpty(levelName))
            {
                if (DialogueDebug.LogWarnings)
                {
                    Debug.LogWarning(string.Format("{0}: Sequencer: LoadLevel() level name is an empty string", DialogueDebug.Prefix));
                }
            }
            else
            {
                if (DialogueDebug.LogInfo)
                {
                    Debug.Log(string.Format("{0}: Sequencer: LoadLevel({1})", DialogueDebug.Prefix, GetParameters()));
                }
                DialogueLua.SetActorField("Player", "Spawnpoint", spawnpoint);
                var levelManager = FindObjectOfType <LevelManager>();
                if (levelManager != null)
                {
                    levelManager.LoadLevel(levelName);
                }
                else
                {
                    PersistentDataManager.Record();
                    PersistentDataManager.LevelWillBeUnloaded();
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
                    UnityEngine.SceneManagement.SceneManager.LoadScene(levelName, UnityEngine.SceneManagement.LoadSceneMode.Single);
#else
                    Application.LoadLevel(levelName);
#endif
                    PersistentDataManager.Apply();
                }
            }
            Stop();
        }
Exemplo n.º 7
0
        public void Start()
        {
            string levelName = GetParameter(0);

            if (string.IsNullOrEmpty(levelName))
            {
                if (DialogueDebug.LogWarnings)
                {
                    Debug.LogWarning(string.Format("{0}: Sequencer: LoadLevel() level name is an empty string", DialogueDebug.Prefix));
                }
            }
            else
            {
                if (DialogueDebug.LogInfo)
                {
                    Debug.Log(string.Format("{0}: Sequencer: LoadLevel({1})", DialogueDebug.Prefix, levelName));
                }
                var levelManager = FindObjectOfType <LevelManager>();
                if (levelManager != null)
                {
                    levelManager.LoadLevel(levelName);
                }
                else
                {
                    PersistentDataManager.Record();
                    PersistentDataManager.LevelWillBeUnloaded();
                                        #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
                    Application.LoadLevel(levelName);
                                        #else
                    SceneManager.LoadScene(levelName);
                                        #endif
                    PersistentDataManager.Apply();
                }
            }
            Stop();
        }
Exemplo n.º 8
0
 public override void OnEnter()
 {
     PersistentDataManager.Apply();
     Finish();
 }