From 10cb2a136233bd07339d9fd5a84de055f99d0c06 Mon Sep 17 00:00:00 2001 From: zhl Date: Mon, 7 Dec 2020 16:43:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rooms/commands/ChildAsyncCommand.ts | 13 ---------- src/rooms/commands/ChildCommand.ts | 8 ------- src/rooms/commands/DeepAsync.ts | 32 ------------------------- src/rooms/commands/DeepSync.ts | 29 ---------------------- 4 files changed, 82 deletions(-) delete mode 100644 src/rooms/commands/ChildAsyncCommand.ts delete mode 100644 src/rooms/commands/ChildCommand.ts delete mode 100644 src/rooms/commands/DeepAsync.ts delete mode 100644 src/rooms/commands/DeepSync.ts diff --git a/src/rooms/commands/ChildAsyncCommand.ts b/src/rooms/commands/ChildAsyncCommand.ts deleted file mode 100644 index 31be852..0000000 --- a/src/rooms/commands/ChildAsyncCommand.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Command } from "@colyseus/command"; -import { CardGameState } from "../schema/CardGameState"; - -export class ChildAsyncCommand extends Command { - async execute({ i }: {i: number}) { - await new Promise((resolve) => { - setTimeout(() => { - this.state.round += i; - resolve(); - }, 100) - }) - } -} diff --git a/src/rooms/commands/ChildCommand.ts b/src/rooms/commands/ChildCommand.ts deleted file mode 100644 index 19a6146..0000000 --- a/src/rooms/commands/ChildCommand.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Command } from "@colyseus/command"; -import { CardGameState } from "../schema/CardGameState"; - -export class ChildCommand extends Command { - execute({ i }: {i: number}) { - this.state.round += i; - } -} diff --git a/src/rooms/commands/DeepAsync.ts b/src/rooms/commands/DeepAsync.ts deleted file mode 100644 index 10cd0cb..0000000 --- a/src/rooms/commands/DeepAsync.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command } from "@colyseus/command"; -import { CardGameState } from "../schema/CardGameState"; - -export class DeepAsync extends Command { - async execute() { - this.state.i = 0; - return [new DeepOneAsync(), new DeepOneAsync()]; - } -} - -export class DeepOneAsync extends Command { - async execute() { - await this.delay(100); - this.state.i += 1; - return [new DeepTwoAsync()]; - } -} - -export class DeepTwoAsync extends Command { - async execute() { - await this.delay(100); - this.state.i += 10; - return [new DeepThreeAsync()]; - } -} - -export class DeepThreeAsync extends Command { - async execute() { - await this.delay(100); - this.state.i += 100; - } -} diff --git a/src/rooms/commands/DeepSync.ts b/src/rooms/commands/DeepSync.ts deleted file mode 100644 index 190e5cb..0000000 --- a/src/rooms/commands/DeepSync.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Command } from "@colyseus/command"; -import { CardGameState } from "../schema/CardGameState"; - -export class DeepSync extends Command { - execute() { - this.state.i = 0; - return [new DeepOneSync(), new DeepOneSync()]; - } -} - -export class DeepOneSync extends Command { - execute() { - this.state.i += 1; - return [new DeepTwoSync()]; - } -} - -export class DeepTwoSync extends Command { - execute() { - this.state.i += 10; - return [new DeepThreeSync()]; - } -} - -export class DeepThreeSync extends Command { - execute() { - this.state.i += 100; - } -}