Exemplo n.º 1
0
        public override void Update( GameTime gameTime, bool otherScreenHasFocus,
            bool coveredByOtherScreen)
        {
            base.Update( gameTime, otherScreenHasFocus, coveredByOtherScreen );

              if ( otherScreensAreGone )
              {
            if ( backgroundThread != null )
            {
              loadStartTime = gameTime;
              backgroundThread.Start();
            }

            ScreenManager.RemoveScreen( this );

            foreach ( GameScreen screen in screensToLoad )
            {
              if ( screen != null )
              {
            ScreenManager.AddScreen( screen, ControllingPlayer );
              }
            }

            if ( backgroundThread != null )
            {
              doneLoading = true;
              InputState input = new InputState();
              PlayerIndex actingPlayer;

              do {
            input.Update();
              } while ( !input.IsNewButtonPress( Buttons.Start, null, out actingPlayer ) &&
                    !input.IsNewButtonPress( Buttons.A, null, out actingPlayer ) );

              backgroundThreadExit.Set();
              backgroundThread.Join();

              if ( GameplayScreen.Instance.BackgroundMusic == null )
              {
            ScreenManager.MenuTrack.Pause();
            GameplayScreen.Instance.BackgroundMusic = GameCore.Instance.AudioManager.Play2DCue( "banjoBreakdown",
                                                                        GameCore.Instance.MusicVolume );
            GameplayScreen.Instance.BackgroundMusic.Pause();
            GameCore.Instance.MusicVolumeChanged += GameplayScreen.Instance.ChangeMusicVolume;
              }
            }

            ScreenManager.Game.ResetElapsedTime();
              }
        }
Exemplo n.º 2
0
        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 );
        }
Exemplo n.º 3
0
        private void GetPlayerInput( PlayerIndex playerIndex, InputState input, out PlayerInput playerInput )
        {
            if ( playerIndex < PlayerIndex.One )
              {
            playerAI.GetInput( out playerInput );
              }
              else
              {
            playerInput.ButtonAHit = input.IsNewButtonPress( Buttons.A, playerIndex, out playerIndex );
            playerInput.ButtonBHit = input.IsNewButtonPress( Buttons.B, playerIndex, out playerIndex );
            playerInput.ButtonXHit = input.IsNewButtonPress( Buttons.X, playerIndex, out playerIndex );
            playerInput.ButtonYHit = input.IsNewButtonPress( Buttons.Y, playerIndex, out playerIndex );
            playerInput.ButtonADown = input.CurrentGamePadStates[(int)playerIndex].IsButtonDown( Buttons.A );
            playerInput.ButtonBDown = input.CurrentGamePadStates[(int)playerIndex].IsButtonDown( Buttons.B );
            if ( !playerInput.ButtonBDown )
              playerInput.ButtonBDown = input.CurrentGamePadStates[(int)playerIndex].IsButtonDown( Buttons.X );

            GamePadState gamePadState = input.CurrentGamePadStates[(int)playerIndex];

            playerInput.LeftTrigger = gamePadState.Triggers.Left;
            playerInput.RightTrigger = gamePadState.Triggers.Right;
            playerInput.LeftBumper = gamePadState.IsButtonDown( Buttons.LeftShoulder );
            playerInput.RightBumper = gamePadState.IsButtonDown( Buttons.RightShoulder );
            playerInput.LeftStick = gamePadState.ThumbSticks.Left;
            playerInput.LeftDpad = gamePadState.DPad.Left == ButtonState.Pressed;
            playerInput.RightDpad = gamePadState.DPad.Right == ButtonState.Pressed;
            playerInput.DownDpad = gamePadState.DPad.Down == ButtonState.Pressed;
              }
        }