public GamePlayScreen(Game game, GameStateManager manager) : base(game, manager) { if (!(game is MainGame)) throw new Exception("GamePlayScreen constructor: Param 'game' is of type " + game.GetType() + "!"); Log.Info("Setting game world..."); World = ((MainGame) game).World; }
private void LoadMaps() { World = new World(this, ScreenRectangle); if (!Directory.Exists(MapsFolder)) { _log.FatalFormat("ERROR! Maps directory ({0}) not found!", MapsFolder); Environment.Exit(-1); } _log.InfoFormat("Loading maps from {0}...", Path.GetFullPath(MapsFolder)); foreach (var file in Directory.GetFiles(MapsFolder)) { string mapName = Path.GetFileNameWithoutExtension(file); if (string.IsNullOrEmpty(mapName)) continue; _log.InfoFormat("Loading map: {0}", mapName); string contentPath = Path.Combine("Maps", mapName); var map = Content.Load<Map>(contentPath).Convert(); World.CreateLevel(mapName, map); _log.DebugFormat("Map {0} loaded successfully!", mapName); } }