Small changes & documentation
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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<int> scores;
|
||||
List<int> scoreUpdates;
|
||||
int? kamikaze;
|
||||
final List<int> scores;
|
||||
final List<int> scoreUpdates;
|
||||
final int? kamikazePlayerIndex;
|
||||
|
||||
Round(
|
||||
{required this.roundNum,
|
||||
required this.scores,
|
||||
required this.scoreUpdates,
|
||||
this.kamikaze});
|
||||
this.kamikazePlayerIndex});
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class _RoundViewState extends State<RoundView> {
|
||||
gameSession.roundList[widget.roundNumber - 1].scores[i].toString();
|
||||
}
|
||||
_kamikazePlayerIndex =
|
||||
gameSession.roundList[widget.roundNumber - 1].kamikaze;
|
||||
gameSession.roundList[widget.roundNumber - 1].kamikazePlayerIndex;
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user