将OnJoinCommand中的魔法数字改为常量
This commit is contained in:
parent
9b151143e3
commit
f2afa98f51
@ -2,6 +2,7 @@ import {Command} from "@colyseus/command";
|
|||||||
import {CardGameState} from "../schema/CardGameState";
|
import {CardGameState} from "../schema/CardGameState";
|
||||||
import {Player} from "../schema/Player";
|
import {Player} from "../schema/Player";
|
||||||
import {Client} from "colyseus";
|
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));
|
this.state.players.set(client.sessionId, new Player(0, team));
|
||||||
if (this.state.players.size >= this.room.maxClients) {
|
if (this.state.players.size >= this.room.maxClients) {
|
||||||
this.room.lock();
|
this.room.lock();
|
||||||
this.state.gameState = 1;
|
this.state.gameState = GameStateConst.STATE_WAIT_PREPARE;
|
||||||
}
|
}
|
||||||
this.room.broadcast("player_join", `${client.sessionId}`, {except: client});
|
this.room.broadcast("player_join", `${client.sessionId}`, {except: client});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user