From 6e51f44245dc03346a76d7609e7b653db6136181 Mon Sep 17 00:00:00 2001 From: zhl Date: Tue, 2 Feb 2021 17:01:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA=E5=B9=BF?= =?UTF-8?q?=E6=92=AD=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rooms/GeneralRoom.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rooms/GeneralRoom.ts b/src/rooms/GeneralRoom.ts index e82f038..77b71a6 100644 --- a/src/rooms/GeneralRoom.ts +++ b/src/rooms/GeneralRoom.ts @@ -102,6 +102,13 @@ export class GeneralRoom extends Room { msgLog('change pet from ', client.sessionId, JSON.stringify(message)); this.dispatcher.dispatch(new ChangePetCommand(), {client, pos: message.pos, petId: message.petId}); }); + /** + * broadcast_c2s的消息, 原样广播出去 + */ + this.onMessage("broadcast_c2s", (client, message) => { + msgLog('broadcast_c2s from ', client.sessionId, JSON.stringify(message)); + this.broadcast("broadcast_s2c", message, {except: client}); + }); this.onMessage("*", (client, type, message) => { //