diff --git a/android/gradle.properties b/android/gradle.properties index 6c1d873456149a8611e43a05ae56e4f50c73274f..24add27a90a4accaf6a1ee28ec651d0d6bda4f8e 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=0.0.19 -app.versionCode=19 +app.versionName=0.0.20 +app.versionCode=20 diff --git a/fastlane/metadata/android/en-US/changelogs/20.txt b/fastlane/metadata/android/en-US/changelogs/20.txt new file mode 100644 index 0000000000000000000000000000000000000000..e7ad04f60adce5f4e5d1682c4dd504a764e66478 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/20.txt @@ -0,0 +1 @@ +Add initial tip, repeat found letters on new guess diff --git a/fastlane/metadata/android/fr-FR/changelogs/20.txt b/fastlane/metadata/android/fr-FR/changelogs/20.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef2973dc98fe73bbe34e61deebb7b7bcb752a919 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/20.txt @@ -0,0 +1 @@ +Propose la première lettre et répète les lettres trouvées à chaque nouvelle ligne diff --git a/lib/layout/board.dart b/lib/layout/board.dart index 82313c546afaf1e7ff6f4fdc054f860e054fb7af..5be81f4c7d9f0a0beb4e558740de3e4f339e917d 100644 --- a/lib/layout/board.dart +++ b/lib/layout/board.dart @@ -10,7 +10,8 @@ class Board { int maxGuessesCount = myProvider.maxGuessesCount; int wordLength = int.parse(myProvider.length); - Widget buildCellWidget(String cellValue, String cellTip, bool hasFocus) { + Widget buildCellWidget( + String cellValue, String cellTip, bool hasFocus, String foundLetter) { Color textColor = Colors.white; Color focusBorderColor = Colors.yellow.shade700; Color defaultBorderColor = Colors.white; @@ -20,6 +21,11 @@ class Board { cellImage = cellTip; } + if ((foundLetter != ' ') && (cellValue == ' ')) { + cellValue = foundLetter; + cellImage = 'good'; + } + Image imageWidget = Image( image: AssetImage('assets/skins/' + skin + '_' + cellImage + '.png'), fit: BoxFit.fill, @@ -84,7 +90,13 @@ class Board { (lineIndex == guesses.length) && (colIndex == word.length); - tableCells.add(TableCell(child: buildCellWidget(cellValue, cellTip, hasFocus))); + String foundLetter = ((!myProvider.gameWon) && (lineIndex == guesses.length)) + ? myProvider.foundLetters.substring(colIndex, colIndex + 1) + : ' '; + + tableCells.add(TableCell( + child: buildCellWidget(cellValue, cellTip, hasFocus, foundLetter), + )); } tableRows.add(TableRow(children: tableCells)); diff --git a/lib/provider/data.dart b/lib/provider/data.dart index eb2462f83d91abceba2abce8a74d6f7df5346f29..6086912031fa366e88accbac4da60cbef247e8eb 100644 --- a/lib/provider/data.dart +++ b/lib/provider/data.dart @@ -31,6 +31,7 @@ class Data extends ChangeNotifier { List _recentWords = []; List<String> _guesses = []; String _currentGuess = ''; + String _foundLetters = ''; int _maxGuessesCount = 7; String get lang => _lang; @@ -100,6 +101,16 @@ class Data extends ChangeNotifier { _currentGuess = ''; } + String get foundLetters => _foundLetters; + void initFoundLetters() { + _foundLetters = _word.substring(0, 1).padRight(_word.length, ' '); + } + + void addFoundLetter(String letter, int i) { + _foundLetters = _foundLetters.substring(0, i) + letter + _foundLetters.substring(i + 1); + print('Found a "' + letter + '" => "' + _foundLetters + '".'); + } + bool get gameWon => _foundWord; getParameterValue(String parameterCode) { @@ -204,6 +215,7 @@ class Data extends ChangeNotifier { _recentWords.insert(0, word); _recentWords = _recentWords.take(_recentWordsCount).toList(); } + initFoundLetters(); notifyListeners(); } diff --git a/lib/utils/game_utils.dart b/lib/utils/game_utils.dart index 83a2cc15e86c946eb2680a1b542379e81cb5eb84..69d5b5d8c035bd523a891f43fa75a055cfd2141e 100644 --- a/lib/utils/game_utils.dart +++ b/lib/utils/game_utils.dart @@ -76,6 +76,7 @@ class GameUtils { for (int i = 0; i < wordLength; i++) { if ((tips[i] == '') && (word[i] == candidate[i])) { print('Found "' + word[i] + '" on the right place: ' + (i + 1).toString()); + myProvider.addFoundLetter(word[i], i); word = replaceCharAt(word, i, ' '); candidate = replaceCharAt(candidate, i, ' '); tips[i] = 'good';