修改一些局部的变量
This commit is contained in:
parent
14f3cc5628
commit
795232ce2d
@ -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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user