Exemplo n.º 1
0
        public GtGameControllerDouble(GtFileLoader pFileLoader, EnumGameScreen pInitialGameScreen)
            : base(GtGameControllerScreenNavigationTests.Factory, pFileLoader, new SongPlayerDoNothing(), new AudioEffectsDoNothing())
        {
            this.CurrentScreen = pInitialGameScreen;

            if (pInitialGameScreen == EnumGameScreen.Menu)
            {
                this.MenuScreenSelectedItem = EnumMenuScreenItems.QuickPlay;
            }
        }
Exemplo n.º 2
0
        public void NoKeyOrButton_NoScreenChange(EnumGameScreen pGameScreen)
        {
            KeyboardState keyboardState = new KeyboardState();
            GamePadState  gamePadState  = new GamePadState();

            var user1ActionListener = new GtUserActionsListener();

            user1ActionListener.Update(keyboardState, gamePadState);


            using (var gameController = new GtGameControllerDouble(pGameScreen))
            {
                gameController.Update(user1ActionListener);

                Assert.AreEqual(pGameScreen, gameController.CurrentScreen);
            }
        }
Exemplo n.º 3
0
        public void ScreenChangesUsingKeyboard(EnumGameScreen pCurrentScreen, EnumMenuScreenItems pMenuItem,
                                               Keys pKey, EnumGameScreen pExpectedScreen, EnumMenuScreenItems pExpectedMenuItem)
        {
            KeyboardState keyboardState = new KeyboardState(pKey);
            GamePadState  gamePadState  = new GamePadState();

            var user1ActionListener = new GtUserActionsListener();

            user1ActionListener.Update(keyboardState, gamePadState);

            //this update will be called by the XNA Game class.
            using (var gameController = new GtGameControllerDouble(pCurrentScreen, pMenuItem))
            {
                gameController.Update(user1ActionListener);

                Assert.AreEqual(pExpectedScreen, gameController.CurrentScreen);
                Assert.AreEqual(pExpectedMenuItem, gameController.MenuScreenSelectedItem);
            }
        }
Exemplo n.º 4
0
        private void HandleScreenChanges(EnumGameScreen pNewGameScreen)
        {
            if (pNewGameScreen == this.fCurrentGameScreen)
            {
                return;
            }

            switch (pNewGameScreen)
            {
            case EnumGameScreen.Undefined:
                break;

            case EnumGameScreen.Main:
                fCurrentScreen = new GtMainScreen(this);
                break;

            case EnumGameScreen.Menu:
                fCurrentScreen = new GtMenuScreen(this);
                break;

            case EnumGameScreen.Tune:
                fCurrentScreen = new GtTuneScreen(this, this.GameController.TuneController);
                break;

            case EnumGameScreen.ChooseSong:
                fCurrentScreen = new GtChooseSongScreen(this);
                break;

            case EnumGameScreen.PlayingSong:
                fCurrentScreen = new GtPlayingSongScreen(this, this.GameController.GameRoundController);
                break;

            case EnumGameScreen.Quit:
                this.Exit();
                break;

            default:
                throw new Exception("Unexpected pNewGameScreen value.");
            }

            this.fCurrentGameScreen = pNewGameScreen;
        }