예제 #1
0
    private IEnumerator LoadGameSequence(bool fade, bool newGame)
    {
        if (fade)
        {
            yield return(AbstractMainMenu.Instance.FadeIntoPlay());
        }

        yield return(LoadingUI.Instance.StartLoading());

        yield return(SceneManager.LoadSceneAsync(GAME_SCENE));

        var levelData = GetLevelByName(SaveSystem.currentGameSave.currentLevelName);

        Player.Instance.ApplyUnitData(SaveSystem.currentGameSave.playerData);
        PersistentDataManager.ApplySaveData(SaveSystem.currentGameSave.databaseData);
        if (newGame)
        {
            SplashArtController.Instance.Activate();
        }
        else
        {
            SplashArtController.Instance.Deactivate();
        }

        yield return(GameSessionManager.Instance.LoadLevel(levelData,
                                                           SaveSystem.currentGameSave.playerData.currentPosition));

        if (newGame)
        {
            GameSessionManager.Instance.PlayCutScene(newGameCutScene);
        }
    }
예제 #2
0
        public override void OnEnter()
        {
            DatabaseResetOptions databaseResetOption = resetToInitialDatabase.Value ? DatabaseResetOptions.RevertToDefault : DatabaseResetOptions.KeepAllLoaded;

            PersistentDataManager.ApplySaveData(savegameData.Value, databaseResetOption);
            Finish();
        }
예제 #3
0
        public virtual void LoadGameNow(int slotNum)
        {
            var saveData = (LoadSlotHandler == null) ? PlayerPrefs.GetString(GetSlotDataKey(slotNum)) : LoadSlotHandler(slotNum);

            if (useLoadingScene)
            {
                PersistentDataManager.LevelWillBeUnloaded();
                LoadingScene.SetLoadGameData(saveData);
                SceneManager.LoadScene(loadingSceneIndex);
            }
            else
            {
                FindLevelManager();
                if (levelManager != null)
                {
                    levelManager.LoadGame(saveData);
                }
                else
                {
                    Lua.Run(saveData, true);
                    PersistentDataManager.LevelWillBeUnloaded();
                    if (DialogueLua.DoesVariableExist("SavedLevelName"))
                    {
                        Tools.LoadLevel(DialogueLua.GetVariable("SavedLevelName").AsString);
                    }
                    else
                    {
                        RestartGame();
                    }
                    PersistentDataManager.ApplySaveData(saveData, DatabaseResetOptions.KeepAllLoaded);
                }
            }
        }
예제 #4
0
        public override void OnEnter()
        {
            string data = (saveData == null) ? null : saveData.Value;

            if (string.IsNullOrEmpty(data))
            {
                LogError("Saved game data is an empty string");
            }
            else
            {
                var saveSystem = GameObject.FindObjectOfType <SaveSystem>();
                if (saveSystem != null)
                {
                    var savedGameData = JsonUtility.FromJson <SavedGameData>(data);
                    SaveSystem.LoadGame(savedGameData);
                }
                else
                {
                    var levelManager = GameObject.FindObjectOfType <LevelManager>();
                    if (levelManager != null)
                    {
                        levelManager.LoadGame(data);
                    }
                    else
                    {
                        PersistentDataManager.ApplySaveData(data);
                    }
                }
            }
            Finish();
        }
 public void LoadGame(DataObject data)
 {
     if (data == null)
     {
         DialogueManager.ResetDatabase(DatabaseResetOptions.KeepAllLoaded);
     }
     else
     {
         string savedata = string.Empty;
         data.Get("savedata", ref savedata);
         PersistentDataManager.ApplySaveData(savedata);
     }
 }
        /// <summary>
        /// Loads the Dialogue System state from a dedicated AC global variable.
        /// </summary>
        public static void LoadDialogueSystemFromGlobalVariable()
        {
            var data = GlobalVariables.GetStringValue(GetDialogueSystemVarID());

            if (FindObjectOfType <PixelCrushers.SaveSystem>() != null)
            {
                PixelCrushers.SaveSystem.ApplySavedGameData(PixelCrushers.SaveSystem.Deserialize <SavedGameData>(data));
            }
            else
            {
                PersistentDataManager.ApplySaveData(data);
            }
        }
예제 #7
0
 public void LoadGame()
 {
     if (PlayerPrefs.HasKey(savedGameKey))
     {
         var saveData = PlayerPrefs.GetString(savedGameKey);
         Debug.Log("LOADED DATA: " + saveData);
         PersistentDataManager.ApplySaveData(saveData);
         DialogueManager.ShowAlert("Loaded Love/Hate data...");
     }
     else
     {
         DialogueManager.ShowAlert("Save the data first.");
     }
 }
예제 #8
0
 private void LoadGame()
 {
     if (PlayerPrefs.HasKey("SavedGame"))
     {
         string saveData = PlayerPrefs.GetString("SavedGame");
         Debug.Log("Load Game Data: " + saveData);
         PersistentDataManager.ApplySaveData(saveData);
         DialogueManager.ShowAlert("Game Loaded from PlayerPrefs");
     }
     else
     {
         DialogueManager.ShowAlert("Save a game first");
     }
 }
