From 8320e7191b2830a631c3b4fda5a1fd77b3dc5d3d Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Wed, 30 Apr 2025 00:49:15 +0200 Subject: [PATCH] Small changes & documentation --- lib/data/game_session.dart | 15 ++++++++------- lib/data/round.dart | 10 +++++----- lib/views/round_view.dart | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/data/game_session.dart b/lib/data/game_session.dart index 5cf54e3..94cc87c 100644 --- a/lib/data/game_session.dart +++ b/lib/data/game_session.dart @@ -1,13 +1,14 @@ import 'package:cabo_counter/data/round.dart'; -/// This class represents a game session for the Cabo game. -/// [gameTitle] is the title of the game. -/// [players] is a string list of player names. -/// [gameHasPointLimit] is a boolean indicating if the game has the -/// default point limit of 101 points or not. +/// This class represents a game session for Cabo game. /// [createdAt] is the timestamp of when the game session was created. +/// [gameTitle] is the title of the game. +/// [gameHasPointLimit] is a boolean indicating if the game has the default +/// point limit of 101 points or not. +/// [players] is a string list of player names. +/// [playerScores] is a list of the summed scores of all players. /// [roundNumber] is the current round number. -/// [isGameFinished] is a boolean indicating if the game session is finished. +/// [isGameFinished] is a boolean indicating if the game has ended yet. /// [winner] is the name of the player who won the game. class GameSession { final DateTime createdAt = DateTime.now(); @@ -162,7 +163,7 @@ class GameSession { roundNum: roundNum, scores: roundScores, scoreUpdates: scoreUpdates, - kamikaze: kamikazePlayerIndex, + kamikazePlayerIndex: kamikazePlayerIndex, ); if (roundNum > roundList.length) { roundList.add(newRound); diff --git a/lib/data/round.dart b/lib/data/round.dart index 76b444b..1f03b33 100644 --- a/lib/data/round.dart +++ b/lib/data/round.dart @@ -3,17 +3,17 @@ /// [roundNum] is the number of the round its reppresenting. /// [scores] is a list of the actual scores the players got. /// [scoreUpdates] is a list of how the players scores updated this round. -/// [kamikaze] is the index of the player who got kamikaze. If no one got +/// [kamikazePlayerIndex] is the index of the player who got kamikaze. If no one got /// kamikaze, this value is null. class Round { final int roundNum; - List scores; - List scoreUpdates; - int? kamikaze; + final List scores; + final List scoreUpdates; + final int? kamikazePlayerIndex; Round( {required this.roundNum, required this.scores, required this.scoreUpdates, - this.kamikaze}); + this.kamikazePlayerIndex}); } diff --git a/lib/views/round_view.dart b/lib/views/round_view.dart index 331cb81..9520aa5 100644 --- a/lib/views/round_view.dart +++ b/lib/views/round_view.dart @@ -53,7 +53,7 @@ class _RoundViewState extends State { gameSession.roundList[widget.roundNumber - 1].scores[i].toString(); } _kamikazePlayerIndex = - gameSession.roundList[widget.roundNumber - 1].kamikaze; + gameSession.roundList[widget.roundNumber - 1].kamikazePlayerIndex; } super.initState(); }