public override void Update(Microsoft.Xna.Framework.GameTime gameTime, KeyboardHelper keyboard) { bool enterPressed = keyboard.KeyPressedOnce(Keys.Enter); if (enterPressed && _player1Name.Text.Length > 0 && _player2Name.Text.Length > 0) { Global.Player1Name = _player1Name.Text; Global.Player2Name = _player2Name.Text; this.NextScreen(); return; } bool switchFocus = keyboard.KeyPressedOnce(Keys.Tab) || enterPressed; if (switchFocus) { if (_player1Name.HasFocus) { _player1Name.RemoveFocus(); _player2Name.SetFocus(); } else if (_player2Name.HasFocus) { _player2Name.RemoveFocus(); _player1Name.SetFocus(); } } _player1Name.Update(gameTime, keyboard); _player2Name.Update(gameTime, keyboard); }
public override void Update(GameTime gameTime, KeyboardHelper keyboard) { if (keyboard.KeyPressedOnce(Keys.D1)) _p1Score++; if (keyboard.KeyPressedOnce(Keys.D2)) _p2Score++; }
public override void Update(Microsoft.Xna.Framework.GameTime gameTime, KeyboardHelper keyboard) { if (keyboard.KeyPressedOnce(Keys.Enter)) this.NextScreen(); }