Game<E extends Event> class
abstract
Abstract class that all games must inherit from
- Available extensions
Constructors
- Game()
Properties
- currentPlayer → Player?
-
Available on Game<
Gets the current Player or null if the game is not turn basedEvent> , provided by the GameX extensionno setter - currentPlayerID → String
-
Available on Game<
Gets the current Player IDEvent> , provided by the GameX extensionno setter - currentPlayerIndex → int?
-
Available on Game<
Gets the current player's indexEvent> , provided by the GameX extensionno setter - gameOver → bool
-
Available on Game<
Gets whether the game is overEvent> , provided by the GameX extensionno setter - generic → GenericGame
-
generic game holding some commonly used state
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isMultiPly → bool
-
Available on Game<
Gets whether the game has multiple actions before a rewardEvent> , provided by the GameX extensionno setter - isSimultaneousAction → bool
-
Available on Game<
Gets whether the game is simultaneous action at this plyEvent> , provided by the GameX extensionno setter -
messages
→ IList<
GameMessage> -
Available on Game<
Gets the list ofEvent> , provided by the GameX extensionGameMessage
s that have been exchanged this gameno setter -
playerIDs
→ IList<
PlayerID> -
Available on Game<
Gets the players that are a part of this gameEvent> , provided by the GameX extensionno setter -
playerRoundScores
→ IMap<
PlayerID, IList< double> > -
Available on Game<
Gets the list of round scores for each player mapped by their idEvent> , provided by the GameX extensionno setter -
players
→ IList<
Player> -
Available on Game<
Gets an unmodifiable list of players that are a part of this gameEvent> , provided by the GameX extensionno setter -
readyPlayers
→ IList<
PlayerID> -
Available on Game<
Gets the players who are ready for the next roundEvent> , provided by the GameX extensionno setter - round → int
-
Available on Game<
Gets the current round numberEvent> , provided by the GameX extensionno setter - roundOver → bool
-
Available on Game<
Gets whether the round is overEvent> , provided by the GameX extensionno setter -
roundPlayerScores
→ IList<
IMap< PlayerID, double> > -
Available on Game<
Gets the map of player scores grouped by roundEvent> , provided by the GameX extensionno setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → GameStatus
-
Available on Game<
Gets the status of the gameEvent> , provided by the GameX extensionno setter - time → DateTime
-
Available on Game<
Gets theEvent> , provided by the GameX extensionDateTime
that this state was updatedno setter -
totalScores
→ IMap<
PlayerID, double> -
Available on Game<
Gets the total score for each player mapped by player idEvent> , provided by the GameX extensionno setter - type → GameType
-
Returns the name game type that is registered for serialization
no setter
Methods
-
copyWithGeneric(
GenericGame updates(GenericGame)) → Game< Event> - Copies the state of the game with generic replaced by the function applying updates to the most recent copy of generic
-
gameValue<
G extends Game< (E> >) → GameOrError< G> -
Available on Game<
E> , provided by the GameOrErrorGameX extension -
moveNextRound(
GameConfig config) → Game< Event> - Logic to apply after all players have consented they want to play another round to initialize the next round
-
next(
E event) → GameOrError< Game< Event> > - This method takes an event and returns the changed game state or an error
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Serializes the state for consumption by the frontend
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
Static Methods
-
fromJson(
Map< String, dynamic> json) → Game<Event> - Converts the game from json to the particular type based on the type field
-
gameEventFromJson(
Map< String, dynamic> json) → GameEvent - Returns the game event translated from json
-
getInitialState(
GameConfig gameConfig, IList< Player> players) → Game<Event> - Will get the initial state for a particular configuration
-
registerGameType<
T extends Game< (Event> , Q extends Game<Event> >GameType type, {required String name, required Q fromJson(Map< String, dynamic> ), required T initialState(GameConfig, IList<Player> ), required GameEvent gameEventFromJson(Map<String, dynamic> ), Q toClientView(T)?}) → void - Registers a game type with the server
-
toClientView(
Game< Event> g) → Game<Event> - Optionally converts the game from a full game state to a view of the game from the client's perspective