mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-17 06:52:23 +00:00
2048: Simplify dialog box when target reached
Previously, upon reaching the target, the player is presented with potentially two dialog boxes: one asking if the user wants to continue endlessly and another showing the player's statistics, which would only be shown if the user does not want to continue. This commit consolidates these into a single dialog box that shows the relevant statistics and asks the user if they want to continue endlessly.
This commit is contained in:
parent
0fda98dfb3
commit
fe3bd062b7
Notes:
sideshowbarker
2024-07-19 17:11:02 +09:00
Author: https://github.com/dykatz
Commit: fe3bd062b7
Pull-request: https://github.com/SerenityOS/serenity/pull/11781
Reviewed-by: https://github.com/bgianfo ✅
1 changed files with 5 additions and 9 deletions
|
@ -141,19 +141,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
break;
|
break;
|
||||||
case Game::MoveOutcome::Won: {
|
case Game::MoveOutcome::Won: {
|
||||||
update();
|
update();
|
||||||
auto message_box = GUI::MessageBox::construct(window, "Congratulations! You won the game, Do you still want to continue?",
|
auto want_to_continue = GUI::MessageBox::show(window,
|
||||||
"Want to continue?",
|
String::formatted("You won the game in {} turns with a score of {}. Would you like to continue?", game.turns(), game.score()),
|
||||||
|
"Congratulations!",
|
||||||
GUI::MessageBox::Type::Question,
|
GUI::MessageBox::Type::Question,
|
||||||
GUI::MessageBox::InputType::YesNo);
|
GUI::MessageBox::InputType::YesNo);
|
||||||
if (message_box->exec() == GUI::MessageBox::ExecYes)
|
if (want_to_continue == GUI::MessageBox::ExecYes)
|
||||||
game.set_want_to_continue();
|
game.set_want_to_continue();
|
||||||
else {
|
else
|
||||||
GUI::MessageBox::show(window,
|
|
||||||
String::formatted("You reached {} in {} turns with a score of {}", game.largest_tile(), game.turns(), game.score()),
|
|
||||||
"You won!",
|
|
||||||
GUI::MessageBox::Type::Information);
|
|
||||||
start_a_new_game();
|
start_a_new_game();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Game::MoveOutcome::GameOver:
|
case Game::MoveOutcome::GameOver:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue