diff --git a/src/robot/RobotClient.ts b/src/robot/RobotClient.ts index d140e8e..faa7594 100644 --- a/src/robot/RobotClient.ts +++ b/src/robot/RobotClient.ts @@ -52,7 +52,6 @@ export class RobotClient implements Client { leave(code?: number, data?: string): void { this.listenerState && this.listenerState(); this.listenerTurn && this.listenerTurn(); - this.ref.emit('close'); } raw(data: ArrayLike, options?: ISendOptions): void { diff --git a/src/rooms/GeneralRoom.ts b/src/rooms/GeneralRoom.ts index 799abd0..c1dfc4e 100644 --- a/src/rooms/GeneralRoom.ts +++ b/src/rooms/GeneralRoom.ts @@ -105,7 +105,10 @@ export class GeneralRoom extends Room { async onLeave (client: Client, consented: boolean) { if (this.state.gameState === GameStateConst.STATE_GAME_OVER || this.state.gameState === GameStateConst.STATE_WAIT_JOIN) { this.state.players.delete(client.sessionId); - this.assistMap.delete(client.sessionId); + if (this.assistMap.has(client.sessionId)) { + this.assistMap.get(client.sessionId).leave(); + this.assistMap.delete(client.sessionId); + } this.bUserLeft(client.sessionId); } else { this.state.players.get(client.sessionId).state = PlayerStateConst.PLAYER_OFFLINE;