Added caboPlayerIndex in Round-Class
This commit is contained in:
@@ -9,34 +9,40 @@ import 'package:cabo_counter/data/game_session.dart';
|
||||
/// kamikaze, this value is null.
|
||||
class Round {
|
||||
final int roundNum;
|
||||
final int caboPlayerIndex;
|
||||
final int? kamikazePlayerIndex;
|
||||
final List<int> scores;
|
||||
final List<int> scoreUpdates;
|
||||
final int? kamikazePlayerIndex;
|
||||
|
||||
Round(
|
||||
{required this.roundNum,
|
||||
required this.scores,
|
||||
required this.scoreUpdates,
|
||||
this.kamikazePlayerIndex});
|
||||
Round({
|
||||
required this.roundNum,
|
||||
required this.caboPlayerIndex,
|
||||
this.kamikazePlayerIndex,
|
||||
required this.scores,
|
||||
required this.scoreUpdates,
|
||||
});
|
||||
|
||||
@override
|
||||
toString() {
|
||||
return 'Round $roundNum: scores: $scores, scoreUpdates: $scoreUpdates, '
|
||||
'kamikazePlayerIndex: $kamikazePlayerIndex';
|
||||
return 'Round $roundNum, caboPlayerIndex: $caboPlayerIndex, '
|
||||
'kamikazePlayerIndex: $kamikazePlayerIndex, scores: $scores, '
|
||||
'scoreUpdates: $scoreUpdates, ';
|
||||
}
|
||||
|
||||
/// Converts the Round object to a JSON map.
|
||||
Map<String, dynamic> toJson() => {
|
||||
'roundNum': roundNum,
|
||||
'caboPlayerIndex': caboPlayerIndex,
|
||||
'kamikazePlayerIndex': kamikazePlayerIndex,
|
||||
'scores': scores,
|
||||
'scoreUpdates': scoreUpdates,
|
||||
'kamikazePlayerIndex': kamikazePlayerIndex,
|
||||
};
|
||||
|
||||
/// Creates a Round object from a JSON map.
|
||||
Round.fromJson(Map<String, dynamic> json)
|
||||
: roundNum = json['roundNum'],
|
||||
caboPlayerIndex = json['caboPlayerIndex'],
|
||||
kamikazePlayerIndex = json['kamikazePlayerIndex'],
|
||||
scores = List<int>.from(json['scores']),
|
||||
scoreUpdates = List<int>.from(json['scoreUpdates']),
|
||||
kamikazePlayerIndex = json['kamikazePlayerIndex'];
|
||||
scoreUpdates = List<int>.from(json['scoreUpdates']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user