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; } }
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); } }
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); } }
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; }