private void SpinButton_Click(object sender, RoutedEventArgs e)
{
if (!isGameActive)
{
MessageBox.Show("Игра окончена! Начните новую игру.",
"Внимание",
MessageBoxButton.OK,
MessageBoxImage.Information);
return;
}
if (isSpinning)
{
MessageBox.Show("Барабан уже крутится!",
"Внимание",
MessageBoxButton.OK,
MessageBoxImage.Information);
return;
}
Task task = RotateBaraban();
}
private void GuessButton_Click(object sender, RoutedEventArgs e)
{
if (!isGameActive) return;
string guess = WordTextBox.Text.ToUpper().Trim();
if (string.IsNullOrEmpty(guess))
{
MessageBox.Show("Введите слово!",
"Ошибка",
MessageBoxButton.OK,
MessageBoxImage.Warning);
return;
}
if (guess == currentQuestion.Word)
{
currentScore += currentQuestion.Prize;
UpdateScore();
MessageBox.Show($"Поздравляем! Вы угадали слово!\n" +
$"Вы заработали {currentQuestion.Prize} очков!",
"Победа!",
MessageBoxButton.OK,
MessageBoxImage.Information);
WinGame();
}
else
{
remainingAttempts--;
UpdateAttempts();
MessageBox.Show($"Неверно! Загаданное слово - '{currentQuestion.Word}'",
"Ошибка!",
MessageBoxButton.OK,
MessageBoxImage.Error);
if (remainingAttempts <= 0)
{
LoseGame();
}
else
{
isGameActive = false;
EnableKeyboard(false);
MessageBox.Show("Игра окончена! Начните новую игру.",
"Конец игры",
MessageBoxButton.OK,
MessageBoxImage.Information);
}
}
}