diff --git a/src/global.d.ts b/src/global.d.ts index 72bc077..bfa48d3 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -111,6 +111,13 @@ declare module "colyseus" { * @param options */ bPartResult(data?: PartResultMsg, options?: any): void; + + /** + * 广播游戏最终结果 + * @param data + * @param options + */ + bGameResult(data?: any, options: any): void; /** * 发送给个人的消息列表 * @param client diff --git a/src/rooms/MSender.ts b/src/rooms/MSender.ts index 0eb8076..4c84cce 100644 --- a/src/rooms/MSender.ts +++ b/src/rooms/MSender.ts @@ -189,6 +189,16 @@ Object.defineProperties(Room.prototype, { value: function (data?: PartResultMsg, options?: any) { this.broadcast('part_result_s2c', data, options); } + }, + /** + * 广播游戏最终结果 + * @param data + * @param options + */ + bGameResult: { + value: function (data?: any, options?: any) { + this.broadcast('game_result_s2c', data, options); + } } }); diff --git a/src/rooms/commands/GameResultCommand.ts b/src/rooms/commands/GameResultCommand.ts index 33b2f5a..cd5dae8 100644 --- a/src/rooms/commands/GameResultCommand.ts +++ b/src/rooms/commands/GameResultCommand.ts @@ -8,6 +8,7 @@ import {GameStateConst} from "../../constants/GameStateConst"; export class GameResultCommand extends Command { execute() { + this.room.bGameResult({}); this.state.gameState = GameStateConst.STATE_GAME_OVER; }