修改接受消息的日志方法
This commit is contained in:
parent
8b9b07ff1c
commit
a573dc4be6
@ -3,3 +3,5 @@ import debug from 'debug';
|
|||||||
export const debugRoom = debug('jc:room');
|
export const debugRoom = debug('jc:room');
|
||||||
|
|
||||||
export const error = debug('jc:error');
|
export const error = debug('jc:error');
|
||||||
|
|
||||||
|
export const msgLog = debug('jc:msg');
|
||||||
|
@ -11,7 +11,7 @@ import {SelectHeroCommand} from "./commands/SelectHeroCommand";
|
|||||||
import {EatCardCommand} from "./commands/EatCardCommand";
|
import {EatCardCommand} from "./commands/EatCardCommand";
|
||||||
import {GiveUpCommand} from "./commands/GiveUpCommand";
|
import {GiveUpCommand} from "./commands/GiveUpCommand";
|
||||||
import {BattleHandler} from "./logic/Handler/BattleHandler";
|
import {BattleHandler} from "./logic/Handler/BattleHandler";
|
||||||
import {debugRoom} from "../common/Debug";
|
import {debugRoom, msgLog} from "../common/Debug";
|
||||||
import {Delayed} from "@gamestdio/timer/lib/Delayed";
|
import {Delayed} from "@gamestdio/timer/lib/Delayed";
|
||||||
import {IncomingMessage} from "http";
|
import {IncomingMessage} from "http";
|
||||||
import {BaseConst} from "../constants/BaseConst";
|
import {BaseConst} from "../constants/BaseConst";
|
||||||
@ -39,34 +39,34 @@ export class GeneralRoom extends Room {
|
|||||||
this.clock.start();
|
this.clock.start();
|
||||||
this.state.gameSate = 0;
|
this.state.gameSate = 0;
|
||||||
this.onMessage("play_ready_c2s", (client, message) => {
|
this.onMessage("play_ready_c2s", (client, message) => {
|
||||||
debugRoom('play_ready from ', client.sessionId, message);
|
msgLog('play_ready from ', client.sessionId, 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) => {
|
||||||
debugRoom('change_card from ', client.sessionId, message);
|
msgLog('change_card from ', client.sessionId, 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) => {
|
||||||
debugRoom('discard_card from ', client.sessionId, message);
|
msgLog('discard_card from ', client.sessionId, 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) => {
|
||||||
debugRoom('eat_card from ', client.sessionId, message);
|
msgLog('eat_card from ', client.sessionId, 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) => {
|
||||||
debugRoom('give_up_take from ', client.sessionId, message);
|
msgLog('give_up_take from ', client.sessionId, 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) => {
|
||||||
debugRoom('select_pet from ', client.sessionId, message);
|
msgLog('select_pet from ', client.sessionId, message);
|
||||||
this.dispatcher.dispatch(new SelectPetCommand(), {client, cardId: message.card, playerId: message.player, pos: message.pos, effCards: message.effCards });
|
this.dispatcher.dispatch(new SelectPetCommand(), {client, cardId: message.card, playerId: message.player, pos: message.pos, effCards: message.effCards });
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onMessage("select_hero_c2s", (client, message) => {
|
this.onMessage("select_hero_c2s", (client, message) => {
|
||||||
debugRoom('select_hero from ', client.sessionId, message);
|
msgLog('select_hero from ', client.sessionId, message);
|
||||||
this.dispatcher.dispatch(new SelectHeroCommand(), {client, heroId: message.heroId});
|
this.dispatcher.dispatch(new SelectHeroCommand(), {client, heroId: message.heroId});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -75,7 +75,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.
|
||||||
//
|
//
|
||||||
debugRoom(client.sessionId, "sent", type, message);
|
msgLog(client.sessionId, "sent", type, message);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user