void MasterClientInit() { SaveGameToLoad saveGameToLoad = FindObjectOfType <SaveGameToLoad>(); string bundleId = GameBuilderApplication.CurrentGameOptions.bundleIdToLoad; if (saveGameToLoad) { Debug.Log("Loading saved game!"); saveLoad.Load(saveGameToLoad.saved, saveGameToLoad.voosFilePath); GameObject.Destroy(saveGameToLoad.gameObject); } else if (!bundleId.IsNullOrEmpty()) { Debug.Log($"Loading game bundle {bundleId}"); string voosPath = gameBundleLibrary.GetBundle(bundleId).GetVoosPath(); saveLoad.Load(SaveLoadController.ReadSaveGame(voosPath), voosPath); #if !USE_STEAMWORKS workshop.Load(gameBundleLibrary.GetBundle(bundleId).GetAssetsPath()); #endif lastLoadedBundleId = bundleId; } else { SaveLoadController.SaveGame save = SaveLoadController.ReadSaveGame(GameBuilderSceneController.GetMinimalScenePath(mode == Mode.Online)); saveLoad.Load(save); } using (Util.Profile("SpawnLocalobjects")) SpawnLocalObjects(); StartCoroutine(LoadingSequence()); }
public void UpdateScoreBoard() { //Load score saveLoad = new SaveLoadController(); saveLoad.Load(); //Shows 2 digits numbers max string oScore = Mathf.Clamp(SaveLoadController.loadedOScore, 0, 99).ToString(); string xScore = Mathf.Clamp(SaveLoadController.loadedXScore, 0, 99).ToString(); //Properly display the score on the number board if (oScore.Length > 1) { oDigitBack.text = oScore[1].ToString(); oDigitFront.text = oScore[0].ToString(); } else { oDigitFront.text = "0"; oDigitBack.text = oScore[0].ToString(); } if (xScore.Length > 1) { xDigitBack.text = xScore[1].ToString(); xDigitFront.text = xScore[0].ToString(); } else { xDigitFront.text = "0"; xDigitBack.text = xScore[0].ToString(); } }
void GameWinner(int oxValue) { //mark the game has ended gameEnd = true; saveLoad.Load(); // Load the score first to get the previous score //enable victory UI and increase the score of winning player if (oxValue == (xValue * (int)gridSize)) { gameVisual.WinGameVisual("X Won!"); SaveLoadController.savedXScore = ++SaveLoadController.loadedXScore; } else if (oxValue == (oValue * (int)gridSize)) { gameVisual.WinGameVisual("O Won!"); SaveLoadController.savedOScore = ++SaveLoadController.loadedOScore; } else { gameVisual.WinGameVisual("It's a Draw!"); } //Save the game with the new score saveLoad.Save(); //Update score board with the new score gameVisual.UpdateScoreBoard(); }
public Form1() { InitializeComponent(); RegisterControllers(); _saveLoadController.Load(); }
public void ResumeGame() { ds.PlaySoundScript("event:/UI/ui_click", 0, 0); bool success = SaveLoadController.Load(); if (success) { SceneManager.LoadScene("forest_scene"); } else { Debug.Log("No Load Data"); } }
/// <summary> /// Sets the grid controller and the player controller and sets objects for the save mechanic /// </summary> void Start() { gridCon = grid.GetComponent <JDGroundSpawner>(); playerCon = player.GetComponent <PlayerController>(); SaveLoadController.setPlayer(player); SaveLoadController.setInvCon(playerCon.invCon); SaveLoadController.setGrid(gridCon); if (SaveLoadController.contin) { SaveLoadController.Load(); } }
void Awake() { SavedGame.gameObject.SetActive(false); if (!Battle.won) { SaveLoadController.Load(); } else if (Battle.worldObjName != "" && Battle.won) { SaveLoadController.EnemiesDefeatedList.Add(Battle.worldObjName); if (Battle.worldObjName == "Prince") { SceneManager.LoadScene("end_game"); } } SaveLoadController.SaveData data = SaveLoadController.data; if (SaveLoadController.data != null) { GameObject.FindGameObjectWithTag("Player").transform.position = new Vector3(data.PositionX, data.PositionY, data.PositionZ); Battle.playerEntity.InitStats("Dragon", data.CurrLevel); Battle.playerEntity.CurrentExperience = data.CurrExp; Battle.playerEntity.CurrentHealth = data.CurrHealth; StoryController.SetNumberScrollsFound(data.ScrollsCaughtCount); foreach (FountainController fountain in FindObjectsOfType <FountainController>()) { int i = Array.IndexOf(data.FountainsUsed, fountain.name); if (i > -1) { fountain.active = false; } } foreach (EnemyWorldScript enemy in FindObjectsOfType <EnemyWorldScript>()) { int i = Array.IndexOf(data.EnemiesDefeated, enemy.name); if (i > -1 || (enemy.name == Battle.worldObjName && Battle.won)) { Destroy(enemy.gameObject); } } foreach (ScrollController scrollSub in FindObjectsOfType <ScrollController>()) { GameObject scroll = scrollSub.transform.parent.gameObject; int i = Array.IndexOf(data.ScrollsCaught, scroll.name); if (i > -1) { Destroy(scroll.gameObject); } } } else { SaveLoadController.ResetValues(); SaveLoadController.Save(); } HealthBar.SetMaxValue(Battle.playerEntity.Stats.MaxHealth); HealthBar.SetCurValue(Battle.playerEntity.CurrentHealth); ExperienceBar.SetMaxValue(Battle.playerEntity.Stats.Experience); ExperienceBar.SetCurValue(Battle.playerEntity.CurrentExperience); LevelLabel.text = "Level " + Battle.playerEntity.Stats.Level; }