From a573dc4be69c6a3f0f37c52d02516e72613c243a Mon Sep 17 00:00:00 2001 From: zhl Date: Tue, 8 Dec 2020 17:27:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=97=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=9A=84=E6=97=A5=E5=BF=97=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/Debug.ts | 2 ++ src/rooms/GeneralRoom.ts | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/common/Debug.ts b/src/common/Debug.ts index 20f6e00..cdbcc4a 100644 --- a/src/common/Debug.ts +++ b/src/common/Debug.ts @@ -3,3 +3,5 @@ import debug from 'debug'; export const debugRoom = debug('jc:room'); export const error = debug('jc:error'); + +export const msgLog = debug('jc:msg'); diff --git a/src/rooms/GeneralRoom.ts b/src/rooms/GeneralRoom.ts index edbbfb5..4428389 100644 --- a/src/rooms/GeneralRoom.ts +++ b/src/rooms/GeneralRoom.ts @@ -11,7 +11,7 @@ import {SelectHeroCommand} from "./commands/SelectHeroCommand"; import {EatCardCommand} from "./commands/EatCardCommand"; import {GiveUpCommand} from "./commands/GiveUpCommand"; 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 {IncomingMessage} from "http"; import {BaseConst} from "../constants/BaseConst"; @@ -39,34 +39,34 @@ export class GeneralRoom extends Room { this.clock.start(); this.state.gameSate = 0; 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.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.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.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.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.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.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}); }); @@ -75,7 +75,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. // - debugRoom(client.sessionId, "sent", type, message); + msgLog(client.sessionId, "sent", type, message); }); }