public void saveClick() { Game.gameState.setSaveTime(DateTime.Now); SavedGameController.saveGame(Game.gameState, saveName.text); Debug.Log("Saved Game!"); saveGameContainer.gameObject.SetActive(false); }
public void listGame(FileInfo file) { GameState gameState = SavedGameController.loadGame(file.FullName); GameObject listing = Instantiate(gameDetailsPrefab, gameContainer); SaveGameDetails details = listing.GetComponent <SaveGameDetails>(); details.init(file.Name.Substring(0, file.Name.Length - 6), gameState); }
private void Awake() { if (SavedGameController.instance != null) { Destroy(this.gameObject); } else { instance = this; } }
// Should be called once before public static void PREGAMEupdateGameState(GameState gs) { if (PV != null && PV.IsMine) { Debug.Log(Game.myPlayer.getNetworkID() + " ~ Updating GameState..."); PV.RPC("PREGAMEupdateGameState", RpcTarget.AllBuffered, SavedGameController.serializeGameState(gs)); } else { Debug.Log(Game.myPlayer.getNetworkID() + " ~ Could not access PhotoView"); } }
public static void saveGame(GameState gs, string saveName) { Debug.Log("Saving Game..."); string path = Application.persistentDataPath + "/" + saveName + ".andor"; Debug.Log("Under path: " + path); //Debug.Log(JSONGameState(gs)); string saveData = SavedGameController.serializeGameState(gs); Debug.Log(saveData); File.WriteAllText(path, saveData); /*using (StreamWriter file = File.CreateText(path)) * { * //JsonSerializer serializer = new JsonSerializer(); * //serialize object directly into file stream * //serializer.Serialize(file, _data); * }*/ }
public GameState DeepCopy() { return(SavedGameController.deserializeGameState(SavedGameController.serializeGameState(this))); }