增加dice_card消息的处理

This commit is contained in:
zhl 2021-03-30 13:15:55 +08:00
parent 92a87c3995
commit 734c102902

View File

@ -27,6 +27,7 @@ import { PlayerStateConst } from '../constants/PlayerStateConst'
import { PlayLeftCommand } from './commands/PlayLeftCommand' import { PlayLeftCommand } from './commands/PlayLeftCommand'
import { PauseCommand } from './commands/PauseCommand' import { PauseCommand } from './commands/PauseCommand'
import { ResumeCommand } from './commands/ResumeCommand' import { ResumeCommand } from './commands/ResumeCommand'
import { DiceCommand } from './commands/DiceCommand'
export class GeneralRoom extends Room { export class GeneralRoom extends Room {
dispatcher = new Dispatcher(this) dispatcher = new Dispatcher(this)
@ -94,6 +95,13 @@ export class GeneralRoom extends Room {
nums: message.nums nums: message.nums
}) })
}) })
this.onMessage('dice_card_c2s', (client, message) => {
msgLog('dice_card_c2s from ', client.sessionId, JSON.stringify(message))
this.dispatcher.dispatch(new DiceCommand(), {
client,
cards: message.cards,
})
})
this.onMessage('eat_card_c2s', (client, message) => { this.onMessage('eat_card_c2s', (client, message) => {
msgLog('eat_card from ', client.sessionId, JSON.stringify(message)) msgLog('eat_card from ', client.sessionId, JSON.stringify(message))
this.dispatcher.dispatch(new EatCardCommand(), { this.dispatcher.dispatch(new EatCardCommand(), {