From 8de5fe65151e11e754f030163fd2f9ed98b96080 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sun, 2 May 2021 10:43:41 +0800 Subject: [PATCH] flutter: Do not add difficulty level if level is 20 --- src/ui/flutter_app/lib/widgets/game_page.dart | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/ui/flutter_app/lib/widgets/game_page.dart b/src/ui/flutter_app/lib/widgets/game_page.dart index a28284f4..aef9da55 100644 --- a/src/ui/flutter_app/lib/widgets/game_page.dart +++ b/src/ui/flutter_app/lib/widgets/game_page.dart @@ -556,6 +556,17 @@ class _GamePageState extends State with RouteAware { if (result == GameResult.win && Game.instance.engineType == EngineType.humanVsAi) { + bool isTopLevel = (Config.skillLevel == 20); // TODO: 20 + var contentStr = getGameOverReasonString( + Game.instance.position.gameOverReason, Game.instance.position.winner); + + if (!isTopLevel) { + contentStr += "\n\n" + + S.of(context).challengeHarderLevel + + (Config.skillLevel + 1).toString() + + "!"; + } + showDialog( context: context, barrierDismissible: true, @@ -563,17 +574,12 @@ class _GamePageState extends State with RouteAware { return AlertDialog( title: Text(dialogTitle, style: TextStyle(color: AppTheme.dialogTitleColor)), - content: Text(getGameOverReasonString( - Game.instance.position.gameOverReason, - Game.instance.position.winner) + - S.of(context).challengeHarderLevel + - (Config.skillLevel + 1).toString() + - "!"), + content: Text(contentStr), actions: [ TextButton( child: Text(S.of(context).yes), onPressed: () { - Config.skillLevel++; + if (!isTopLevel) Config.skillLevel++; Config.save(); Navigator.of(context).pop(); }),