修正游戏结束广播参数缺少的bug
This commit is contained in:
parent
626524eecf
commit
7dc9f2ae99
2
src/global.d.ts
vendored
2
src/global.d.ts
vendored
@ -117,7 +117,7 @@ declare module "colyseus" {
|
||||
* @param data
|
||||
* @param options
|
||||
*/
|
||||
bGameResult(data?: any, options: any): void;
|
||||
bGameResult(data?: any, options?: any): void;
|
||||
/**
|
||||
* 发送给个人的消息列表
|
||||
* @param client
|
||||
|
@ -2,9 +2,8 @@ import {Command} from "@colyseus/command";
|
||||
import {CardGameState} from "../schema/CardGameState";
|
||||
import {DrawCommand} from "./DrawCommand";
|
||||
import {GameStateConst} from "../../constants/GameStateConst";
|
||||
import {singleton} from "../../common/Singleton";
|
||||
import {GameEnv} from "../../cfg/GameEnv";
|
||||
import {PartResultCommand} from "./PartResultCommand";
|
||||
import {PlayerStateConst} from "../../constants/PlayerStateConst";
|
||||
import {error} from "../../common/Debug";
|
||||
|
||||
/**
|
||||
* 下一轮
|
||||
@ -22,7 +21,15 @@ export class NextTurnCommand extends Command<CardGameState, {}> {
|
||||
this.state.currentTurn = (this.state.currentTurn)
|
||||
? sessionIds[(sessionIds.indexOf(this.state.currentTurn) + 1) % sessionIds.length]
|
||||
: sessionIds[0];
|
||||
return [new DrawCommand()]
|
||||
let player = this.state.players.get(this.state.currentTurn);
|
||||
if (!player) {
|
||||
error('未找到玩家');
|
||||
}
|
||||
if (player.state == PlayerStateConst.PLAYER_DEAD) {
|
||||
return [new NextTurnCommand()];
|
||||
} else {
|
||||
return [new DrawCommand()]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user