修正游戏结束广播参数缺少的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 data
|
||||||
* @param options
|
* @param options
|
||||||
*/
|
*/
|
||||||
bGameResult(data?: any, options: any): void;
|
bGameResult(data?: any, options?: any): void;
|
||||||
/**
|
/**
|
||||||
* 发送给个人的消息列表
|
* 发送给个人的消息列表
|
||||||
* @param client
|
* @param client
|
||||||
|
@ -2,9 +2,8 @@ import {Command} from "@colyseus/command";
|
|||||||
import {CardGameState} from "../schema/CardGameState";
|
import {CardGameState} from "../schema/CardGameState";
|
||||||
import {DrawCommand} from "./DrawCommand";
|
import {DrawCommand} from "./DrawCommand";
|
||||||
import {GameStateConst} from "../../constants/GameStateConst";
|
import {GameStateConst} from "../../constants/GameStateConst";
|
||||||
import {singleton} from "../../common/Singleton";
|
import {PlayerStateConst} from "../../constants/PlayerStateConst";
|
||||||
import {GameEnv} from "../../cfg/GameEnv";
|
import {error} from "../../common/Debug";
|
||||||
import {PartResultCommand} from "./PartResultCommand";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下一轮
|
* 下一轮
|
||||||
@ -22,7 +21,15 @@ export class NextTurnCommand extends Command<CardGameState, {}> {
|
|||||||
this.state.currentTurn = (this.state.currentTurn)
|
this.state.currentTurn = (this.state.currentTurn)
|
||||||
? sessionIds[(sessionIds.indexOf(this.state.currentTurn) + 1) % sessionIds.length]
|
? sessionIds[(sessionIds.indexOf(this.state.currentTurn) + 1) % sessionIds.length]
|
||||||
: sessionIds[0];
|
: 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