public void TestConfigSaveLoad() { GameConfig config = new GameConfig(); config.GameHeight = 600; config.GameWidth = 800; GameConfig.Save(config); GameConfig loaded = GameConfig.Load(); Debug.Assert(loaded.GameWidth == 800 && loaded.GameHeight == 600, "NOT SAVED & LOADED PROPERLY"); }
public Game() { Id = Guid.NewGuid(); Players = new List<Player>(); Logs = new List<string>(); ToBeginRound(); conf = new GameConfig(); //init map cells this.Map = new MapManager(this); this.Map.InitMap(); }
public static void QuitGame() { GameConfig.Save(Config); if (_world != null) { _world.CloseGame(); _world = null; } _canvas = null; Config = null; }
public static void InitGame(Canvas c) { Debug.Assert(_world == null, "World is already created"); _canvas = c; Config = GameConfig.Load(); CreateWorld(); }
public static bool Save(GameConfig config) { XmlSerializer serializer = new XmlSerializer(typeof(GameConfig)); using (Stream s = File.OpenWrite(ConfigFileName)) serializer.Serialize(s, config); return true; }