From 795232ce2da077787c7a1fd182cf72c79e758bcf Mon Sep 17 00:00:00 2001 From: zhl Date: Fri, 15 Jan 2021 16:23:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=BA=9B=E5=B1=80?= =?UTF-8?q?=E9=83=A8=E7=9A=84=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rooms/RankedLobbyRoom.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/rooms/RankedLobbyRoom.ts b/src/rooms/RankedLobbyRoom.ts index 6d16279..709c05e 100644 --- a/src/rooms/RankedLobbyRoom.ts +++ b/src/rooms/RankedLobbyRoom.ts @@ -86,12 +86,12 @@ export class RankedLobbyRoom extends Room { } this.onMessage("bye", (client: Client, message: any) => { - const stat = this.stats.find(stat => stat.clients.has(client.sessionId)); + const stat = this.stats.find(obj => obj.clients.has(client.sessionId)); if (stat && stat.group && typeof (stat.group.confirmed) === "number") { stat.confirmed = true; stat.group.confirmed++; - stat.clients.delete(client.sessionId); + //stat.clients.delete(client.sessionId); client.leave(); } }) @@ -339,12 +339,16 @@ export class RankedLobbyRoom extends Room { await Promise.all(group.clients.map(async (client) => { - const matchData = await matchMaker.reserveSeatFor(room, client.options); /** * Send room data for new WebSocket connection! */ for (let [,data] of client.clients) { + let matchOpt = { + seat: data.seat + } + Object.assign(matchOpt, data.options); + const matchData = await matchMaker.reserveSeatFor(room, matchOpt); let options: any = {seat: data.seat, rank: data.options.rank}; Object.assign(options, matchData); data.client.send("match_success", options); @@ -377,7 +381,7 @@ export class RankedLobbyRoom extends Room { } onLeave(client: Client, consented: boolean) { - const stat = this.stats.find(stat => stat.clients.has(client.sessionId)); + const stat = this.stats.find(obj => obj.clients.has(client.sessionId)); if (stat.clients.size > 1) { stat.clients.delete(client.sessionId); let data = [...stat.clients.values()][0];