예제 #1
0
        public override void HandleInput(InputState input)
        {
            // Move to the previous menu entry?
            if (input.IsMenuUp(ControllingPlayer))
            {
                //selectedEntry--;
                letter++;
                if (selectedEntry < 0)
                    selectedEntry = menuEntries.Count - 1;
            }

            // Move to the next menu entry?
            if (input.IsMenuDown(ControllingPlayer))
            {
                selectedEntry++;

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

            // Accept or cancel the menu? We pass in our ControllingPlayer, which may
            // either be null (to accept input from any player) or a specific index.
            // If we pass a null controlling player, the InputState helper returns to
            // us which player actually provided the input. We pass that through to
            // OnSelectEntry and OnCancel, so they can tell which player triggered them.
            PlayerIndex playerIndex;

            if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
            {
                OnSelectEntry(selectedEntry, playerIndex);
            }
            else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
            {
                OnCancel(playerIndex);
            }
        }
예제 #2
0
 /// <summary>
 /// Allows the screen to handle user input. Unlike Update, this method
 /// is only called when the screen is active, and not when some other
 /// screen has taken the focus.
 /// </summary>
 public virtual void HandleInput(InputState input)
 {
 }
예제 #3
0
 public override void HandleInput(InputState input)
 {
     base.HandleInput(input);
 }
예제 #4
0
파일: Level.cs 프로젝트: JustinLogic/Aero
 public virtual void HandleInput(InputState input)
 {
     //GamePadState gamePadState = GamePad.GetState(PlayerIndex.One);
     #if !XBOX
     //KeyboardState keyboardState = Keyboard.GetState();
     //if (input.IsPauseGame(ControllingPlayer))
     //{
     //    ScreenManager.
     //    ScreenManager.AddScreen(new PauseScreen(game), ControllingPlayer);
     //    paused = true;
     //}
     //else if (shopActive)
     //{
     //    ScreenManager.AddScreen(new LevelTwo(game), ControllingPlayer);
     //    ShopScreen shopScreen = new ShopScreen(player, game);
     //    ScreenManager.AddScreen(shopScreen, ControllingPlayer);
     //    paused = true;
     //    shopActive = false;
     //}
     //if
     //{
     //    paused = false;
     //    if (keyboardState.IsKeyDown(Keys.Up) && !player.Reviving && !paused)
     //    {
     //        player.moveUp();
     //    }
     //    if (keyboardState.IsKeyDown(Keys.Down) && !player.Reviving && !paused)
     //    {
     //        player.moveDown();
     //    }
     //    if (keyboardState.IsKeyDown(Keys.Left) && !player.Reviving && !paused)
     //    {
     //        player.moveLeft();
     //    }
     //    if (keyboardState.IsKeyDown(Keys.Right) && !player.Reviving && !paused)
     //    {
     //        player.moveRight();
     //    }
     //    if (keyboardState.IsKeyDown(Keys.Z) && !paused)
     //    {
     //        if (player.MainWeapon.CoolDown <= 0 && player.Alive)
     //        {
     //            player.MainWeapon.Fire();
     //        }
     //    }
     #endif
 }
예제 #5
0
 public override void HandleInput(InputState input)
 {
     //currentLevel.HandleInput(input);
     levels[level - 1].HandleInput(input);
     GamePadState gamePadState = GamePad.GetState(PlayerIndex.One);
     #if !XBOX
     KeyboardState keyboardState = Keyboard.GetState();
     if (input.IsPauseGame(ControllingPlayer))
     {
         ScreenManager.AddScreen(new PauseScreen(game), ControllingPlayer);
         paused = true;
     }
     else if (shopActive)
     {
         //ScreenManager.AddScreen(new LevelTwo(game), ControllingPlayer);
         ShopScreen shopScreen = new ShopScreen(game);
         //LoadingScreen.Load(ScreenManager, true, e.PlayerIndex,
         //               new TitleScreen(game));
         ScreenManager.AddScreen(shopScreen, ControllingPlayer);
         paused = true;
         shopActive = false;
     }
     else
     {
         paused = false;
         if ((gamePadState.ThumbSticks.Left.X != 0 || gamePadState.ThumbSticks.Left.Y != 0) && !Player.Reviving && !paused)
             Player.move(gamePadState.ThumbSticks.Left.X, gamePadState.ThumbSticks.Left.Y);
         if ((keyboardState.IsKeyDown(Keys.Up) || gamePadState.IsButtonDown(Buttons.DPadUp)) && !Player.Reviving && !paused)
         {
             Player.moveUp();
         }
         if ((keyboardState.IsKeyDown(Keys.Down) || gamePadState.IsButtonDown(Buttons.DPadDown)) && !Player.Reviving && !paused)
         {
             Player.moveDown();
         }
         if ((keyboardState.IsKeyDown(Keys.Left) || gamePadState.IsButtonDown(Buttons.DPadLeft)) && !Player.Reviving && !paused)
         {
             Player.moveLeft();
         }
         if ((keyboardState.IsKeyDown(Keys.Right) || gamePadState.IsButtonDown(Buttons.DPadRight)) && !Player.Reviving && !paused)
         {
             Player.moveRight();
         }
         if ((keyboardState.IsKeyDown(Keys.Z) || gamePadState.IsButtonDown(Buttons.RightTrigger)) && !paused)
         {
             if (Player.PrimaryWeapon.CoolDown <= 0 && Player.Alive)
             {
                 Player.FirePrimary((float)Math.PI/2);
             }
         }
         if ((keyboardState.IsKeyDown(Keys.X) || gamePadState.IsButtonDown(Buttons.LeftTrigger)) && !paused)
         {
             if (Player.SecondaryWeapon.CoolDown >= Player.SecondaryWeapon.CoolDownLimit && Player.Alive)
             {
                 Player.FireSecondary((float)Math.PI / 2);
             }
         }
     }
     #endif
     #if XBOX
     if (input.IsPauseGame(ControllingPlayer))
     {
         ScreenManager.AddScreen(new PauseScreen(game), ControllingPlayer);
         paused = true;
     }
     else if (shopActive)
     {
         //ScreenManager.AddScreen(new LevelTwo(game), ControllingPlayer);
         ShopScreen shopScreen = new ShopScreen(game);
         ScreenManager.AddScreen(shopScreen, ControllingPlayer);
         paused = true;
         shopActive = false;
     }
     else
     {
         paused = false;
         if ((gamePadState.ThumbSticks.Left.X != 0 || gamePadState.ThumbSticks.Left.Y != 0) && !Player.Reviving && !paused)
             Player.move(gamePadState.ThumbSticks.Left.X, gamePadState.ThumbSticks.Left.Y);
         if (gamePadState.IsButtonDown(Buttons.RightTrigger) && !paused)
             if (Player.PrimaryWeapon.CoolDown <= 0 && Player.Alive)
                 Player.FirePrimary((float)Math.PI / 2);
         if (gamePadState.IsButtonDown(Buttons.LeftTrigger) && !paused)
             if (Player.SecondaryWeapon.CoolDown >= Player.SecondaryWeapon.CoolDownLimit && Player.Alive)
                 Player.FireSecondary((float)Math.PI / 2);
     }
     #endif
 }
예제 #6
0
        /// <summary>
        /// Responds to user input, accepting or cancelling the message box.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            PlayerIndex playerIndex;

            // We pass in our ControllingPlayer, which may either be null (to
            // accept input from any player) or a specific index. If we pass a null
            // controlling player, the InputState helper returns to us which player
            // actually provided the input. We pass that through to our Accepted and
            // Cancelled events, so they can tell which player triggered them.
            if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
            {
                // Raise the accepted event, then exit the message box.
                if (Accepted != null)
                    Accepted(this, new PlayerIndexEventArgs(playerIndex));

                ExitScreen();
            }
            else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
            {
                // Raise the cancelled event, then exit the message box.
                if (Cancelled != null)
                    Cancelled(this, new PlayerIndexEventArgs(playerIndex));

                ExitScreen();
            }
        }