当前位置: 首页>>代码示例>>C#>>正文


C# InputState.IsNewGamePadButtonPress方法代码示例

本文整理汇总了C#中GameStateManagement.InputState.IsNewGamePadButtonPress方法的典型用法代码示例。如果您正苦于以下问题:C# InputState.IsNewGamePadButtonPress方法的具体用法?C# InputState.IsNewGamePadButtonPress怎么用?C# InputState.IsNewGamePadButtonPress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameStateManagement.InputState的用法示例。


在下文中一共展示了InputState.IsNewGamePadButtonPress方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleGamePadInput

 public override void HandleGamePadInput(InputState input)
 {
     if (input.GamePadWasConnected)
     {
         PlayerIndex player;
         if (input.IsNewGamePadButtonPress(Buttons.Back, out player) || input.IsNewGamePadButtonPress(Buttons.B, out player))
         {
             OnCancel(player);
         }
         else if (input.IsNewGamePadButtonPress(Buttons.Start, out player) || input.IsNewGamePadButtonPress(Buttons.A, out player))
         {
             OnSelectEntry(selectedEntry, PlayerIndex.One);
         }
         else if (input.IsNewGamePadButtonPress(Buttons.LeftThumbstickUp, out player) || input.IsNewGamePadButtonPress(Buttons.DPadUp, out player))
         {
             if (selectedEntry > 0)
                 selectedEntry--;
         }
         else if (input.IsNewGamePadButtonPress(Buttons.LeftThumbstickDown, out player) || input.IsNewGamePadButtonPress(Buttons.DPadDown, out player))
         {
             if (selectedEntry < menuEntries.Count - 1)
                 selectedEntry++;
         }
     }
 }
开发者ID:VoronFX,项目名称:SummerPractice,代码行数:25,代码来源:MenuScreen.cs

示例2: HandleInput

        /// <summary>
        /// Input helper method provided by GameScreen.  Packages up the various /// input values for ease of use.
        /// </summary>
        /// <param name="input">The state of the gamepads</param>
        public override void HandleInput(InputState input)
        {
            PlayerIndex player;

            if (input == null)
                throw new ArgumentNullException("input");

            if (input.IsNewKeyPress(Keys.F12, out player))
            {
                if (!Windows.UI.ViewManagement.ApplicationView
                        .GetForCurrentView().IsFullScreen)
                    Windows.UI.ViewManagement.ApplicationView
                        .GetForCurrentView().TryEnterFullScreenMode();
                else
                    Windows.UI.ViewManagement.ApplicationView
                        .GetForCurrentView().ExitFullScreenMode();
            }

            if (gameOver)
            {
                if (input.IsPauseGame())
                {
                    FinishCurrentGame();
                }

                if (input.IsNewKeyPress(Keys.Space, out player)
                    || input.IsNewKeyPress(Keys.Enter, out player))
                {
                    FinishCurrentGame();
                }

                if (input.IsNewGamePadButtonPress(Buttons.A, out player)
                    || input.IsNewGamePadButtonPress(Buttons.Start, out player))
                {
                    FinishCurrentGame();
                }

                if (input.IsNewMouseButtonPress(MouseButtons.LeftButton,
                                                out player))
                {
                    FinishCurrentGame();
                }

                foreach (GestureSample gestureSample in input.Gestures)
                {
                    if (gestureSample.GestureType == GestureType.Tap)
                    {
                        FinishCurrentGame();
                    }
                }

                return;
            }
        }
开发者ID:VoronFX,项目名称:SummerPractice,代码行数:58,代码来源:GameplayScreenBattle.cs


注:本文中的GameStateManagement.InputState.IsNewGamePadButtonPress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。