调整机器人退出策略
This commit is contained in:
parent
bab2553546
commit
df148af42f
@ -135,6 +135,10 @@ export class Robot {
|
||||
case GameStateConst.STATE_DICE_TURN:
|
||||
self.discard()
|
||||
break
|
||||
case GameStateConst.STATE_GAME_OVER:
|
||||
self.room.leave()
|
||||
self.room.removeAllListeners()
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -204,6 +204,10 @@ export class GeneralRoom extends Room {
|
||||
|
||||
// 掉线逻辑
|
||||
async onLeave(client: Client, consented: boolean) {
|
||||
if (this.clients.length === 0) {
|
||||
this.disconnect()
|
||||
return
|
||||
}
|
||||
if (this.state.gameState === GameStateConst.STATE_GAME_OVER || this.state.gameState === GameStateConst.STATE_WAIT_JOIN) {
|
||||
this.state.players.delete(client.sessionId)
|
||||
if (this.assistMap.has(client.sessionId)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user