// 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))); }