Merge branch 'second' of http://git.kingsome.cn/node/card_svr into second

This commit is contained in:
yuexin 2020-12-24 19:07:39 +08:00
commit e0b300c064
3 changed files with 15 additions and 1 deletions

View File

@ -56,6 +56,8 @@ export class GameEnv {
public otherEatCount: number; public otherEatCount: number;
// 轮空轮的间隔时间 // 轮空轮的间隔时间
public emptyRoundTime: number; public emptyRoundTime: number;
// 玩家初始卡牌数
public playerInitNums: number[] = [];
public init(data: Map<number, BaseCfg>) { public init(data: Map<number, BaseCfg>) {
this.initCardNum = data.get(BaseConst.INIT_CARD_NUM).value; 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.selfEatCount = data.get(BaseConst.SELF_EAT_COUNT).value;
this.otherEatCount = data.get(BaseConst.OTHER_EAT_COUNT).value; this.otherEatCount = data.get(BaseConst.OTHER_EAT_COUNT).value;
this.emptyRoundTime = data.get(BaseConst.EMPTY_ROUND_TIME).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,
]
} }
} }

View File

@ -51,6 +51,11 @@ export class BaseConst {
public static readonly OTHER_EAT_COUNT = 99025 public static readonly OTHER_EAT_COUNT = 99025
// 轮空轮的间隔时间 // 轮空轮的间隔时间
public static readonly EMPTY_ROUND_TIME = 99026 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

View File

@ -20,8 +20,9 @@ export class BeginGameCommand extends Command<CardGameState, {}> {
let cardAll = card0.concat(card1); let cardAll = card0.concat(card1);
cardAll.randomSort(); cardAll.randomSort();
this.state.cardQueue = cardAll; this.state.cardQueue = cardAll;
let i = 1;
for (let [id] of this.state.players) { 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); this.state.updateGameState(GameStateConst.STATE_CHANGE_CARD);
// 超时后结束换卡, 进入下一轮 // 超时后结束换卡, 进入下一轮