Ejemplo n.º 1
0
        public override void HandleInput(InputState input)
        {
            if (input.IsMenuUp(PlayerIndex.One))
            {
                selectedEntry--;

                if (selectedEntry < 0)
                    selectedEntry = menuEntries.Count - 1;
            }

            if (input.IsMenuDown(PlayerIndex.One))
            {
                selectedEntry++;

                if (selectedEntry >= menuEntries.Count)
                    selectedEntry = 0;
            }

            PlayerIndex playerIndex;

            if (input.IsMenuSelect(PlayerIndex.One, out playerIndex))
            {
                OnSelectEntry(selectedEntry, playerIndex);
            }
            else if (input.IsMenuCancel(PlayerIndex.One, out playerIndex))
            {
                OnCancel(playerIndex);
            }
        }
 public override void HandleInput(InputState input)
 {
     if (input.CurrentGamePadStates[(int)gamerOne.PlayerIndex].Buttons.A == ButtonState.Pressed && input.PreviousGamePadStates[(int)gamerOne.PlayerIndex].Buttons.A == ButtonState.Released)
     {
         LoadingScreen.Load(ScreenManager, true, gamerOne.PlayerIndex, new LevelOne(gamerOne));
     }
 }
Ejemplo n.º 3
0
        public override void HandleInput(InputState input)
        {
            for (int i = 0; i < InputState.MaxInputs; i++)
            {
                if (input.CurrentGamePadStates[i].Buttons.A == ButtonState.Pressed && input.PreviousGamePadStates[i].Buttons.A == ButtonState.Released ||
                    input.CurrentGamePadStates[i].Buttons.Start == ButtonState.Pressed && input.PreviousGamePadStates[i].Buttons.Start == ButtonState.Released)
                {

                    skipToMenu = true;

                    if (player != null && !player.IsDisposed)
                    {
                        player.Dispose();
                    }
                }
            }

            base.HandleInput(input);
        }
        public override void HandleInput(InputState input)
        {
            PlayerIndex playerIndex;
            if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
            {

                if (Accepted != null)
                    Accepted(this, new PlayerIndexEventArgs(playerIndex));

                ExitScreen();
            }
            else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
            {
                if (Cancelled != null)
                    Cancelled(this, new PlayerIndexEventArgs(playerIndex));

                ExitScreen();
            }
        }
