暂停和恢复增加游戏模式判定
This commit is contained in:
parent
3ece3776e2
commit
b2659ad6e8
@ -5,6 +5,12 @@ import { Client } from 'colyseus'
|
|||||||
export class PauseCommand extends Command<CardGameState, { client: Client }> {
|
export class PauseCommand extends Command<CardGameState, { client: Client }> {
|
||||||
|
|
||||||
execute({ client } = this.payload) {
|
execute({ client } = this.payload) {
|
||||||
|
if (this.state.mode !== 3) {
|
||||||
|
client.send('pause_s2c', {
|
||||||
|
errcode: 1,
|
||||||
|
errmsg: '当前模式不能暂停'})
|
||||||
|
return
|
||||||
|
}
|
||||||
let result = this.room.pauseAllSchedule()
|
let result = this.room.pauseAllSchedule()
|
||||||
client.send('pause_s2c', {})
|
client.send('pause_s2c', {})
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,12 @@ import { Client } from 'colyseus'
|
|||||||
export class ResumeCommand extends Command<CardGameState, {client: Client}> {
|
export class ResumeCommand extends Command<CardGameState, {client: Client}> {
|
||||||
|
|
||||||
execute({client} = this.payload) {
|
execute({client} = this.payload) {
|
||||||
|
if (this.state.mode !== 3) {
|
||||||
|
client.send('resume_s2c', {
|
||||||
|
errcode: 1,
|
||||||
|
errmsg: '当前模式不能暂停'})
|
||||||
|
return
|
||||||
|
}
|
||||||
this.room.resumeAllSchedule()
|
this.room.resumeAllSchedule()
|
||||||
client.send('resume_s2c', {})
|
client.send('resume_s2c', {})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user