增加游戏结束的广播

This commit is contained in:
zhl 2020-12-07 13:25:34 +08:00
parent 4c0aa66ca2
commit 626524eecf
3 changed files with 18 additions and 0 deletions

7
src/global.d.ts vendored
View File

@ -111,6 +111,13 @@ declare module "colyseus" {
* @param options * @param options
*/ */
bPartResult(data?: PartResultMsg, options?: any): void; bPartResult(data?: PartResultMsg, options?: any): void;
/**
* 广
* @param data
* @param options
*/
bGameResult(data?: any, options: any): void;
/** /**
* *
* @param client * @param client

View File

@ -189,6 +189,16 @@ Object.defineProperties(Room.prototype, {
value: function (data?: PartResultMsg, options?: any) { value: function (data?: PartResultMsg, options?: any) {
this.broadcast('part_result_s2c', data, options); 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);
}
} }
}); });

View File

@ -8,6 +8,7 @@ import {GameStateConst} from "../../constants/GameStateConst";
export class GameResultCommand extends Command<CardGameState, {}> { export class GameResultCommand extends Command<CardGameState, {}> {
execute() { execute() {
this.room.bGameResult({});
this.state.gameState = GameStateConst.STATE_GAME_OVER; this.state.gameState = GameStateConst.STATE_GAME_OVER;
} }