Add game restart and disconnect support
Prevent handling disconnects for games already ended; add a disconnect() method on the SignalR connection and a LocalGame.disconnectAll() helper. Update GameEndedMenu to emit a restart event and adjust displayed messages/labels. Wire a restart() handler in LocalMode that disconnects all players then restarts the game.
This commit is contained in:
@@ -73,6 +73,11 @@ class LocalGame {
|
||||
this.gameState?.currentTurn == 1 ? this.player1.playerName : this.player2.playerName;
|
||||
this.currentDescription = `${playerName} ist dran mit setzen!`;
|
||||
}
|
||||
|
||||
async disconnectAll(){
|
||||
await this.player1.disconnect();
|
||||
await this.player2.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
export default LocalGame;
|
||||
|
||||
Reference in New Issue
Block a user