card_svr/src/rooms/commands/EnqueueAsyncCommand.ts
2020-12-01 17:02:01 +08:00

13 lines
435 B
TypeScript

import { Command } from "@colyseus/command";
import { CardGameState } from "../schema/CardGameState";
import {ChildAsyncCommand} from "./ChildAsyncCommand";
export class EnqueueAsyncCommand extends Command<CardGameState, { count: number }> {
async execute({ count }: {count: number}) {
this.state.round = 0;
return [...Array(count)].map(_ =>
new ChildAsyncCommand().setPayload({ i: count }));
}
}