private void UpdateSplash(KeyboardState kState, GamePadState gState, GameTime gameTime) { if (kState.IsKeyPressed(_oldKeyState, Keys.Enter, Keys.Space, Keys.Escape, Keys.D0, Keys.D1, Keys.D2, Keys.D3, Keys.D4, Keys.D5, Keys.D6, Keys.D7) || gState.IsButtonPressed(_oldGamePadState, Buttons.Start)) { _displayMode = DisplayModeEnum.GameStart; _splashInterval = new TimeSpan(Game.GameSpeedScaleFactor*40); } _splashInterval = _splashInterval - gameTime.ElapsedGameTime; if (_splashInterval.Ticks < 0) { _backColor = (_backColor == BackColorEnum.White ? BackColorEnum.Black : BackColorEnum.White); _splashInterval = new TimeSpan(Game.GameSpeedScaleFactor*20); } }
private void UpdateGameStart(KeyboardState kState, GamePadState gState, GameTime gameTime) { if (kState.IsKeyPressed(_oldKeyState, Keys.Enter, Keys.Space, Keys.D0, Keys.D1, Keys.D2, Keys.D3, Keys.D4, Keys.D5, Keys.D6, Keys.D7, Keys.D8, Keys.D9) || gState.IsButtonPressed(_oldGamePadState, Buttons.Start)) { _displayMode = DisplayModeEnum.Splash; string value = Encoding.UTF8.GetString(new[] {(byte) kState.GetPressedKeys()[0]}, 0, 1); int newRange; int range = int.TryParse(value, out newRange) ? newRange : Game.Range; if (OnPlayingStarted != null) { Game.BackColor = _backColor; OnPlayingStarted(this, new PlayingStartedEventArgs { Range = range }); } return; } _splashInterval = _splashInterval - gameTime.ElapsedGameTime; if (_splashInterval.Ticks < 0) { _displayMode = DisplayModeEnum.Splash; } }