From b2659ad6e84f22837173a7d3be91d25d05232198 Mon Sep 17 00:00:00 2001 From: zhl Date: Wed, 24 Mar 2021 13:12:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=81=9C=E5=92=8C=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B8=B8=E6=88=8F=E6=A8=A1=E5=BC=8F=E5=88=A4?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rooms/commands/PauseCommand.ts | 6 ++++++ src/rooms/commands/ResumeCommand.ts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/rooms/commands/PauseCommand.ts b/src/rooms/commands/PauseCommand.ts index d0656a3..3010245 100644 --- a/src/rooms/commands/PauseCommand.ts +++ b/src/rooms/commands/PauseCommand.ts @@ -5,6 +5,12 @@ import { Client } from 'colyseus' export class PauseCommand extends Command { execute({ client } = this.payload) { + if (this.state.mode !== 3) { + client.send('pause_s2c', { + errcode: 1, + errmsg: '当前模式不能暂停'}) + return + } let result = this.room.pauseAllSchedule() client.send('pause_s2c', {}) } diff --git a/src/rooms/commands/ResumeCommand.ts b/src/rooms/commands/ResumeCommand.ts index 0c9d398..7c776fd 100644 --- a/src/rooms/commands/ResumeCommand.ts +++ b/src/rooms/commands/ResumeCommand.ts @@ -5,6 +5,12 @@ import { Client } from 'colyseus' export class ResumeCommand extends Command { execute({client} = this.payload) { + if (this.state.mode !== 3) { + client.send('resume_s2c', { + errcode: 1, + errmsg: '当前模式不能暂停'}) + return + } this.room.resumeAllSchedule() client.send('resume_s2c', {}) }