First version of retrieving a gamesession from the db

This commit is contained in:
2025-08-21 22:30:13 +02:00
parent 4901e27b90
commit 7a420e909a
28 changed files with 868 additions and 1175 deletions

View File

@@ -20,21 +20,25 @@ class GameSession extends ChangeNotifier {
final int pointLimit;
final int caboPenalty;
final bool isPointsLimitEnabled;
bool isGameFinished = false;
String winner = '';
int roundNumber = 1;
late List<int> playerScores;
List<Round> roundList = [];
bool isGameFinished;
String winner;
int roundNumber;
List<int> playerScores;
List<Round> roundList;
GameSession({
required this.id,
required this.createdAt,
required this.gameTitle,
required this.players,
required this.pointLimit,
required this.caboPenalty,
required this.isPointsLimitEnabled,
}) {
GameSession(
{required this.id,
required this.createdAt,
required this.gameTitle,
required this.players,
required this.pointLimit,
required this.caboPenalty,
required this.isPointsLimitEnabled,
this.isGameFinished = false,
this.winner = '',
this.roundNumber = 1,
this.playerScores = const [],
this.roundList = const []}) {
playerScores = List.filled(players.length, 0);
}
@@ -207,6 +211,8 @@ class GameSession extends ChangeNotifier {
int? kamikazePlayerIndex,
]) {
Round newRound = Round(
roundId: const Uuid().v1(),
gameId: id,
roundNum: roundNum,
caboPlayerIndex: caboPlayerIndex,
kamikazePlayerIndex: kamikazePlayerIndex,