From cffd7f8db141b8953eed53c2a82ba2997344ec10 Mon Sep 17 00:00:00 2001 From: zhl Date: Mon, 7 Dec 2020 20:17:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=83=E7=89=8C=E7=9A=84?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rooms/commands/DiscardCommand.ts | 12 +++++++++++- src/rooms/commands/DrawCommand.ts | 1 + src/rooms/commands/EatCardCommand.ts | 12 ++++++++++++ src/rooms/commands/NextSubCommand.ts | 3 +++ src/rooms/commands/SelectPetCommand.ts | 8 +++++++- 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/rooms/commands/DiscardCommand.ts b/src/rooms/commands/DiscardCommand.ts index 68c21f5..bdfcb2b 100644 --- a/src/rooms/commands/DiscardCommand.ts +++ b/src/rooms/commands/DiscardCommand.ts @@ -6,6 +6,8 @@ import {NextSubCommand} from "./NextSubCommand"; import {GameStateConst} from "../../constants/GameStateConst"; import {singleton} from "../../common/Singleton"; import {GameEnv} from "../../cfg/GameEnv"; +import {debugRoom} from "../../common/Debug"; +import {TurnEndCommand} from "./TurnEndCommand"; /** * 出牌 @@ -42,7 +44,7 @@ export class DiscardCommand extends Command { let client = self.room.getClient(sessionId); let card = player.cards.values().next().value; debugRoom('出牌时间到, 自动出牌: ', card.id); + player.extraTime = 0; self.room.dispatcher.dispatch(new DiscardCommand(), {client, cards: [card.id], dtype: 1}); } }, maxTime + player.extraTime) diff --git a/src/rooms/commands/EatCardCommand.ts b/src/rooms/commands/EatCardCommand.ts index 5c72017..a9cca87 100644 --- a/src/rooms/commands/EatCardCommand.ts +++ b/src/rooms/commands/EatCardCommand.ts @@ -3,6 +3,10 @@ import {CardGameState} from "../schema/CardGameState"; import {Client} from "colyseus"; import gameUtil from "../../utils/game.util"; import {GameStateConst} from "../../constants/GameStateConst"; +import {singleton} from "../../common/Singleton"; +import {GameEnv} from "../../cfg/GameEnv"; +import {debugRoom} from "../../common/Debug"; +import {TurnEndCommand} from "./TurnEndCommand"; /** * 吃牌 @@ -45,6 +49,14 @@ export class EatCardCommand extends Command { this.state.giveUpCount = 0; let time = singleton(GameEnv).maxEatTime * 1000; let self = this; + // 启动定时, 到时后自动进入下一轮 this.room.mainClock = this.clock.setTimeout(function (){ + debugRoom('吃牌时间到, 进入下一轮') self.room.mainClock.clear(); self.room.dispatcher.dispatch(new TurnEndCommand()); }, time); diff --git a/src/rooms/commands/SelectPetCommand.ts b/src/rooms/commands/SelectPetCommand.ts index 07dad64..3b68fd3 100644 --- a/src/rooms/commands/SelectPetCommand.ts +++ b/src/rooms/commands/SelectPetCommand.ts @@ -71,7 +71,13 @@ export class SelectPetCommand extends Command