Merge pull request #134 from flixcoo/bug/132-winner-popup-wont-show-on-unlimited-games-ending
Fixed bug with no popup shown
This commit is contained in:
@@ -69,6 +69,7 @@ class GameManager extends ChangeNotifier {
|
|||||||
|
|
||||||
gameList[index].roundNumber--;
|
gameList[index].roundNumber--;
|
||||||
gameList[index].isGameFinished = true;
|
gameList[index].isGameFinished = true;
|
||||||
|
gameList[index].setWinner();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
LocalStorageService.saveGameSessions();
|
LocalStorageService.saveGameSessions();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ class GameSession extends ChangeNotifier {
|
|||||||
isGameFinished = true;
|
isGameFinished = true;
|
||||||
print('${players[i]} hat die 100 Punkte ueberschritten, '
|
print('${players[i]} hat die 100 Punkte ueberschritten, '
|
||||||
'deswegen wurde das Spiel beendet');
|
'deswegen wurde das Spiel beendet');
|
||||||
_setWinner();
|
setWinner();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -298,7 +298,7 @@ class GameSession extends ChangeNotifier {
|
|||||||
/// Determines the winner of the game session.
|
/// Determines the winner of the game session.
|
||||||
/// It iterates through the player scores and finds the player
|
/// It iterates through the player scores and finds the player
|
||||||
/// with the lowest score.
|
/// with the lowest score.
|
||||||
void _setWinner() {
|
void setWinner() {
|
||||||
int minScore = playerScores.reduce((a, b) => a < b ? a : b);
|
int minScore = playerScores.reduce((a, b) => a < b ? a : b);
|
||||||
List<String> lowestPlayers = [];
|
List<String> lowestPlayers = [];
|
||||||
for (int i = 0; i < players.length; i++) {
|
for (int i = 0; i < players.length; i++) {
|
||||||
|
|||||||
@@ -312,6 +312,7 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
gameManager.endGame(gameSession.id);
|
gameManager.endGame(gameSession.id);
|
||||||
|
_playFinishAnimation(context);
|
||||||
});
|
});
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: cabo_counter
|
|||||||
description: "Mobile app for the card game Cabo"
|
description: "Mobile app for the card game Cabo"
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 0.5.3+589
|
version: 0.5.3+593
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.5.4
|
sdk: ^3.5.4
|
||||||
|
|||||||
Reference in New Issue
Block a user