本文整理汇总了C#中GameStateManagement.InputState.IsSelect方法的典型用法代码示例。如果您正苦于以下问题:C# InputState.IsSelect方法的具体用法?C# InputState.IsSelect怎么用?C# InputState.IsSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameStateManagement.InputState
的用法示例。
在下文中一共展示了InputState.IsSelect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleInput
/// <summary>
/// Responds to user input, changing the selected entry and accepting
/// or cancelling the menu.
/// </summary>
public override void HandleInput(InputState input)
{
// Move to the previous menu entry?
if (input.IsMenuUp(ControllingPlayer))
{
selectedEntry--;
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.IsSelect(ControllingPlayer, out playerIndex))
{
OnSelectEntry(selectedEntry, playerIndex);
}
else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
{
OnCancel(playerIndex);
}
}
示例2: HandleGameplayInputButtons
private bool HandleGameplayInputButtons(InputState input, Player cP)
{
PlayerIndex output;
if (input.IsSelect(cP.PI, out output))
{
if (cP.selected == false && cP.hover.getOwner() == cP && cP.hover.canAddMove())
{
cP.selected = true;
cP.origin = cP.hover;
}
else if (cP.selected == true)
{
cP.selected = false;
if (cP.target == Player.Tgt.Self && cP.hover != cP.origin && cP.origin.canAddMove())
{
//cP.origin.transfer(cP.dest);
cP.dest = cP.hover;
movements.Add(new Movement(cP, cP.origin, cP.dest, Movement.Type.Transfer));
}
if (cP.target == Player.Tgt.Enemy && cP.origin.canAddMove())
{
//cP.origin.attack(cP.dest);
cP.dest = cP.hover;
movements.Add(new Movement(cP, cP.origin, cP.dest, Movement.Type.Attack));
}
}
}
else if (input.IsMenuCancel(cP.PI, out output))
{
if (cP.selected == true)
{
cP.selected = false;
}
else
{
cP.hover.cancelOutgoing = true;
pruneMovements();
}
}
else if (input.IsScrollLeft(cP.PI))
{
cP.decPower();
}
else if (input.IsScrollRight(cP.PI))
{
cP.incPower();
}
else if (input.IsUsePower(cP.PI))
{
if (cP.usePower())
{
if (cP.curPower == Player.Power.Transfer)
transfer(cP);
else if (cP.curPower == Player.Power.Reinforce)
reinforce(cP);
else if (cP.curPower == Player.Power.Invincible)
invincible(cP);
else if (cP.curPower == Player.Power.Defect)
defect(cP, cP.hover);
}
}
else
{
return false;
}
return true;
}
示例3: HandlePlacementInputButtons
private bool HandlePlacementInputButtons(InputState input, Player cP)
{
PlayerIndex output;
if (cP == curPlayer && cP.hover.getOwner() == noone && input.IsSelect(cP.PI, out output))
{
cP.hover.setOwner(cP);
int newIdx = (players.IndexOf(curPlayer) + 1)%players.Count;
curPlayer = players[newIdx];
if (--toPlace <= 0)
{
curGameState = GameState.Countdown;
countdownTime = COUNTDOWN_LENGTH;
}
//Console.Out.WriteLine(toPlace);
pruneMovements();
selectCountry.Play();
}
else
{
return false;
}
return true;
}
示例4: HandleInput
/// <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.IsSelect(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();
}
}