card_svr/src/rooms/commands/DeepAsync.ts
2020-11-30 14:45:21 +08:00

33 lines
797 B
TypeScript

import { Command } from "@colyseus/command";
import { CardGameState } from "../schema/CardGameState";
export class DeepAsync extends Command<CardGameState> {
async execute() {
this.state.i = 0;
return [new DeepOneAsync(), new DeepOneAsync()];
}
}
export class DeepOneAsync extends Command<CardGameState> {
async execute() {
await this.delay(100);
this.state.i += 1;
return [new DeepTwoAsync()];
}
}
export class DeepTwoAsync extends Command<CardGameState> {
async execute() {
await this.delay(100);
this.state.i += 10;
return [new DeepThreeAsync()];
}
}
export class DeepThreeAsync extends Command<CardGameState> {
async execute() {
await this.delay(100);
this.state.i += 100;
}
}