protected override void LoadContent()
{
ContentManager content = Game.Content;
//Loads the gameoptions from last time
GameOptions = Serializing.LoadGameOptions();
ControllerViewManager = new ControllerViewManager(Game.GraphicsDevice, content);
//Adds the sound controller
ControllerViewManager.AddController(soundController);
//Loads and add the fonts to the a list so controllers easily can reach this just by the name of the string
fonts.Add("Impact", content.Load <SpriteFont>("Fonts/Impact"));
fonts.Add("Impact.large", content.Load <SpriteFont>("Fonts/Impact.large"));
//Loads the player controllers from file
List <Player> players = Serializing.LoadPlayerControllers();
// Init each player by creating a gamepadcontroller foreach player
foreach (Player player in players)
{
GamepadController gamepad = new GamepadController(this, player);
gamePads.Add(gamepad);
ControllerViewManager.AddController(gamepad);
}
//Creates the controller for the cursor
cursorsController = new CursorController(this);
ControllerViewManager.AddController(cursorsController);
//Adds the popupmenu to the controllers stack
popupMenuController = new OverlayMenuController(this);
ControllerViewManager.AddController(popupMenuController);
//if startgameplay is true then the game goes straight in to game play
if (Constants.StartGameplay)
{
//Set the right state
gameStateManager.CurrentState = GameState.GamePlay;
var chars = Serializing.LoadCharacters();
var maps = Serializing.LoadMaps();
gamePads[0].PlayerModel.SelectedCharacter = chars[1];
gamePads[0].PlayerModel.CharacterIndex = 0;
gamePads[1].PlayerModel.SelectedCharacter = chars[2];
gamePads[1].PlayerModel.CharacterIndex = 2;
GamePlayController game = new GamePlayController(this, maps[1]);
ControllerViewManager.AddController(game);
}
else
{
gameStateManager.CurrentState = GameState.StartScreen;
this.menu = new MenuController(this);
ControllerViewManager.AddController(menu);
}
}