sending tiles when finishing game
This commit is contained in:
parent
af78c26a93
commit
97b490c058
@ -217,9 +217,9 @@ export class DominoesGame extends EventEmitter {
|
|||||||
gameId: this.id,
|
gameId: this.id,
|
||||||
isBlocked: this.gameBlocked,
|
isBlocked: this.gameBlocked,
|
||||||
isTied: this.gameTied,
|
isTied: this.gameTied,
|
||||||
winner: this.winner?.getState(),
|
winner: this.winner?.getState(true),
|
||||||
score: this.players.map(player => ({id: player.id, name: player.name, score: player.score})),
|
score: this.players.map(player => ({id: player.id, name: player.name, score: player.score})),
|
||||||
players: this.players.map(player => player.getState())
|
players: this.players.map(player => player.getState(true))
|
||||||
}
|
}
|
||||||
this.emit('game-over', summary);
|
this.emit('game-over', summary);
|
||||||
}
|
}
|
||||||
|
@ -152,14 +152,14 @@ export class MatchSession {
|
|||||||
this.status = 'end'
|
this.status = 'end'
|
||||||
this.notificationService.sendEventToPlayers('server:match-finished', this.players, {
|
this.notificationService.sendEventToPlayers('server:match-finished', this.players, {
|
||||||
lastGame: gameSummary,
|
lastGame: gameSummary,
|
||||||
sessionState: this.getState(),
|
sessionState: this.getState(true),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.status = 'waiting'
|
this.status = 'waiting'
|
||||||
// await this.playerNotificationManager.notifyMatchState(this);
|
// await this.playerNotificationManager.notifyMatchState(this);
|
||||||
this.notificationService.sendEventToPlayers('server:game-finished', this.players, {
|
this.notificationService.sendEventToPlayers('server:game-finished', this.players, {
|
||||||
lastGame: gameSummary,
|
lastGame: gameSummary,
|
||||||
sessionState: this.getState()
|
sessionState: this.getState(true)
|
||||||
});
|
});
|
||||||
this.waitingForPlayers = true;
|
this.waitingForPlayers = true;
|
||||||
this.startGame();
|
this.startGame();
|
||||||
@ -304,12 +304,12 @@ export class MatchSession {
|
|||||||
return `GameSession:(${this.id} ${this.name})`;
|
return `GameSession:(${this.id} ${this.name})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
getState(): MatchSessionState {
|
getState(showPips?: boolean): MatchSessionState {
|
||||||
return {
|
return {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
name: this.name!,
|
name: this.name!,
|
||||||
creator: this.creator.id,
|
creator: this.creator.id,
|
||||||
players: this.players.map(player => player.getState()),
|
players: this.players.map(player => player.getState(showPips)),
|
||||||
playersReady: this.numPlayersReady,
|
playersReady: this.numPlayersReady,
|
||||||
sessionInProgress: this.sessionInProgress,
|
sessionInProgress: this.sessionInProgress,
|
||||||
maxPlayers: this.maxPlayers,
|
maxPlayers: this.maxPlayers,
|
||||||
@ -321,7 +321,7 @@ export class MatchSession {
|
|||||||
pointsToWin: this.pointsToWin,
|
pointsToWin: this.pointsToWin,
|
||||||
status: this.sessionInProgress ? 'in progress' : 'waiting',
|
status: this.sessionInProgress ? 'in progress' : 'waiting',
|
||||||
scoreboard: this.getScoreBoardState(),
|
scoreboard: this.getScoreBoardState(),
|
||||||
matchWinner: this.matchWinner?.getState() || null,
|
matchWinner: this.matchWinner?.getState(true) || null,
|
||||||
matchInProgress: this.matchInProgress,
|
matchInProgress: this.matchInProgress,
|
||||||
gameSummaries: this.gameSummaries,
|
gameSummaries: this.gameSummaries,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user