card_svr/src/rooms/commands/ResumeCommand.ts

20 lines
596 B
TypeScript

import { Command } from '@colyseus/command'
import { CardGameState } from '../schema/CardGameState'
import { Client } from 'colyseus'
import { ClockNameConst } from '../../constants/ClockNameConst'
export class ResumeCommand extends Command<CardGameState, {client: Client}> {
execute({client} = this.payload) {
if (this.state.mode !== 3) {
client.send('resume_s2c', {
errcode: 1,
errmsg: '当前模式不能暂停'})
return
}
this.room.stopSchedule(ClockNameConst.CLIENT_PAUSE)
this.room.resumeAllSchedule()
client.send('resume_s2c', {})
}
}