GenericGame class Null safety

Represents a generic game, with common fields that can be manipulated by common GenericEvents

Includes

Annotations

Constructors

GenericGame(IList<Player> players, IList<PlayerID> readyPlayers, IList<IList<double>> allRoundScores, DateTime time, IList<GameMessage> messages, GameStatus status, int? currentPlayerIndex, int round, bool isMultiPly, bool isSimultaneousAction)
const
factory
GenericGame.fromJson(Map<String, dynamic> map)
factory
GenericGame.start(ISet<Player> players, {required bool multiPly, required bool simultaneousAction})
Creates a default initialized game with players
factory
GenericGame.startRandom(IList<Player> players, {required bool multiPly, required bool simultaneousAction})
Creates a default initialized game where the first player is chosen at random
factory

Properties

allRoundScores IList<IList<double>>
read-only, inherited
copyWith → $GenericGameCopyWith<GenericGame>
@JsonKey(ignore: true), read-only, inherited
currentPlayer Player?
Gets the player at the currentPlayerIndex
read-only
currentPlayerIndex int?
read-only, inherited
gameOver bool
Gets whether the game is over
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
isMultiPly bool
read-only, inherited
isSimultaneousAction bool
read-only, inherited
messages IList<GameMessage>
read-only, inherited
playerRoundScores IMap<PlayerID, IList<double>>
Gets the scores for each player for all rounds based off of allRoundScores
read-only
players IList<Player>
read-only, inherited
readyPlayers IList<String>
read-only, inherited
round int
read-only, inherited
roundOver bool
Gets whether the round is over
read-only
roundPlayerScores IList<IMap<PlayerID, double>>
Gets the scores for each round for each player based off of allRoundScores
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
status GameStatus
read-only, inherited
time DateTime
read-only, inherited
totalScores IMap<PlayerID, double>
Gets the total score for each player based off of allRoundScores
read-only

Methods

addMessage(GameMessage msg) GenericGame
Returns a copy of the GenericGame with the msg added to messages
addReadyPlayer(PlayerID player) GenericGame
Adds a ready player to the list
clearReadyPlayers() GenericGame
Clears the list of ready players
finishRound([Map<PlayerID, double>? scores]) GenericGame
Returns a copy of the GenericGame with the round incremented, status set to GameStatus.Started and optionally the players' scores added to allRoundScores
nextPlayer() GenericGame
Returns a copy of the GenericGame with the next player in the player array as the current player
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
setNextPlayer(PlayerID player) GenericGame
Returns a copy of the GenericGame with the current player being the one with id player
shufflePlayers() GenericGame
Shuffles the player list, and resets the currentPlayerIndex to the first
toJson() Map<String, dynamic>
inherited
toString() String
A string representation of this object. [...]
inherited
updateScores(Map<PlayerID, double> scores) GenericGame
Returns a copy of the GenericGame with the scores added to allRoundScores
updateStatus(GameStatus status) GenericGame
Returns a copy of the GenericGame with the status updated to status
updateTime() GenericGame
Returns a copy of the GenericGame with the time updated to the current time

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited