本文整理汇总了C#中Input.Enter方法的典型用法代码示例。如果您正苦于以下问题:C# Input.Enter方法的具体用法?C# Input.Enter怎么用?C# Input.Enter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input.Enter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public override void Update(GameTime gameTime, Input input)
{
soundSelect = TurkeySmashGame.content.Load<SoundEffect>("Sons\\menuSelect");
SoundEffectInstance instanceSelect = soundSelect.CreateInstance();
instanceSelect.Volume = 0.3f;
instanceSelect.Pan = -0.9f;
instanceSelect.Pitch = 0.9f;
KeyboardState newStateK = Keyboard.GetState();
GamePadState newStateG = GamePad.GetState(PlayerIndex.One);
if ((oldStateK.IsKeyUp(Keys.Down) && newStateK.IsKeyDown(Keys.Down))
|| (oldStateG.DPad.Down == ButtonState.Released && newStateG.DPad.Down == ButtonState.Pressed))
{
selecty++;
instanceSelect.Play();
}
if (oldStateK.IsKeyUp(Keys.Up) && newStateK.IsKeyDown(Keys.Up)
|| (oldStateG.DPad.Up == ButtonState.Released && newStateG.DPad.Up == ButtonState.Pressed))
{
selecty--;
instanceSelect.Play();
}
if (selecty > boutons.Count)
selecty = 1;
if (selecty < 1)
selecty = boutons.Count;
foreach (IBouton bouton in boutons)
{
bouton.Etat = false;
}
boutons[selecty - 1].Etat = true;
if (input.Enter() || GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed)
{
Thread.Sleep(200);
soundEnter = TurkeySmashGame.content.Load<SoundEffect>("Sons\\latch_1");
SoundEffectInstance instanceEnter = soundEnter.CreateInstance();
instanceEnter.Volume = 0.2f;
instanceEnter.Play();
switch (selecty)
{
case 1:
Bouton1();
break;
case 2:
Bouton2();
break;
case 3:
Bouton3();
break;
case 4:
Bouton4();
break;
}
}
oldStateK = newStateK;
oldStateG = newStateG;
}