本文整理汇总了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);
}
示例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);
}