本文整理汇总了C#中InputAction类的典型用法代码示例。如果您正苦于以下问题:C# InputAction类的具体用法?C# InputAction怎么用?C# InputAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InputAction类属于命名空间,在下文中一共展示了InputAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OptionsMenuScreen
/// <summary>
/// Constructor.
/// </summary>
public OptionsMenuScreen()
{
LeftPad = new InputAction(
new Buttons[] { Buttons.DPadLeft, Buttons.LeftThumbstickLeft },
new Keys[] { Keys.Left },
true
);
RightPad = new InputAction(
new Buttons[] { Buttons.DPadRight, Buttons.LeftThumbstickRight },
new Keys[] { Keys.Right },
true
);
UpPad = new InputAction(
new Buttons[] { Buttons.DPadUp, Buttons.LeftThumbstickUp },
new Keys[] { Keys.Up },
true);
DownPad = new InputAction(
new Buttons[] { Buttons.DPadDown, Buttons.LeftThumbstickDown },
new Keys[] { Keys.Down },
true);
BackAction = new InputAction(
new Buttons[] { Buttons.X, Buttons.Back },
new Keys[] { Keys.X, Keys.Escape },
true);
SelectAction = new InputAction(
new Buttons[] { Buttons.A },
new Keys[] { Keys.A },
true);
UndoAction = new InputAction(
new Buttons[] { Buttons.B },
new Keys[] { Keys.B },
true);
}
示例2: OnInputAction
public override void OnInputAction(InputAction action, bool pressedThisFrame)
{
if (pressedThisFrame)
{
switch (action)
{
case InputAction.Up:
case InputAction.Down:
case InputAction.Left:
case InputAction.Right:
Inventory.UpdateCursorPosition(currentPlayerControls, action);
break;
case InputAction.Start:
case InputAction.Escape:
if (currentPlayerControls == activePlayerIndex)
{
SoundManager.PlaySoundOnce("ButtonBack");
RetroGame.PopScreen();
}
break;
case InputAction.Action1:
Inventory.SelectWithCursor(currentPlayerControls);
break;
case InputAction.Action2:
Inventory.GoBack(currentPlayerControls, currentPlayerControls == activePlayerIndex);
break;
}
}
}
示例3: KeySet
public KeySet(InputAction Action, KeyCode Key, PressType Press, Action Function)
{
this.Action = Action;
this.Key = Key;
this.Press = Press;
this.Function = Function;
}
示例4: ActivateRevert
public static void ActivateRevert(Hero controllingHero, InputAction cancelAction)
{
LastState = RetroGame.State;
RetroGame.AddScreen(new RetroPortScreen(controllingHero, cancelAction), true);
SoundManager.SetMusicReverse(true);
SoundManager.SetLoopingSoundsReverse(true);
}
示例5: onInputChange
protected override void onInputChange(InputAction inputAction, bool state)
{
if(this.character == null) {
// No use in doing anything!
return;
}
CharacterInputAction action = (CharacterInputAction)inputAction;
switch(action)
{
case CharacterInputAction.WALK_LEFT:
case CharacterInputAction.WALK_RIGHT:
CharacterInputAction mirrorAction;
GameObjectDirection direction;
GameObjectDirection mirrorDirection;
if(action == CharacterInputAction.WALK_LEFT)
{
direction = GameObjectDirection.LEFT;
mirrorDirection = GameObjectDirection.RIGHT;
mirrorAction = CharacterInputAction.WALK_RIGHT;
} else
{
direction = GameObjectDirection.RIGHT;
mirrorDirection = GameObjectDirection.LEFT;
mirrorAction = CharacterInputAction.WALK_LEFT;
}
if (state)
{
// Walk key was pressed, start walking in that direction
this.character.Direction = direction;
this.character.Action = GameObjectAction.WALK;
}
else
{
// Walk key unpressed
if(!this.keyStates[(int)mirrorAction]) {
// The other walk key is not pressed either, we can stop walking
this.character.Action = GameObjectAction.STAND;
}
else
{
// The other walk key is down, we need to continue walking but change direction
this.character.Direction = mirrorDirection;
}
}
break;
case CharacterInputAction.JUMP:
if(state) {
this.character.Jump();
}
break;
default:
break;
}
}
示例6: MainMenuScreen
/// <summary>
/// Constructor fills in the menu contents.
/// </summary>
public MainMenuScreen()
: base("")
{
exitAction = new InputAction(
new Buttons[] { Buttons.X, Buttons.Back },
new Keys[] { Keys.Escape, Keys.X },
true);
optionsMenuEntry = new MenuEntry(_newGameTextures, _newGameSelectedTextures);
optionsMenuEntry.Selected += OptionsMenuEntrySelected;
MenuEntries.Add(optionsMenuEntry);
playersMenuEntry = new MenuEntry(_playersTextures, _playersSelectedTextures);
playersMenuEntry.LeftClick += PlayersMenuEntryDecrement;
playersMenuEntry.RightClick += PlayersMenuEntryIncrement;
MenuEntries.Add(playersMenuEntry);
resolutionMenuEntry = new MenuEntry(_resolutionTextures, _resolutionSelectedTextures);
resolutionMenuEntry.LeftClick += ResolutionMenuEntryDecrement;
resolutionMenuEntry.RightClick += ResolutionMenuEntryIncrement;
MenuEntries.Add(resolutionMenuEntry);
creditsMenuEntry = new MenuEntry(_creditsTextures, _creditsSelectedTextures);
creditsMenuEntry.Selected += CreditsMenuEntrySelected;
MenuEntries.Add(creditsMenuEntry);
_exitButton = GameServices.GetService<ContentManager>().Load<Texture2D>("Images/MainMenu/exit_menu");
_exitButtonPosition = new Vector2(100, 850);
GameServices.GetService<SoundManager>().PlaySong(SoundManager.MenuSong, true);
}
示例7: ExecuteAction
public async Task<ApiResult<Object>> ExecuteAction(InputAction action)
{
var result = await httpClient.PostAsync(Execute,
new StringContent(JsonSerializer.Serialize(action), Encoding.UTF8, "application/json"));
var content = await result.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<ApiResult<Object>>(content);
}
示例8: CreditsScreen
public CreditsScreen()
{
backAction = new InputAction(
new Buttons[] { Buttons.X },
new Keys[] { Keys.X },
true);
}
示例9: MapEditorConfigMenuScreen
public MapEditorConfigMenuScreen()
: base("Map Editor Config")
{
verticalNodeCount = 3;
horizontalNodeCount = 3;
// Configure Increase/Decrease count actions
increaseCountAction = new InputAction(new Keys[] { Keys.Right }, true);
decreaseCountAction = new InputAction(new Keys[] { Keys.Left }, true);
// Add Menu Items
MenuItem verticalNodesMenuItem = new MenuItem("Vertical Nodes: 3");
MenuItem horizontalNodesMenuItem = new MenuItem("Horizontal Nodes: 3");
MenuItem confirmMenuItem = new MenuItem("Confirm");
MenuItem cancelMenuItem = new MenuItem("Cancel");
// Hook up events
confirmMenuItem.Selected += confirmMenuItem_Selected;
cancelMenuItem.Selected += cancelMenuItem_Selected;
// Add menu Items
MenuItems.Add(verticalNodesMenuItem);
MenuItems.Add(horizontalNodesMenuItem);
MenuItems.Add(confirmMenuItem);
MenuItems.Add(cancelMenuItem);
}
示例10:
Boolean IInputManager.actionTapped(InputAction action)
{
if(keyInput.actionTapped(action))
{
lastControllerTapped = ControllerType.Keyboard;
return true;
}
if(padOneInput.actionTapped(action))
{
lastControllerTapped = ControllerType.PadOne;
return true;
}
if(padTwoInput.actionTapped(action))
{
lastControllerTapped = ControllerType.PadTwo;
return true;
}
if(padThreeInput.actionTapped(action))
{
lastControllerTapped = ControllerType.PadThree;
return true;
}
if(padFourInput.actionTapped(action))
{
lastControllerTapped = ControllerType.PadFour;
return true;
}
return false;
}
示例11: LoadContent
public override void LoadContent()
{
spriteFont = Stage.Content.Load<Microsoft.Xna.Framework.Graphics.SpriteFont>("DefaultFont");
textBackground = Stage.Content.Load<Texture2D>("UI/Menu/blank");
ControlsQB cqb = Stage.ActiveStage.GetQB<ControlsQB>();
finishLoad = cqb.GetInputAction("FinishLoad");
}
示例12: MenuScreen
public MenuScreen(string menuTitle)
{
this.menuTitle = menuTitle;
this._titleFont = FontManager.Instance.GetFont(FontList.MenuTitle);
TransitionOnTime = TimeSpan.FromSeconds(0.5);
TransitionOffTime = TimeSpan.FromSeconds(0.5);
menuUp = new InputAction(
new Buttons[] { Buttons.DPadUp, Buttons.LeftThumbstickUp },
new Keys[] { Keys.Up },
true);
menuDown = new InputAction(
new Buttons[] { Buttons.DPadDown, Buttons.LeftThumbstickDown },
new Keys[] { Keys.Down },
true);
menuLeft = new InputAction(
new Buttons[] { Buttons.DPadLeft, Buttons.LeftThumbstickLeft },
new Keys[] { Keys.Left },
true);
menuRight = new InputAction(
new Buttons[] { Buttons.DPadRight, Buttons.LeftThumbstickRight },
new Keys[] { Keys.Right },
true);
menuSelect = new InputAction(
new Buttons[] { Buttons.A, Buttons.Start },
new Keys[] { Keys.Enter, Keys.Space },
true);
menuCancel = new InputAction(
new Buttons[] { Buttons.B, Buttons.Back },
new Keys[] { Keys.Escape },
true);
}
示例13: RetroPortScreen
//dummy screen that doesn't draw anything, just waits for a cancel action and disables all other input
public RetroPortScreen(Hero controllingHero, InputAction cancelAction)
{
DrawPreviousScreen = true;
bindings = controllingHero.bindings;
this.controllingHero = controllingHero;
this.cancelAction = cancelAction;
}
示例14: AddAction
public bool AddAction(String name, InputAction action)
{
if (!_actions.ContainsKey (name)) {
_actions.Add (name, action);
return true;
}
return false;
}
示例15: KeySelectMenuEntry
public KeySelectMenuEntry(EAction action, InputAction defaultKeys)
: base(action+": ")
{
Key = defaultKeys.Keys!=null ? defaultKeys.Keys[0] : Keys.None;
Action = action;
_actionName = action.GetDescription();
}