Exemplo n.º 1
0
 public override Game BuildGame()
 {
     if (File.Exists(dataContext.path))
     {
         using (Stream FileStream = File.OpenRead(dataContext.path))
         {
             BinaryFormatter deserializer = new BinaryFormatter();
             GameImpl.load((GameImpl)deserializer.Deserialize(FileStream));
         }
     }
     return(GameImpl.INSTANCE);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Loads the given game into the INSTANCE
 /// </summary>
 /// <param name="g">The game to load</param>
 public static void load(GameImpl g)
 {
     GameImpl.INSTANCE.Map            = g.Map;
     GameImpl.INSTANCE.Player1        = g.Player1;
     GameImpl.INSTANCE.Player2        = g.Player2;
     GameImpl.INSTANCE.OpponentPlayer = g.OpponentPlayer;
     GameImpl.INSTANCE.RemainingTurns = g.RemainingTurns;
     GameImpl.INSTANCE.SelectedUnit   = g.SelectedUnit;
     GameImpl.INSTANCE.CurrentPlayer  = g.CurrentPlayer;
     GameImpl.INSTANCE.XSelected      = g.XSelected;
     GameImpl.INSTANCE.YSelected      = g.YSelected;
 }