• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# InputAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中InputAction的典型用法代码示例。如果您正苦于以下问题:C# InputAction类的具体用法?C# InputAction怎么用?C# InputAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InputAction类属于命名空间,在下文中一共展示了InputAction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Character

        private Tile _StartTile; //the inital starting tile

        #endregion Fields

        #region Constructors

        static Character()
        {
            up = InputAction.UP;
            down = InputAction.DOWN;
            left = InputAction.LEFT;
            right = InputAction.RIGHT;
            zoom = InputAction.RCLICK;
        }
开发者ID:CaKlassen,项目名称:Titanium,代码行数:14,代码来源:Character.cs


示例17: GameplayScreen

        public GameplayScreen()
        {
            TransitionOnTime = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            pauseAction = new InputAction(
                new Buttons[] { Buttons.Start, Buttons.Back },
                true);
        }
开发者ID:igorkiss,项目名称:MonoSnake,代码行数:9,代码来源:GameplayScreen.cs


示例18: onInputChange

        protected override void onInputChange(InputAction inputAction, bool state)
        {
            if (state && playerIndex == PlayerIndex.One)
                {
                    switch (inputAction)
                    {
                        case InputAction.A:
                            gameState.APressed();
                            break;
                        case InputAction.B:
                            gameState.BPressed();
                            break;
                        case InputAction.DOWN:
                            gameState.updateButtonChangeState(State.ButtonDown);
                            break;
                        case InputAction.UP:
                            gameState.updateButtonChangeState(State.ButtonUp);
                            break;
                        case InputAction.LEFT:
                            gameState.LeftPressed();
                            break;
                        case InputAction.RIGHT:
                            gameState.RightPressed();
                            break;

                        default:
                            break;
                    }
                }
                else if (state && playerIndex == PlayerIndex.Two)
                {
                    switch (inputAction)
                    {
                        case InputAction.A:
                            gameState.APressed2();
                            break;
                        case InputAction.B:
                            gameState.BPressed();
                            break;
                        case InputAction.DOWN:
                            gameState.updateButtonChangeState(State.ButtonDown);
                            break;
                        case InputAction.UP:
                            gameState.updateButtonChangeState(State.ButtonUp);
                            break;
                        case InputAction.LEFT:
                            gameState.LeftPressed2();
                            break;
                        case InputAction.RIGHT:
                            gameState.RightPressed2();
                            break;

                        default:
                            break;
                    }
                }
        }
开发者ID:askjervold,项目名称:limak,代码行数:57,代码来源:MenuInputController.cs


示例19: Activate

 public override void Activate(InputAction activationAction)
 {
     if (bombTimer >= BombInterval && RetroGame.AvailableBombs > 0)
     {
         bombs.Add(new Bomb(this, hero.position, "bombtimed", EXPLOSION_TIME, ExplosionRadius));
         bombTimer = 0;
         RetroGame.RemoveBomb();
     }
 }
开发者ID:foolmoron,项目名称:Retroverse,代码行数:9,代码来源:BombTimed.cs


示例20: PhoneMenuScreen

        public PhoneMenuScreen(string title)
        {
            menuTitle = title;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            menuCancel = new InputAction(new Buttons[] { Buttons.Back }, true);
        }
开发者ID:igorkiss,项目名称:MonoSnake,代码行数:9,代码来源:PhoneMenuScreen.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# InputArray类代码示例发布时间:2022-05-24
下一篇:
C# Input类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap