本文整理汇总了C#中InputState.IsButtonPressed方法的典型用法代码示例。如果您正苦于以下问题:C# InputState.IsButtonPressed方法的具体用法?C# InputState.IsButtonPressed怎么用?C# InputState.IsButtonPressed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputState
的用法示例。
在下文中一共展示了InputState.IsButtonPressed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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)
{
if (input.IsNewButtonPress(Buttons.Back)) Back();
if (Movable)
{
#region DPAD CONTROLS
if (input.IsNewButtonTick(Buttons.DPadUp))
{
if (faceSelected)
{
selected.row = Height - 1;
faceSelected = false;
}
else if (selected.row == 0) faceSelected = true;
else selected.row--;
}
if (input.IsNewButtonTick(Buttons.DPadDown))
{
if (faceSelected)
{
selected.row = 0;
faceSelected = false;
}
else if (selected.row < Height - 1) selected.row++;
else faceSelected = true;
}
if (input.IsNewButtonTick(Buttons.DPadLeft) && !faceSelected)
{
if (selected.col == 0) selected.col = Width - 1;
else selected.col--;
}
if (input.IsNewButtonTick(Buttons.DPadRight) && !faceSelected)
{
if (selected.col < Width - 1) selected.col++;
else selected.col = 0;
}
#endregion
if (!faceSelected)
if ((Game.options.FlagWithPlay && input.IsButtonPressed(Buttons.A)) ||
(!Game.options.FlagWithPlay && input.IsButtonPressed(Buttons.B)))
faceValue = Face.Scared;
if (faceValue == Face.Scared)
if ((Game.options.FlagWithPlay && !input.IsButtonPressed(Buttons.A)) ||
(!Game.options.FlagWithPlay && !input.IsButtonPressed(Buttons.B)))
faceValue = Face.Happy;
if (input.IsNewButtonRelease(Buttons.A))
{
if (faceSelected) SetGame(Height, Width, Mines);
else if (Game.options.FlagWithPlay) Click();
else TileFlag();
}
if (input.IsNewButtonRelease(Buttons.B) && !faceSelected)
{
if (Game.options.FlagWithPlay) TileFlag();
else Click();
}
}
else if (input.IsNewButtonRelease(Buttons.A)) SetGame(Height, Width, Mines);
}