辅助机器人离开时, 条用leave方法
This commit is contained in:
parent
6bf63ff8c1
commit
de1ff7bcae
@ -52,7 +52,6 @@ export class RobotClient implements Client {
|
|||||||
leave(code?: number, data?: string): void {
|
leave(code?: number, data?: string): void {
|
||||||
this.listenerState && this.listenerState();
|
this.listenerState && this.listenerState();
|
||||||
this.listenerTurn && this.listenerTurn();
|
this.listenerTurn && this.listenerTurn();
|
||||||
this.ref.emit('close');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
raw(data: ArrayLike<number>, options?: ISendOptions): void {
|
raw(data: ArrayLike<number>, options?: ISendOptions): void {
|
||||||
|
@ -105,7 +105,10 @@ export class GeneralRoom extends Room {
|
|||||||
async onLeave (client: Client, consented: boolean) {
|
async onLeave (client: Client, consented: boolean) {
|
||||||
if (this.state.gameState === GameStateConst.STATE_GAME_OVER || this.state.gameState === GameStateConst.STATE_WAIT_JOIN) {
|
if (this.state.gameState === GameStateConst.STATE_GAME_OVER || this.state.gameState === GameStateConst.STATE_WAIT_JOIN) {
|
||||||
this.state.players.delete(client.sessionId);
|
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);
|
this.bUserLeft(client.sessionId);
|
||||||
} else {
|
} else {
|
||||||
this.state.players.get(client.sessionId).state = PlayerStateConst.PLAYER_OFFLINE;
|
this.state.players.get(client.sessionId).state = PlayerStateConst.PLAYER_OFFLINE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user