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


C# InputAction类代码示例

本文整理汇总了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);
 }
开发者ID:rroveri,项目名称:triolozzi,代码行数:36,代码来源:OptionsMenuScreen.cs

示例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;
         }
     }
 }
开发者ID:foolmoron,项目名称:Retroverse,代码行数:29,代码来源:InventoryScreen.cs

示例3: KeySet

 public KeySet(InputAction Action, KeyCode Key, PressType Press, Action Function)
 {
     this.Action = Action;
     this.Key = Key;
     this.Press = Press;
     this.Function = Function;
 }
开发者ID:JokieW,项目名称:pewpew,代码行数:7,代码来源:InputContext.cs

示例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);
 }
开发者ID:foolmoron,项目名称:Retroverse,代码行数:7,代码来源:History.cs

示例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;
            }
        }
开发者ID:askjervold,项目名称:limak,代码行数:60,代码来源:CharacterInputController.cs

示例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);
        }
开发者ID:rroveri,项目名称:triolozzi,代码行数:34,代码来源:MainMenuScreen.cs

示例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);
 }
开发者ID:samiy-xx,项目名称:keysndr,代码行数:7,代码来源:WebConnectionProvider.cs

示例8: CreditsScreen

 public CreditsScreen()
 {
     backAction = new InputAction(
             new Buttons[] { Buttons.X },
             new Keys[] { Keys.X },
             true);
 }
开发者ID:rroveri,项目名称:triolozzi,代码行数:7,代码来源:CreditsScreen.cs

示例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);
        }
开发者ID:Grahamcraker,项目名称:Project_Greenhorn,代码行数:26,代码来源:MapEditorConfigMenuScreen.cs

示例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;
 }
开发者ID:Jamedjo,项目名称:BeatShift,代码行数:29,代码来源:AnyInputManager.cs

示例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");
 }
开发者ID:scotttorgeson,项目名称:HeroesOfRock,代码行数:7,代码来源:LoadingQB.cs

示例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);
        }
开发者ID:KingpinBen,项目名称:Spin-Doctor,代码行数:33,代码来源:MenuScreen.cs

示例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;
        }
开发者ID:foolmoron,项目名称:Retroverse,代码行数:9,代码来源:RetroPortScreen.cs

示例14: AddAction

 public bool AddAction(String name, InputAction action)
 {
     if (!_actions.ContainsKey (name)) {
                         _actions.Add (name, action);
                         return true;
                 }
                 return false;
 }
开发者ID:CreatureSurvive,项目名称:Hydrogen,代码行数:8,代码来源:Input.cs

示例15: KeySelectMenuEntry

        public KeySelectMenuEntry(EAction action, InputAction defaultKeys)
            : base(action+": ")
        {
            Key = defaultKeys.Keys!=null ? defaultKeys.Keys[0] : Keys.None;

            Action = action;
            _actionName = action.GetDescription();
        }
开发者ID:Bajena,项目名称:Miner,代码行数:8,代码来源:KeySelectMenuEntry.cs


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