예제 #9
0
 public override void LoadData(string stringData)
 {
     if (FindObjectOfType <PixelCrushers.SaveSystem>() != null)
     {
         if (DialogueDebug.LogInfo)
         {
             Debug.Log("Restoring Dialogue System state from Adventure Creator.");
         }
         PixelCrushers.SaveSystem.ApplySavedGameData(PixelCrushers.SaveSystem.Deserialize <PixelCrushers.SavedGameData>(stringData));
     }
     else
     {
         PersistentDataManager.ApplySaveData(stringData);
     }
     //UpdateSettingsFromAC();
 }
예제 #10
0
 public override void OnEnter()
 {
     if (savegameData != null)
     {
         var saveSystem = GameObject.FindObjectOfType <SaveSystem>();
         if (saveSystem != null)
         {
             var savedGameData = JsonUtility.FromJson <SavedGameData>(savegameData.Value);
             SaveSystem.LoadGame(savedGameData);
         }
         else
         {
             DatabaseResetOptions databaseResetOption = resetToInitialDatabase.Value ? DatabaseResetOptions.RevertToDefault : DatabaseResetOptions.KeepAllLoaded;
             PersistentDataManager.ApplySaveData(savegameData.Value, databaseResetOption);
         }
     }
     Finish();
 }
예제 #11
0
파일: DemoMenu.cs 프로젝트: fkavum/infated
        private void LoadGame()
        {
            PersistentDataManager.LevelWillBeUnloaded();
            var saveSystem = FindObjectOfType <SaveSystem>();

            if (saveSystem != null)
            {
                if (SaveSystem.HasSavedGameInSlot(1))
                {
                    SaveSystem.LoadFromSlot(1);
                    DialogueManager.ShowAlert("Game loaded.");
                }
                else
                {
                    DialogueManager.ShowAlert("Save a game first.");
                }
            }
            else
            {
                if (PlayerPrefs.HasKey("SavedGame"))
                {
                    string saveData = PlayerPrefs.GetString("SavedGame");
                    Debug.Log("Load Game Data: " + saveData);
                    LevelManager levelManager = FindObjectOfType <LevelManager>();
                    if (levelManager != null)
                    {
                        levelManager.LoadGame(saveData);
                    }
                    else
                    {
                        PersistentDataManager.ApplySaveData(saveData);
                        DialogueManager.SendUpdateTracker();
                    }
                    DialogueManager.ShowAlert("Game loaded.");
                }
                else
                {
                    DialogueManager.ShowAlert("Save a game first.");
                }
            }
        }
예제 #12
0
 private void LoadGame()
 {
     if (PlayerPrefs.HasKey("SavedGame"))
     {
         string saveData = PlayerPrefs.GetString("SavedGame");
         Debug.Log("Load Game Data: " + saveData);
         LevelManager levelManager = GetComponentInChildren <LevelManager>();
         if (levelManager != null)
         {
             levelManager.LoadGame(saveData);
         }
         else
         {
             PersistentDataManager.ApplySaveData(saveData);
         }
         DialogueManager.ShowAlert("Game Loaded from PlayerPrefs");
     }
     else
     {
         DialogueManager.ShowAlert("Save a game first");
     }
 }
예제 #13
0
        private IEnumerator ContinueCoroutine()
        {
            DialogueManager.StopConversation();
            Application.LoadLevel(storyScene);
            yield return(null);

            ConnectDialogueUI();
            PersistentDataManager.ApplySaveData(PlayerPrefs.GetString(savedGameKey));
            var conversationID  = DialogueLua.GetVariable("conversationID").AsInt;
            var dialogueEntryID = DialogueLua.GetVariable("dialogueEntryID").AsInt;
            var conversation    = DialogueManager.MasterDatabase.GetConversation(conversationID);

            if (conversation == null)
            {
                Debug.LogError("Can't find a conversation with ID " + conversationID);
                DialogueManager.ShowAlert("Sorry, can't load the story conversation!");
            }
            else
            {
                DialogueManager.StartConversation(conversation.Title, null, null, dialogueEntryID);
            }
        }
예제 #14
0
 private void LoadGame()
 {
     if (PlayerPrefs.HasKey("SavedGame"))
     {
         string saveData = PlayerPrefs.GetString("SavedGame");
         Debug.Log("Load Game Data: " + saveData);
         LevelManager levelManager = FindObjectOfType <LevelManager>();
         if (levelManager != null)
         {
             levelManager.LoadGame(saveData);
         }
         else
         {
             PersistentDataManager.ApplySaveData(saveData);
             DialogueManager.SendUpdateTracker();
         }
         DialogueManager.ShowAlert("Game Loaded from PlayerPrefs");
     }
     else
     {
         DialogueManager.ShowAlert("Save a game first");
     }
 }
예제 #15
0
 /// <summary>
 /// Loads the Dialogue System state from a dedicated AC global variable.
 /// </summary>
 public static void LoadDialogueSystemFromGlobalVariable()
 {
     PersistentDataManager.ApplySaveData(GlobalVariables.GetStringValue(GetDialogueSystemVarID()));
 }