public override void HandleInput( InputState input ) { PlayerIndex pi; //Exit if ( input.IsNewButtonPress( Microsoft.Xna.Framework.Input.Buttons.B, null, out pi ) ) { ExitScreen(); } if ( input.IsNewButtonPress( Buttons.Y, null, out pi ) ) { ScreenManager.AddScreen( faqScreen, null ); } //Control which filter type is being used if ( input.IsNewButtonPress( Buttons.X, null, out pi ) ) { leaderBoardTypeIndex++; if ( leaderBoardTypeIndex >= leaderBoardTypes.Count ) leaderBoardTypeIndex = 0; } //Control the scores that are shown on the screen if ( input.IsMenuDown( null ) ) scoreDisplayStartIndex++; if ( input.IsMenuUp( null ) ) scoreDisplayStartIndex--; if ( input.IsNewButtonPress( Buttons.LeftTrigger, null, out pi ) ) scoreDisplayStartIndex -= scoresDisplayedPerPage; if ( input.IsNewButtonPress( Buttons.RightTrigger, null, out pi ) ) scoreDisplayStartIndex += scoresDisplayedPerPage; scoreDisplayStartIndex = (int)MathHelper.Clamp( scoreDisplayStartIndex, 0, scoreCount - scoresDisplayedPerPage ); base.HandleInput( input ); }
/// <summary> /// Responds to user input, changing the selected entry and accepting /// or cancelling the menu. /// </summary> public override void HandleInput( InputState input ) { ReadOnlyCollection<MenuEntry> menuEntries = MenuEntries; ReadOnlyCollection<ImageMenuEntry> imageMenuEntries = ImageMenuEntries; PlayerIndex playerIndex; // If there is a wheel menu, handle left and right input if ( menuItems.AllObjectsList.Exists( item => item is WheelMenu ) ) { WheelMenu wheel = menuItems.GetObjects<WheelMenu>()[0]; if ( wheel.AcceptingInput ) { if ( input.IsMenuLeft( ControllingPlayer ) ) wheel.RotateCW(); if ( input.IsMenuRight( ControllingPlayer ) ) wheel.RotateCCW(); } } else if ( imageMenuEntries != null && imageMenuEntries.Count != 0 ) { // Move to the previous menu entry? if ( input.IsMenuUp( ControllingPlayer ) ) { imageMenuEntries[selectedEntry--].Focused = false; if ( selectedEntry < 0 ) selectedEntry = imageMenuEntries.Count - 1; imageMenuEntries[selectedEntry].Focused = true; GameCore.Instance.AudioManager.Play2DCue( "whoosh", 1f ); } // Move to the next menu entry? if ( input.IsMenuDown( ControllingPlayer ) ) { imageMenuEntries[selectedEntry++].Focused = false; if ( selectedEntry >= imageMenuEntries.Count ) selectedEntry = 0; imageMenuEntries[selectedEntry].Focused = true; GameCore.Instance.AudioManager.Play2DCue( "whoosh", 1f ); } } else if ( menuEntries != null && menuEntries.Count != 0 ) { // Move to the previous menu entry? if ( input.IsMenuUp( ControllingPlayer ) ) { menuEntries[selectedEntry--].Focused = false; if ( selectedEntry < 0 ) selectedEntry = menuEntries.Count - 1; menuEntries[selectedEntry].Focused = true; GameCore.Instance.AudioManager.Play2DCue( "whoosh", 1f ); } // Move to the next menu entry? if ( input.IsMenuDown( ControllingPlayer ) ) { menuEntries[selectedEntry++].Focused = false; if ( selectedEntry >= menuEntries.Count ) selectedEntry = 0; menuEntries[selectedEntry].Focused = true; GameCore.Instance.AudioManager.Play2DCue( "whoosh", 1f ); } } if ( input.IsMenuSelect( ControllingPlayer, out playerIndex ) ) OnSelectEntry( playerIndex ); else if ( input.IsMenuRight( ControllingPlayer, out playerIndex ) ) OnIncrementEntry( playerIndex ); else if ( input.IsMenuLeft( ControllingPlayer, out playerIndex ) ) OnDecrementEntry( playerIndex ); else if ( input.IsMenuCancel( ControllingPlayer, out playerIndex ) ) OnCancel( playerIndex ); }