diff --git a/android/gradle.properties b/android/gradle.properties index 33c43775a7db70e59256cad64931ad4fc01c2c7c..5a36ab8c92338284725018aa8f109700499c74fd 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true -app.versionName=1.0.23 -app.versionCode=24 +app.versionName=1.0.24 +app.versionCode=25 diff --git a/fastlane/metadata/android/en-US/changelogs/25.txt b/fastlane/metadata/android/en-US/changelogs/25.txt new file mode 100644 index 0000000000000000000000000000000000000000..51d986d7383f3a3dd94a73043e3c7e6dda1fe709 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/25.txt @@ -0,0 +1 @@ +Add "guesses count" indicator. diff --git a/fastlane/metadata/android/fr-FR/changelogs/25.txt b/fastlane/metadata/android/fr-FR/changelogs/25.txt new file mode 100644 index 0000000000000000000000000000000000000000..3404cfe70055f60779c7f0e02101d58b7f996ca9 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/25.txt @@ -0,0 +1 @@ +Ajout d'un compteur de coups. diff --git a/lib/cubit/game_cubit.dart b/lib/cubit/game_cubit.dart index e4f60ed5399037e02571f5239b45f59f29dc377d..6a43fa8aab2fa4d857c6429c030376e05e06f3b6 100644 --- a/lib/cubit/game_cubit.dart +++ b/lib/cubit/game_cubit.dart @@ -36,7 +36,7 @@ class GameCubit extends HydratedCubit<GameState> { // Base data board: state.currentGame.board, // Game data - movesCount: state.currentGame.movesCount, + guessesCount: state.currentGame.guessesCount, pairsFound: state.currentGame.pairsFound, ); game.dump(); @@ -130,6 +130,9 @@ class GameCubit extends HydratedCubit<GameState> { } } + state.currentGame.guessesCount++; + refresh(); + // timer + check pair + unselect Timer(const Duration(seconds: 2), () { if (hasSameValue) { @@ -137,12 +140,11 @@ class GameCubit extends HydratedCubit<GameState> { final int itemValue = state.currentGame.board.tiles[selectedTilesIndexes[0]].value; state.currentGame.pairsFound.add(itemValue); + refresh(); } - state.currentGame.movesCount++; - refresh(); - state.currentGame.isFinished = state.currentGame.gameWon; + refresh(); unselectAllTiles(); allowInteractions(true); diff --git a/lib/models/game/game.dart b/lib/models/game/game.dart index 0261c2787eac141949c7b568c5fa6cacc3958444..2cd02fc84a4ab25c46f410423cdccaa901f9b625 100644 --- a/lib/models/game/game.dart +++ b/lib/models/game/game.dart @@ -28,7 +28,7 @@ class Game { required this.board, // Game data - required this.movesCount, + required this.guessesCount, required this.pairsFound, }); @@ -47,7 +47,7 @@ class Game { final Board board; // Game data - int movesCount; + int guessesCount; List<int> pairsFound = []; factory Game.createNull() { @@ -58,7 +58,7 @@ class Game { // Base data board: Board.createNull(), // Game data - movesCount: 0, + guessesCount: 0, pairsFound: [], ); } @@ -83,7 +83,7 @@ class Game { // Base data board: board, // Game data - movesCount: 0, + guessesCount: 0, pairsFound: [], ); } @@ -111,7 +111,7 @@ class Game { printlog(' Base data'); board.dump(); printlog(' Game data'); - printlog(' movesCount: $movesCount'); + printlog(' guessesCount: $guessesCount'); printlog(' pairsFound: $pairsFound'); printlog(''); } @@ -135,7 +135,7 @@ class Game { // Base data 'board': board.toJson(), // Game data - 'movesCount': movesCount, + 'guessesCount': guessesCount, 'pairsFound': pairsFound, }; } diff --git a/lib/ui/widgets/game/game_top.dart b/lib/ui/widgets/game/game_top.dart index 4520997c3ff6a687353fb12ed280e8f109ee8fad..8d1e9379a8a2954307899b552878f1c60fe2fe2c 100644 --- a/lib/ui/widgets/game/game_top.dart +++ b/lib/ui/widgets/game/game_top.dart @@ -13,7 +13,14 @@ class GameTopWidget extends StatelessWidget { builder: (BuildContext context, GameState gameState) { final Game currentGame = gameState.currentGame; - return const Text(''); + return Text( + currentGame.guessesCount.toString(), + style: TextStyle( + fontSize: 40, + fontWeight: FontWeight.bold, + color: Theme.of(context).colorScheme.primary, + ), + ); }, ); } diff --git a/pubspec.yaml b/pubspec.yaml index d6e42a29505067f911131b7cd301a00078abc8d9..5aed35a13cc8474182bc2cc56401d612449f9afc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A simple and classic memory game. publish_to: "none" -version: 1.0.23+24 +version: 1.0.24+25 environment: sdk: "^3.0.0"