public BuildView(ContentManager contentManager, SpriteBatch spriteBatch, BuildingListModel buildingListModel, PlayerModel playerModel, PlayerResourcesModel playerResourcesModel) : base(contentManager, spriteBatch) { var buildingTextures = contentManager.Load <Texture2D>("buildings"); var barTexture = contentManager.Load <Texture2D>("resbarbackground"); _buildings = new SpriteSheet(spriteBatch, buildingTextures, 128, 128); _bar = new SpriteSheet(spriteBatch, barTexture, 256, 256); _buildingListModel = buildingListModel; _playerModel = playerModel; _playerResourcesModel = playerResourcesModel; _spriteBatch = spriteBatch; _gameFont = contentManager.Load <SpriteFont>("FontFile"); _gameFontSmall = contentManager.Load <SpriteFont>("font_small"); }
public override void Enter(params object[] args) { _screen = new RenderTarget2D(StateMachine.Game.GraphicsDevice, VirtualScreenSize.Width * VirtualScreenSize.ScreenSizeMultiplier, VirtualScreenSize.Height * VirtualScreenSize.ScreenSizeMultiplier); _spriteBatch = new SpriteBatch(StateMachine.Game.GraphicsDevice); bool resetForNewGame = true; if (args.Length > 0 && args[0] is bool) { resetForNewGame = (bool)args[0]; } // Generate map TerrainFactory.GenerateGrid(); TerrainFactory.GenerateResourceGrid(); // Generate available buildings var buildings = BuildingFactory.GenerateAvailableBuildings(); // Create models _playerModel = new PlayerModel(); _playerResourcesModel = new PlayerResourcesModel(); _terrainTileListModel = new TerrainTileListModel(TerrainFactory.Tiles, TerrainFactory.Resources); _buildingListModel = new BuildingListModel(buildings); // Create and add controllers var playerController = new PlayerController(_playerModel, _terrainTileListModel); var backgroundController = new BackgroundController(_playerModel, _terrainTileListModel, _playerResourcesModel); var buildController = new BuildController(_buildingListModel, _playerModel, _playerResourcesModel); _controllers.Add(playerController); _controllers.Add(backgroundController); _controllers.Add(buildController); // Create and add views _views.Add(new BackgroundView(StateMachine.Game.Content, _spriteBatch, _terrainTileListModel, _playerModel)); _views.Add(new PlayerResourcesView(StateMachine.Game.Content, _spriteBatch, _playerResourcesModel, _playerModel)); _views.Add(new PlayerView(StateMachine.Game.Content, _spriteBatch, _playerModel)); _views.Add(new BuildView(StateMachine.Game.Content, _spriteBatch, _buildingListModel, _playerModel, _playerResourcesModel)); }
public PlayerResourcesView(ContentManager contentManager, SpriteBatch spriteBatch, PlayerResourcesModel playerResourcesModel, PlayerModel playerModel) : base(contentManager, spriteBatch) { _playerResourcesModel = playerResourcesModel; _playerModel = playerModel; var terrainTextures = contentManager.Load <Texture2D>("terrain"); var treeTextures = contentManager.Load <Texture2D>("trees"); var waterTexture = contentManager.Load <Texture2D>("water"); var foodTexture = contentManager.Load <Texture2D>("food"); var mineralTextures = contentManager.Load <Texture2D>("minerals"); var barTexture = contentManager.Load <Texture2D>("resbarbackground"); var popTexture = contentManager.Load <Texture2D>("npc"); _terrain = new SpriteSheet(spriteBatch, terrainTextures, (int)TerrainTileModelSize.Width, (int)TerrainTileModelSize.Height); _food = new SpriteSheet(spriteBatch, foodTexture, (int)ResourceSize.MineralWidth, (int)ResourceSize.MineralHeight); _water = new SpriteSheet(spriteBatch, waterTexture, (int)TerrainTileModelSize.Width, (int)TerrainTileModelSize.Height); _tree = new SpriteSheet(spriteBatch, treeTextures, (int)ResourceSize.TreeWidth, (int)ResourceSize.TreeHeight); _population = new SpriteSheet(spriteBatch, popTexture, 48, 51); _minerals = new SpriteSheet(spriteBatch, mineralTextures, (int)ResourceSize.MineralWidth, (int)ResourceSize.MineralHeight); _bar = new SpriteSheet(spriteBatch, barTexture, 256, 256); _spriteBatch = spriteBatch; _gameFont = contentManager.Load <SpriteFont>("FontFile"); }
public BuildController(BuildingListModel buildingListModel, PlayerModel playerModel, PlayerResourcesModel playerResourcesModel) { _buildingListModel = buildingListModel; _playerModel = playerModel; _playerResourceModel = playerResourcesModel; }
public BackgroundController(PlayerModel playerModel, TerrainTileListModel terrainListModel, PlayerResourcesModel playerResources) { _playerModel = playerModel; _terrainTileListModel = terrainListModel; _playerResourcesModel = playerResources; }