Esempio n. 1
0
        public MasterController()
        {
            IsMouseVisible = true;
            _graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            _graphics.IsFullScreen = false;
            _graphics.PreferredBackBufferHeight = ViewportHeight;
            _graphics.PreferredBackBufferWidth = ViewportWidth;
            _levelController = new LevelController(ViewportWidth, ViewportHeight, GraphicsDevice, Content);

            _levelController.IsActive = false;

            _mainMenuController = new MainMenuController(ViewportWidth, ViewportHeight, GraphicsDevice, Content);
            _mainMenuController.IsActive = false;
            _pauseMenuController = new PauseMenuController(ViewportWidth, ViewportHeight, GraphicsDevice, Content);
            _pauseMenuController.IsActive = false;
            _gameOverMenuController = new GameOverMenuController(ViewportWidth, ViewportHeight, GraphicsDevice, Content);
            _gameOverMenuController.IsActive = false;
            _helpController = new HelpController(ViewportWidth, ViewportHeight, GraphicsDevice, Content);
            _helpController.IsActive = true;

            _lastController = _mainMenuController;
            _mainMenuController.StartGame += StartGame;
            _mainMenuController.ExitGame += (sender, args) => { this.Exit(); };
            _mainMenuController.ShowHelp += (sender, args) => ShowHelp(sender);

            _pauseMenuController.ExitGame += (sender, args) => { this.Exit(); };
            _pauseMenuController.RestartGame += StartGame;
            _pauseMenuController.ResumeGame += ResumeGame;
            _pauseMenuController.ShowHelp += (sender, args) => ShowHelp(sender);
            _pauseMenuController.MainMenuActivated += (sender, args) => ShowMainMenu((ControllerBase) sender);

            _gameOverMenuController.ExitGame += (sender, args) => { this.Exit(); };
            _gameOverMenuController.RestartGame += RestartGame;
            _gameOverMenuController.ContinueGame += ContinueGame;
            _gameOverMenuController.ShowHelp += (sender, args) => ShowHelp(sender);
            _gameOverMenuController.MainMenuActivated += (sender, args) => ShowMainMenu((ControllerBase)sender);

            _levelController.PauseGame += (sender, args) => ShowPauseMenu();
            _levelController.LevelFinished += (sender, args) => FinishLevel(args);

            _helpController.GoBack += (sender, eventArgs) => GoBackFromHelp();
        }
Esempio n. 2
0
 private void ShowMainMenu(ControllerBase sender)
 {
     sender.IsActive = false;
     _lastController = sender;
     _mainMenuController.IsActive = true;
 }
Esempio n. 3
0
 private void ShowHelp(object sender)
 {
     var sourceController = (ControllerBase) sender;
     sourceController.IsActive = false;
     _lastController = sourceController;
     _helpController.IsActive = true;
 }