public void LoadSaves() { for (int i = 0; i < SaveDictionary.GetAllSaves().Length; i++) { Instantiate(SavePrefab, transform.position, Quaternion.identity); SavePrefab.GetComponentInChildren <Text>().text = SaveDictionary.GetAllSaves()[i]; } }
private void LoadRaw(string save) { RawData.current = (RawData)SaveDictionary.Load(save, SaveDictionary.RawPreffix); if (RawData.current == null) { return; } LoadGameManager(RawData.current.ManagerData); }
private void AddSaveButton(string name) { GameObject instance = Instantiate(buttonPrefab, saveGrid); instance.GetComponentInChildren <Text>().text = SaveDictionary.GetPrefix(name); instance.GetComponentInChildren <Button>().onClick.AddListener( delegate { LoadSave(name); }); }
public void SaveGame(string save) { string savedFile; SaveActivationDevice(SceneData.current); SaveMovableObjects(SceneData.current); SaveGameManager(RawData.current); SavePlayerData(SceneData.current); savedFile = SaveDictionary.Save(SceneData.current, save, SceneManager.GetActiveScene().name); SaveDictionary.Save(RawData.current, save, SaveDictionary.RawPreffix); Debug.Log(string.Format("Game '{0}' has been saved in file '{1}'.", save, savedFile)); }
private void LoadScene(string save) { SceneData.current = (SceneData)SaveDictionary.Load(save, SceneManager.GetActiveScene().name); if (SceneData.current == null) { return; } LoadPlayerData(SceneData.current.PlayerData); LoadMovableObjects(SceneData.current.MovableData); LoadActivationDevice(SceneData.current.InteractablesData); }
private static void ReadDictionary(string path, string fileName, SaveDictionary function) { if (function != null) { var dictionary = Utils.Dictionary.ReadProfileDictionary(path, fileName, Encoding.Unicode); foreach (var profileDictionary in dictionary) { foreach (string line in profileDictionary.Value) { string value = line.Trim().ToUpper(); function(profileDictionary.Key, value); } } } }
public void LoadGame(string save) { if (!File.Exists(SaveDictionary.GetFullPath(save, SceneManager.GetActiveScene().name))) { return; } else if (GameManager.Instance == null || GameManager.Instance.currentSave == null || string.IsNullOrEmpty(GameManager.Instance.currentSave)) { Debug.Log("An error occured when loading save. Scene Event: " + SceneManager.GetActiveScene().name); return; } LoadRaw(save); LoadScene(save); Debug.Log(string.Format("Game '{0}' successfully loaded !", save)); }
public void LoadSave(string name) { string save = SaveDictionary.GetPrefix(name); string last = SaveDictionary.GetLastScene(name); Debug.Log(string.Format("Loading from Menu to {0}", save)); GameManagement.GameManager.Instance.currentSave = save; if (last == null) { NextLevelButton(1); } else { NextLevelButton(last); } }
private void Start() { string[] saves = SaveDictionary.GetAllSaves(); if (GameManager.Instance) { GameManager.Instance.currentSave = null; } if (saves == null) { return; } foreach (string item in saves) { AddSaveButton(item); } }