消息日志的内容转成string后再输出
This commit is contained in:
parent
2c5d54ace6
commit
5b9bd93031
@ -46,49 +46,49 @@ export class GeneralRoom extends Room {
|
|||||||
this.clock.start();
|
this.clock.start();
|
||||||
this.state.gameState = GameStateConst.STATE_WAIT_JOIN;
|
this.state.gameState = GameStateConst.STATE_WAIT_JOIN;
|
||||||
this.onMessage("play_ready_c2s", (client, message) => {
|
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.dispatcher.dispatch(new PlayReadyCommand(), {client});
|
||||||
});
|
});
|
||||||
this.onMessage("change_card_c2s", (client, message) => {
|
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.dispatcher.dispatch(new ChangeCardCommand(), {client, cards: message.cards});
|
||||||
});
|
});
|
||||||
this.onMessage("discard_card_c2s", (client, message) => {
|
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.dispatcher.dispatch(new DiscardCommand(), {client, cards: message.cards, dtype: 0});
|
||||||
});
|
});
|
||||||
this.onMessage("eat_card_c2s", (client, message) => {
|
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.dispatcher.dispatch(new EatCardCommand(), {client, cards: message.cards, target: message.target});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onMessage("give_up_eat_c2s", (client, message) => {
|
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.dispatcher.dispatch(new GiveUpCommand(), {client});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onMessage("select_pet_c2s", (client, message) => {
|
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.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) => {
|
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.dispatcher.dispatch(new SelectHeroCommand(), {client, heroId: message.heroId});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onMessage("gm", (client, message) => {
|
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.dispatcher.dispatch(new GMCommand(), {client, message});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onMessage("restart_c2s", (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.dispatcher.dispatch(new GameRestartCommand(), {client});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onMessage("change_pet_c2s", (client, message) => {
|
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});
|
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,
|
// Triggers when any other type of message is sent,
|
||||||
// excluding "action", which has its own specific handler defined above.
|
// excluding "action", which has its own specific handler defined above.
|
||||||
//
|
//
|
||||||
msgLog(client.sessionId, "sent", type, message);
|
msgLog(client.sessionId, "sent", type, JSON.stringify(message));
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user