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


C# Framework.KeyPressed方法代码示例

本文整理汇总了C#中Framework.KeyPressed方法的典型用法代码示例。如果您正苦于以下问题:C# Framework.KeyPressed方法的具体用法?C# Framework.KeyPressed怎么用?C# Framework.KeyPressed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Framework的用法示例。


在下文中一共展示了Framework.KeyPressed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleInput

 public override void HandleInput(Microsoft.Xna.Framework.GameTime gameTime, Framework.CInput _Input)
 {
     if (_Input.KeyPressed(Microsoft.Xna.Framework.Input.Keys.Space) || j < 0)
     {
         //CResourceManager.GetInstance().GetSoundEffect(IDResource.SFX_INTRO).Dispose();
         MediaPlayer.Stop();
         StateManager.getInst().ExitScreen();
         StateManager.getInst().AddScreen(new MenuState(IDGameState.MENU));
     }
     base.HandleInput(gameTime, _Input);
 }
开发者ID:nghuuhieu1994,项目名称:etn-contra-game,代码行数:11,代码来源:IntroState.cs

示例2: HandleInput

        public override void HandleInput(Microsoft.Xna.Framework.GameTime gameTime, Framework.CInput _Input)
        {
            #region Move icon
            if (CResourceManager.GetInstance().GetResource(IDResource.ICON).Position.Y >= 120 &&
                CResourceManager.GetInstance().GetResource(IDResource.ICON).Position.Y <= 180)
            {
                if (_Input.KeyPressed(Microsoft.Xna.Framework.Input.Keys.Down))
                {
                    SoundManager.PlaySound(ESound.SFX_COIN);
                    if (CResourceManager.GetInstance().GetResource(IDResource.ICON).Position.Y == 180)
                        CResourceManager.GetInstance().GetResource(IDResource.ICON).Position = new Vector2(110, 120);
                    else
                    {
                        CResourceManager.GetInstance().GetResource(IDResource.ICON).Position =
                            new Vector2(CResourceManager.GetInstance().GetResource(IDResource.ICON).Position.X,
                                        CResourceManager.GetInstance().GetResource(IDResource.ICON).Position.Y + 30);
                    }
                }
                if (_Input.KeyPressed(Microsoft.Xna.Framework.Input.Keys.Up))
                {
                    SoundManager.PlaySound(ESound.SFX_COIN);
                    if (CResourceManager.GetInstance().GetResource(IDResource.ICON).Position.Y == 120)
                        CResourceManager.GetInstance().GetResource(IDResource.ICON).Position = new Vector2(110, 180);
                    else
                    {
                        CResourceManager.GetInstance().GetResource(IDResource.ICON).Position =
                            new Vector2(CResourceManager.GetInstance().GetResource(IDResource.ICON).Position.X,
                                        CResourceManager.GetInstance().GetResource(IDResource.ICON).Position.Y - 30);
                    }
                }
            }
            #endregion

            #region BtnStatuts
            if (_Input.KeyPressed(Microsoft.Xna.Framework.Input.Keys.Enter) ||
                _Input.KeyPressed(Microsoft.Xna.Framework.Input.Keys.Space))
            {
                if (CResourceManager.GetInstance().GetResource(IDResource.ICON).Position.Y == 120)
                {
                    GlobalSetting.IsSoundEffect = !GlobalSetting.IsSoundEffect;
                }
                if (CResourceManager.GetInstance().GetResource(IDResource.ICON).Position.Y == 150)
                {
                    GlobalSetting.IsSoundBG = !GlobalSetting.IsSoundBG;
                    SoundManager.MuteSong();
                }
                if (CResourceManager.GetInstance().GetResource(IDResource.ICON).Position.Y == 180)
                {
                    StateManager.getInst().ExitScreen();
                    StateManager.getInst().AddScreen(new MenuState(IDGameState.MENU));
                }
            }

            if (CResourceManager.GetInstance().GetResource(IDResource.ICON).Position.Y == 180)
            {
                ListButtons[2].Focus = true;
            }
            else
                ListButtons[2].Focus = false;

            if (GlobalSetting.IsSoundEffect)
                ListButtons[0].Focus = true;
            else
                ListButtons[0].Focus = false;
            if (GlobalSetting.IsSoundBG)
                ListButtons[1].Focus = true;
            else
                ListButtons[1].Focus = false;
            #endregion

            base.HandleInput(gameTime, _Input);
        }
开发者ID:nghuuhieu1994,项目名称:etn-contra-game,代码行数:72,代码来源:OptionState.cs


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