//ќбработка нажатий на клавиши void KeyboardHandle() { KeyboardState kbState = Keyboard.GetState(); interval++; if (interval >= 5) { interval = 0; if (menuScreen.Enabled) { if (kbState.IsKeyDown(Keys.Up)) { currentMenuItem--; if (currentMenuItem < 1) { currentMenuItem = 3; } menuScreen.GetKey(currentMenuItem); } if (kbState.IsKeyDown(Keys.Down)) { currentMenuItem++; if (currentMenuItem > 3) { currentMenuItem = 1; } menuScreen.GetKey(currentMenuItem); } if (kbState.IsKeyDown(Keys.Enter)) { switch (currentMenuItem) { case 1: menuScreen.Hide(); GameState.StartNewGame(); gameScreen.Show(); break; case 2: menuScreen.Hide(); helpScreen.Show(); break; case 3: Exit(); break; } } } if (gamePauseScreen.Enabled) { if (kbState.IsKeyDown(Keys.Up)) { currentMenuItem--; if (currentMenuItem < 1) { currentMenuItem = 2; } gamePauseScreen.GetKey(currentMenuItem); } if (kbState.IsKeyDown(Keys.Down)) { currentMenuItem++; if (currentMenuItem > 2) { currentMenuItem = 1; } gamePauseScreen.GetKey(currentMenuItem); } if (kbState.IsKeyDown(Keys.Enter)) { switch (currentMenuItem) { case 1: GameState.IsPaused = false; gamePauseScreen.Hide(); break; case 2: GameState.IsPaused = false; gamePauseScreen.Hide(); gameScreen.Hide(); menuScreen.Show(); currentMenuItem = 1; break; } } } if (gameRestartScreen.Enabled) { GameState.ShowMenu = false; if (kbState.IsKeyDown(Keys.Up)) { currentMenuItem--; if (currentMenuItem < 1) { currentMenuItem = 2; } gameRestartScreen.GetKey(currentMenuItem); } if (kbState.IsKeyDown(Keys.Down)) { currentMenuItem++; if (currentMenuItem > 2) { currentMenuItem = 1; } gameRestartScreen.GetKey(currentMenuItem); } if (kbState.IsKeyDown(Keys.Enter)) { switch (currentMenuItem) { case 1: GameState.IsPaused = false; gameRestartScreen.Hide(); GameState.StartNewGame(); break; case 2: GameState.IsPaused = false; gameRestartScreen.Hide(); gameScreen.Hide(); menuScreen.Show(); currentMenuItem = 1; break; } } } } if (helpScreen.Enabled) { if (kbState.IsKeyDown(Keys.Escape)) { helpScreen.Hide(); menuScreen.Show(); } } if (gameScreen.Enabled) { if (kbState.IsKeyDown(Keys.Escape)) { GameState.IsPaused = true; gamePauseScreen.Show(); currentMenuItem = 1; } if (GameState.ShowMenu) { GameState.IsPaused = true; gameRestartScreen.Show(); currentMenuItem = 1; } } }