diff --git a/src/cfg/GameEnv.ts b/src/cfg/GameEnv.ts index 196ac69..30dfd26 100644 --- a/src/cfg/GameEnv.ts +++ b/src/cfg/GameEnv.ts @@ -56,6 +56,8 @@ export class GameEnv { public otherEatCount: number; // 轮空轮的间隔时间 public emptyRoundTime: number; + // 玩家初始卡牌数 + public playerInitNums: number[] = []; public init(data: Map) { this.initCardNum = data.get(BaseConst.INIT_CARD_NUM).value; @@ -84,5 +86,11 @@ export class GameEnv { this.selfEatCount = data.get(BaseConst.SELF_EAT_COUNT).value; this.otherEatCount = data.get(BaseConst.OTHER_EAT_COUNT).value; this.emptyRoundTime = data.get(BaseConst.EMPTY_ROUND_TIME).value; + this.playerInitNums = [ + data.get(BaseConst.PLAYER1_INIT_NUM).value, + data.get(BaseConst.PLAYER2_INIT_NUM).value, + data.get(BaseConst.PLAYER3_INIT_NUM).value, + data.get(BaseConst.PLAYER4_INIT_NUM).value, + ] } } diff --git a/src/constants/BaseConst.ts b/src/constants/BaseConst.ts index e515fa0..902f562 100644 --- a/src/constants/BaseConst.ts +++ b/src/constants/BaseConst.ts @@ -51,6 +51,11 @@ export class BaseConst { public static readonly OTHER_EAT_COUNT = 99025 // 轮空轮的间隔时间 public static readonly EMPTY_ROUND_TIME = 99026 + // 各玩家初始卡牌数 + public static readonly PLAYER1_INIT_NUM = 99027 + public static readonly PLAYER2_INIT_NUM = 99028 + public static readonly PLAYER3_INIT_NUM = 99029 + public static readonly PLAYER4_INIT_NUM = 99030 diff --git a/src/rooms/commands/BeginGameCommand.ts b/src/rooms/commands/BeginGameCommand.ts index c93acc8..b067897 100644 --- a/src/rooms/commands/BeginGameCommand.ts +++ b/src/rooms/commands/BeginGameCommand.ts @@ -20,8 +20,9 @@ export class BeginGameCommand extends Command { let cardAll = card0.concat(card1); cardAll.randomSort(); this.state.cardQueue = cardAll; + let i = 1; for (let [id] of this.state.players) { - this.room.addCard(id, new GameEnv().initCardNum, 0); + this.room.addCard(id, new GameEnv().playerInitNums[i++], 0); } this.state.updateGameState(GameStateConst.STATE_CHANGE_CARD); // 超时后结束换卡, 进入下一轮