Example #1
0
        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");
        }
Example #2
0
        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();
        }
Example #3
0
        public static void QuitGame()
        {
            GameConfig.Save(Config);

            if (_world != null)
            {
                _world.CloseGame();
                _world = null;
            }
            _canvas = null;
            Config = null;
        }
Example #4
0
 public static void InitGame(Canvas c)
 {
     Debug.Assert(_world == null, "World is already created");
     _canvas = c;
     Config = GameConfig.Load();
     CreateWorld();
 }
Example #5
0
 public static bool Save(GameConfig config)
 {
     XmlSerializer serializer = new XmlSerializer(typeof(GameConfig));
     using (Stream s = File.OpenWrite(ConfigFileName))
         serializer.Serialize(s, config);
     return true;
 }