Small changes & documentation
This commit is contained in:
@@ -1,13 +1,14 @@
|
|||||||
import 'package:cabo_counter/data/round.dart';
|
import 'package:cabo_counter/data/round.dart';
|
||||||
|
|
||||||
/// This class represents a game session for the Cabo game.
|
/// This class represents a game session for 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.
|
|
||||||
/// [createdAt] is the timestamp of when the game session was created.
|
/// [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.
|
/// [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.
|
/// [winner] is the name of the player who won the game.
|
||||||
class GameSession {
|
class GameSession {
|
||||||
final DateTime createdAt = DateTime.now();
|
final DateTime createdAt = DateTime.now();
|
||||||
@@ -162,7 +163,7 @@ class GameSession {
|
|||||||
roundNum: roundNum,
|
roundNum: roundNum,
|
||||||
scores: roundScores,
|
scores: roundScores,
|
||||||
scoreUpdates: scoreUpdates,
|
scoreUpdates: scoreUpdates,
|
||||||
kamikaze: kamikazePlayerIndex,
|
kamikazePlayerIndex: kamikazePlayerIndex,
|
||||||
);
|
);
|
||||||
if (roundNum > roundList.length) {
|
if (roundNum > roundList.length) {
|
||||||
roundList.add(newRound);
|
roundList.add(newRound);
|
||||||
|
|||||||
@@ -3,17 +3,17 @@
|
|||||||
/// [roundNum] is the number of the round its reppresenting.
|
/// [roundNum] is the number of the round its reppresenting.
|
||||||
/// [scores] is a list of the actual scores the players got.
|
/// [scores] is a list of the actual scores the players got.
|
||||||
/// [scoreUpdates] is a list of how the players scores updated this round.
|
/// [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.
|
/// kamikaze, this value is null.
|
||||||
class Round {
|
class Round {
|
||||||
final int roundNum;
|
final int roundNum;
|
||||||
List<int> scores;
|
final List<int> scores;
|
||||||
List<int> scoreUpdates;
|
final List<int> scoreUpdates;
|
||||||
int? kamikaze;
|
final int? kamikazePlayerIndex;
|
||||||
|
|
||||||
Round(
|
Round(
|
||||||
{required this.roundNum,
|
{required this.roundNum,
|
||||||
required this.scores,
|
required this.scores,
|
||||||
required this.scoreUpdates,
|
required this.scoreUpdates,
|
||||||
this.kamikaze});
|
this.kamikazePlayerIndex});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
gameSession.roundList[widget.roundNumber - 1].scores[i].toString();
|
gameSession.roundList[widget.roundNumber - 1].scores[i].toString();
|
||||||
}
|
}
|
||||||
_kamikazePlayerIndex =
|
_kamikazePlayerIndex =
|
||||||
gameSession.roundList[widget.roundNumber - 1].kamikaze;
|
gameSession.roundList[widget.roundNumber - 1].kamikazePlayerIndex;
|
||||||
}
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user