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); } }
public override void OnEnter() { DatabaseResetOptions databaseResetOption = resetToInitialDatabase.Value ? DatabaseResetOptions.RevertToDefault : DatabaseResetOptions.KeepAllLoaded; PersistentDataManager.ApplySaveData(savegameData.Value, databaseResetOption); Finish(); }
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); } } }
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); } }
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."); } }
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"); } }
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(); }
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(); }
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."); } } }
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"); } }
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); } }
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"); } }
/// <summary> /// Loads the Dialogue System state from a dedicated AC global variable. /// </summary> public static void LoadDialogueSystemFromGlobalVariable() { PersistentDataManager.ApplySaveData(GlobalVariables.GetStringValue(GetDialogueSystemVarID())); }