36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
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 {NextTurnCommand} from "./NextTurnCommand";
|
|
import {Wait} from "./Wait";
|
|
import {PlayerStateConst} from "../../constants/PlayerStateConst";
|
|
|
|
/**
|
|
* 游戏中的结算轮
|
|
* TODO::
|
|
*/
|
|
export class PartResultCommand extends Command<CardGameState, {}> {
|
|
|
|
execute() {
|
|
this.state.gameState = GameStateConst.STATE_ROUND_RESULT;
|
|
const time = singleton(GameEnv).resultShowTime || 1;
|
|
let team0 = [];
|
|
let team1 = [];
|
|
for (let [sessionId, player] of this.state.players) {
|
|
if (player.team == 0) {
|
|
team0.push(player);
|
|
} else {
|
|
team1.unshift(player);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return [new Wait().setPayload(time*1000) ,new NextTurnCommand()];
|
|
}
|
|
|
|
}
|