public override void Activity(bool firstTimeCalled) { Boolean escapeKeyPressed = InputManager.Keyboard.KeyPushed(Keys.Escape); if (escapeKeyPressed) { ScreenChange newEvent = new ScreenChange(GameState.MainMenu); EventBus<ScreenChange>.instance.fireEvent(this, newEvent); } base.Activity(firstTimeCalled); }
/// <summary> /// The main game flow function. Is called whenever a new game screen/state /// is to be displayed/entered. /// </summary> /// <param name="newState">The new game state to enter.</param> /// <param name="chartToUse">The "optional" chart location (is sent null if not used).</param> private void ChangeGameState(object sender, ScreenChange myEvent) { Screen currScreen = ScreenManager.CurrentScreen; GameState newState = myEvent.newState; switch (newState) { case GameState.QuitGame: Exit(); break; case GameState.MainMenu: currScreen.MoveToScreen(typeof(MainMenu).FullName); break; case GameState.Options: currScreen.MoveToScreen(typeof(Options).FullName); break; case GameState.SinglePlayer: //EnterNewGameScreen(new SinglePlayerScreen(this, graphics, chartToUse)); break; case GameState.SongSelection: currScreen.MoveToScreen(typeof(SongSelection).FullName); break; } }