玩家可看到自己牌的详情
This commit is contained in:
parent
10cb2a1362
commit
3e506bad45
@ -3,13 +3,20 @@ import {CardGameState} from "../schema/CardGameState";
|
||||
import {singleton} from "../../common/Singleton";
|
||||
import {GameEnv} from "../../cfg/GameEnv";
|
||||
import gameUtil from "../../utils/game.util";
|
||||
import {error} from "../../common/Debug";
|
||||
|
||||
/**
|
||||
* 正常的抽卡
|
||||
*/
|
||||
export class DrawCommand extends Command<CardGameState, {}> {
|
||||
execute() {
|
||||
async execute() {
|
||||
let sessionId = this.state.currentTurn;
|
||||
this.room.addCard(sessionId, singleton(GameEnv).roundDrawNum, 0);
|
||||
let maxTime = singleton(GameEnv).maxDiscardTime;
|
||||
await this.delay(maxTime * 1000);
|
||||
if (sessionId == this.state.currentTurn) {
|
||||
error('出牌时间到, 自动出牌');
|
||||
//TODO: 自动出牌
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,13 +5,15 @@ import {GameStateConst} from "../../constants/GameStateConst";
|
||||
import {PlayerStateConst} from "../../constants/PlayerStateConst";
|
||||
import {error} from "../../common/Debug";
|
||||
import {TurnEndCommand} from "./TurnEndCommand";
|
||||
import {singleton} from "../../common/Singleton";
|
||||
import {GameEnv} from "../../cfg/GameEnv";
|
||||
|
||||
/**
|
||||
* 下一轮
|
||||
*/
|
||||
export class NextTurnCommand extends Command<CardGameState, {}> {
|
||||
|
||||
execute() {
|
||||
async execute() {
|
||||
this.state.gameState = GameStateConst.STATE_BEGIN_DRAW;
|
||||
const sessionIds = [...this.state.players.keys()];
|
||||
if (!this.state.currentTurn) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {MapSchema, SetSchema, Schema, type} from "@colyseus/schema";
|
||||
import {MapSchema, SetSchema, Schema, type, filter} from "@colyseus/schema";
|
||||
import {Pet} from "./Pet";
|
||||
import {Card} from "./Card";
|
||||
import {singleton} from "../../common/Singleton";
|
||||
@ -15,6 +15,10 @@ export class Player extends Schema {
|
||||
/**
|
||||
* 手牌
|
||||
*/
|
||||
@filter(function(this: Player, client, value, root) {
|
||||
return (client.sessionId == this.id);
|
||||
})
|
||||
@type({ map: Card })
|
||||
cards = new MapSchema<Card>();
|
||||
|
||||
@type({ set: "string" })
|
||||
|
Loading…
x
Reference in New Issue
Block a user