将OnJoinCommand中的魔法数字改为常量

This commit is contained in:
zhl 2020-12-02 20:05:24 +08:00
parent 9b151143e3
commit f2afa98f51

View File

@ -2,6 +2,7 @@ import {Command} from "@colyseus/command";
import {CardGameState} from "../schema/CardGameState";
import {Player} from "../schema/Player";
import {Client} from "colyseus";
import {GameStateConst} from "../../constants/GameStateConst";
/**
*
@ -15,7 +16,7 @@ export class OnJoinCommand extends Command<CardGameState, {
this.state.players.set(client.sessionId, new Player(0, team));
if (this.state.players.size >= this.room.maxClients) {
this.room.lock();
this.state.gameState = 1;
this.state.gameState = GameStateConst.STATE_WAIT_PREPARE;
}
this.room.broadcast("player_join", `${client.sessionId}`, {except: client});
}