public Game(Config.Game gameConfig) { _locations = new Dictionary <string, Location>(); _config = gameConfig; foreach (ConsoleWorld.Config.Location loc in _config.Locations) { _locations.Add(loc.Name, new Location(loc)); } }
/// <summary> /// Loads game from config file and returns validation errors /// </summary> /// <param name="file"></param> /// <returns></returns> public void LoadGame(string configFile) { try { // parse config gameConfig = ConsoleWorld.Config.Tools.DeserializeGame(configFile); } catch (Exception e) { Errors.Add(e.Message); } // validate config Errors.AddRange(ConsoleWorld.Config.Tools.ValidateGame(gameConfig)); Errors.ForEach(s => WL(s)); }