Le multijoueur fonctionne enfin. Mise à jour des scores. Et de la partie.

This commit is contained in:
batche
2022-12-21 15:22:07 +01:00
parent d6da8bf70b
commit cc797d1118
11 changed files with 218 additions and 124 deletions

View File

@@ -240,9 +240,9 @@ export class GameSession {
"Content-Type": "application/json",
},
body: JSON.stringify({
id: this.id,
scoreLeft: gc.scoreLeft,
scoreRight: gc.scoreRight,
gameServerIdOfTheMatch: this.id,
playerOneUsernameResult: gc.scoreLeft,
playerTwoUsernameResult: gc.scoreRight,
})
});

View File

@@ -168,7 +168,7 @@ function privateMatchmaking(player: ClientPlayer)
const maxPlayersNumber = 2;
privateMatchmakingMap.set(player.id, player);
const matchOptions = player.matchOptions;
console.log(player)
const token = player.token;
const compatiblePlayers: ClientPlayer[] = [];
for (const [id, client] of privateMatchmakingMap)
@@ -254,6 +254,8 @@ async function playerReadyConfirmationListener(this: WebSocket, data: string)
gameOptions: gameSession.matchOptions,
playerOneUsername: (<ClientPlayer>gameSessionPlayersIterator.next().value).username,
playerTwoUsername: (<ClientPlayer>gameSessionPlayersIterator.next().value).username,
playerOneUsernameResult : 0,
playerTwoUsernameResult : 0
})
});