public void NameOnEndEdit(string n) { _hs.Name = n; _myTransform.Find("ipName").GetComponent <InputField>().interactable = false; L[_rank - 1] = _hs; GameData.current.HiScores = L; SaveLoadModel.Save(); }
public void SaveRecentlyUsedCharacterModel() { lastUpdate = DateTime.Now; string folderPath = RUSavePath.Substring(0, RUSavePath.LastIndexOf("\\") + 1), fileName = RUSavePath.Substring(RUSavePath.LastIndexOf("\\") + 1); SaveLoadModel.Save(folderPath, fileName, this); }
public void Save() { SaveLoadModel.Save(); UserDataManager.Instance.Data.Coins -= _totalCost; UserDataManager.Instance.SaveToFile(); foreach (iRoadSectn s in Road.Instance.Sectns.Where(s => s.Chargeable == true)) { s.Chargeable = false; } foreach (PlaceableObject Ch in BillOfSceneryMaterials.Items) { Ch.Chargeable = false; } Main.Instance.ShowCoins(); if (MenuItemToSave != null) { MenuItemToSave.EnableSaveButton(false); } Destroy(this.gameObject); }
void SceneChange(Scene OldScene, Scene NewScene) { if (OldScene.name == null) { return; } Debug.Log("Main SceneChange from " + OldScene.name + " to " + NewScene.name); if (NewScene.name == "SceneSelector") { return; } if (NewScene.name == "RaceSelector") { _musicPlayer.Fade(); } int Level = NewScene.buildIndex; if (Level < 6) { return; } if (OnLevelLoaded != null) { OnLevelLoaded(Level); } if (PlayerManager.Type == "CarPlayer") { if (GameLoadedFromFileNeedsDecoding) { SaveLoadModel.DecodeGameScene(); GameLoadedFromFileNeedsDecoding = false; } PopupTip(); StartCoroutine(CreateTrackAndRacers()); } if (PlayerManager.Type == "Replayer") { if (GameLoadedFromFileNeedsDecoding) { SaveLoadModel.DecodeGameScene(); GameLoadedFromFileNeedsDecoding = false; } PopupTip(); StartCoroutine(CreateTrackAndRacers()); } if (PlayerManager.Type == "BuilderPlayer") { if (SelectedGameID == -1) { Game.current = new Game(); GameData.current = new GameData(); GameData.current.Scene = NewScene.name; SaveLoadModel.Save(); SaveLoadModel.LoadTerrainBackup(NewScene.name); TerrainController.Instance.Init(); //Clear all the bez points and add the 2 empty ones. //We need these, because cos although the Constructor calls Init(), its a singleton class so the constructor only gets called at the beginning BezierLine.Instance.Init(); //Clear all the road sections and add the empty Road Section //We need these, because cos although the Constructor calls Init(), its a singleton class so the constructor only gets called at the beginning Road.Instance.Init(); //Clear all the PlaceableObjects Scenery.Instance.RemoveObjects(); } else { SaveLoadModel.LoadGameData(SelectedGameID); if (GameLoadedFromFileNeedsDecoding) { SaveLoadModel.DecodeGameScene(); GameLoadedFromFileNeedsDecoding = false; } } PopupTip(); StartCoroutine(BPMPlayOfflineCoroutine()); } }