From b6b67d5d38c01217e831e99164514b0a602e51d6 Mon Sep 17 00:00:00 2001 From: zhl Date: Thu, 3 Dec 2020 19:31:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A02=E4=B8=AA=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E9=98=9F=E5=88=97=E7=9A=84=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/global.d.ts | 15 +++++++++++++++ src/rooms/MSender.ts | 13 +++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/global.d.ts b/src/global.d.ts index 4b2e91a..5dfee79 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -1,3 +1,4 @@ +import {IMsg} from "./message/IMsg"; export {}; @@ -56,6 +57,20 @@ declare module "colyseus" { */ bAddPet(data?: PetInfoMsg): void; + /** + * 发送给个人的消息列表 + * @param client + * @param datas + */ + sMsgQueue(client: Client, datas: IMsg[]): void; + + + /** + * 广播的消息列表 + * @param datas + * @param options + */ + bMsgQueue(datas: IMsg[], options: any): void; } } diff --git a/src/rooms/MSender.ts b/src/rooms/MSender.ts index 15a9fba..206c24d 100644 --- a/src/rooms/MSender.ts +++ b/src/rooms/MSender.ts @@ -37,5 +37,18 @@ Object.defineProperties(Room.prototype, { value: function (data?: PetInfoMsg) { this.broadcast("pet_info_s2c", data); } + }, + + sMsgQueue: { + value: function (client:Client, datas?: PetInfoMsg) { + this.broadcast("msg_queue_s2c", datas); + } + }, + + bMsgQueue: { + value: function (datas?: PetInfoMsg, options?: any) { + this.broadcast("msg_queue_s2c", datas, options); + } } + });