增加游戏结束的广播
This commit is contained in:
parent
4c0aa66ca2
commit
626524eecf
7
src/global.d.ts
vendored
7
src/global.d.ts
vendored
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -8,6 +8,7 @@ import {GameStateConst} from "../../constants/GameStateConst";
|
||||
export class GameResultCommand extends Command<CardGameState, {}> {
|
||||
|
||||
execute() {
|
||||
this.room.bGameResult({});
|
||||
this.state.gameState = GameStateConst.STATE_GAME_OVER;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user