Ejemplo n.º 5
0
        public override void HandleInput(InputState input)
        {
            if (!gamerSelected)
            {
                for (int i = 0; i < InputState.MaxInputs; i++)
                {
                    if (input.CurrentGamePadStates[i].IsButtonDown(Buttons.Start) == true && input.PreviousGamePadStates[i].IsButtonUp(Buttons.Start) == true)
                    {
                        gamerOne = Gamer.SignedInGamers[(PlayerIndex)i];

                        gamerSelected = true;

                        if (gamerOne == null)
                        {
                            if (!Guide.IsVisible)
                            {
                                Guide.ShowSignIn(1, false);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Check for input
        /// </summary>
        /// <param name="input">grabs the values from InputState</param>
        public override void HandleInput(InputState input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            //did you disconnect? //Switch this to two players if we want both players to be able to pause
            #region IsPlayerControllerDisconnectedOrOutOfBatteries?

            KeyboardState keyboardState = input.CurrentKeyboardStates[(int)gamerOne.PlayerIndex];
            GamePadState gamePadState = input.CurrentGamePadStates[(int)gamerOne.PlayerIndex];

            bool playerOneGamePadDisconnected = !gamePadState.IsConnected &&
                                        input.GamePadWasConnected[(int)gamerOne.PlayerIndex];

            //...if so then pause and wait
            if (input.IsPauseGame(gamerOne.PlayerIndex) || playerOneGamePadDisconnected)
            {

                ScreenManager.AddScreen(new PauseMenuScreen(), gamerOne.PlayerIndex);

            }

            #endregion

            //the left stick and some movement accerlation are used to make the player move left and right
            player.velocity.X = input.CurrentGamePadStates[(int)gamerOne.PlayerIndex].ThumbSticks.Left.X * movementAcceleration;

            //if we press and hold A then velocity is applied, or its just 0
            if (input.CurrentGamePadStates[(int)gamerOne.PlayerIndex].Buttons.A == ButtonState.Pressed)
            {
                player.velocity.Y = -5.0f;
            }
            else
            {
                player.velocity.Y = 0.0f;
            }
            //this happens if we press and let go of the Y button
            if (input.CurrentGamePadStates[(int)gamerOne.PlayerIndex].Buttons.Y == ButtonState.Pressed && input.PreviousGamePadStates[(int)gamerOne.PlayerIndex].Buttons.Y == ButtonState.Released)
            {

            }
        }
Ejemplo n.º 7
0
        public override void HandleInput(InputState input)
        {
            //This needs to be check for values in whichOne and allowContinue because for some reason the menutemplate is not what it's suppossed to be.
            //The menu template should have a blocked out continue and the menu should not allow for continue selection if there was nothing loaded

            if (input.CurrentGamePadStates[(int)gamerOne.PlayerIndex].IsButtonDown(Buttons.DPadDown) == true && input.PreviousGamePadStates[(int)gamerOne.PlayerIndex].IsButtonUp(Buttons.DPadDown) == true ||
                input.CurrentGamePadStates[(int)gamerOne.PlayerIndex].IsButtonDown(Buttons.LeftThumbstickDown) == true && input.PreviousGamePadStates[(int)gamerOne.PlayerIndex].IsButtonUp(Buttons.LeftThumbstickDown) == true)
            {
                if (whichOne == 0)
                {
                    menuOption++;
                    menuSelectPosition += new Vector2(0, 180);

                    if (menuOption > MenuOption.Credits)
                    {
                        menuOption = 0;
                        menuSelectPosition = new Vector2(100.0f);
                    }
                }
                else
                {
                    if (allowContinue)
                    {
                        startOption++;
                        menuSelectPosition += new Vector2(0, 180);

                        if (startOption > StartOption.Continue)
                        {
                            startOption = 0;
                            menuSelectPosition = new Vector2(100.0f);
                        }
                    }
                }
            }
            if (input.CurrentGamePadStates[(int)gamerOne.PlayerIndex].IsButtonDown(Buttons.DPadUp) == true && input.PreviousGamePadStates[(int)gamerOne.PlayerIndex].IsButtonUp(Buttons.DPadUp) == true ||
                input.CurrentGamePadStates[(int)gamerOne.PlayerIndex].IsButtonDown(Buttons.LeftThumbstickUp) == true && input.PreviousGamePadStates[(int)gamerOne.PlayerIndex].IsButtonUp(Buttons.LeftThumbstickUp) == true)
            {
                if (whichOne == 0)
                {
                    menuOption--;
                    menuSelectPosition -= new Vector2(0, 180);

                    if (menuOption < 0)
                    {
                        menuOption = MenuOption.Credits;
                        menuSelectPosition = new Vector2(0, 540);
                    }
                }
                else
                {
                    if (allowContinue)
                    {
                        startOption--;
                        menuSelectPosition -= new Vector2(0, 180);

                        if (startOption < 0)
                        {
                            startOption = StartOption.Continue;
                            menuSelectPosition = new Vector2(0, 540);
                        }
                    }
                }

            }
            if (input.CurrentGamePadStates[(int)gamerOne.PlayerIndex].IsButtonDown(Buttons.A) == true && input.PreviousGamePadStates[(int)gamerOne.PlayerIndex].IsButtonUp(Buttons.A) == true)
            {
                if (whichOne == 0)
                {
                    if (menuOption == MenuOption.Start)
                    {

                        //LoadingScreen.Load(ScreenManager, false, ControllingPlayer, new DifferentMenuScreen());
                        //reset the position of the rectangle
                        menuSelectPosition = new Vector2(100.0f);

                        //which menuTemplate to use
                        whichOne++;
                        if (allowContinue)
                        {
                            whichOne++;
                        }
                        return;
                    }

                    else if (menuOption == MenuOption.Gallery)
                    {

                        //TODO:
                    }
                    else if (menuOption == MenuOption.Credits)
                    {
                        //TODO:
                    }
                }
                if (whichOne == 1)
                {
                    if (startOption == StartOption.NewGame)
                    {
                        GamePlayScreen.storageDevice = storageDevice;

                        LoadingScreen.Load(ScreenManager, true, gamerOne.PlayerIndex, new LevelOne(gamerOne));
                        //load up a new game

                    }

                    if (startOption == StartOption.Continue)
                    {
                        if (gamerOne != null)
                        {
                            gameLoadRequested = true;
                            resultCheck = StorageDevice.BeginShowSelector(gamerOne.PlayerIndex, null, null);
                        }

                    }
                }

            }
        }
Ejemplo n.º 8
0
 public virtual void HandleInput(InputState input)
 {
 }