diff --git a/src/rooms/GeneralRoom.ts b/src/rooms/GeneralRoom.ts index e08e38f..74db303 100644 --- a/src/rooms/GeneralRoom.ts +++ b/src/rooms/GeneralRoom.ts @@ -46,49 +46,49 @@ export class GeneralRoom extends Room { this.clock.start(); this.state.gameState = GameStateConst.STATE_WAIT_JOIN; this.onMessage("play_ready_c2s", (client, message) => { - msgLog('play_ready from ', client.sessionId, message); + msgLog('play_ready from ', client.sessionId, JSON.stringify(message)); this.dispatcher.dispatch(new PlayReadyCommand(), {client}); }); this.onMessage("change_card_c2s", (client, message) => { - msgLog('change_card from ', client.sessionId, message); + msgLog('change_card from ', client.sessionId, JSON.stringify(message)); this.dispatcher.dispatch(new ChangeCardCommand(), {client, cards: message.cards}); }); this.onMessage("discard_card_c2s", (client, message) => { - msgLog('discard_card from ', client.sessionId, message); + msgLog('discard_card from ', client.sessionId, JSON.stringify(message)); this.dispatcher.dispatch(new DiscardCommand(), {client, cards: message.cards, dtype: 0}); }); this.onMessage("eat_card_c2s", (client, message) => { - msgLog('eat_card from ', client.sessionId, message); + msgLog('eat_card from ', client.sessionId, JSON.stringify(message)); this.dispatcher.dispatch(new EatCardCommand(), {client, cards: message.cards, target: message.target}); }); this.onMessage("give_up_eat_c2s", (client, message) => { - msgLog('give_up_take from ', client.sessionId, message); + msgLog('give_up_take from ', client.sessionId, JSON.stringify(message)); this.dispatcher.dispatch(new GiveUpCommand(), {client}); }); this.onMessage("select_pet_c2s", (client, message) => { - msgLog('select_pet from ', client.sessionId, message); + msgLog('select_pet from ', client.sessionId, JSON.stringify(message)); this.dispatcher.dispatch(new SelectPetCommand(), {client, cardId: message.card, playerId: message.player, pos: message.pos, effCards: message.effCards, oldpos: message.oldpos }); }); this.onMessage("select_hero_c2s", (client, message) => { - msgLog('select_hero from ', client.sessionId, message); + msgLog('select_hero from ', client.sessionId, JSON.stringify(message)); this.dispatcher.dispatch(new SelectHeroCommand(), {client, heroId: message.heroId}); }); this.onMessage("gm", (client, message) => { - msgLog('gm command from ', client.sessionId, message); + msgLog('gm command from ', client.sessionId, JSON.stringify(message)); this.dispatcher.dispatch(new GMCommand(), {client, message}); }); this.onMessage("restart_c2s", (client, message) => { - msgLog('restart game from ', client.sessionId, message); + msgLog('restart game from ', client.sessionId, JSON.stringify(message)); this.dispatcher.dispatch(new GameRestartCommand(), {client}); }); this.onMessage("change_pet_c2s", (client, message) => { - msgLog('change pet from ', client.sessionId, message); + msgLog('change pet from ', client.sessionId, JSON.stringify(message)); this.dispatcher.dispatch(new ChangePetCommand(), {client, pos: message.pos, petId: message.petId}); }); @@ -97,7 +97,7 @@ export class GeneralRoom extends Room { // Triggers when any other type of message is sent, // excluding "action", which has its own specific handler defined above. // - msgLog(client.sessionId, "sent", type, message); + msgLog(client.sessionId, "sent", type, JSON.stringify(message)); }); }