Ejemplo n.º 1
0
    // 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");
        }
    }
Ejemplo n.º 2
0
    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);
         * }*/
    }
Ejemplo n.º 3
0
 public GameState DeepCopy()
 {
     return(SavedGameController.deserializeGameState(SavedGameController.serializeGameState(this)));
 }