Search in sources :

Example 1 with ResponseVo

use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.

the class GameCow method raise.

/**
 * 加注
 * @return
 */
public int raise(long userId, double addChip) throws Exception {
    logger.info(userId + "  下注: " + addChip);
    Map<String, Object> result = new HashMap<>();
    result.put("userId", userId);
    result.put("addChip", addChip);
    ResponseVo vo = new ResponseVo("gameService", "raiseResponse", result);
    MsgSender.sendMsg2Player(vo, users);
    MsgSender.sendMsg2Player("gameService", "raise", 0, userId);
    PlayerCow playerCardInfo = playerCardInfos.get(userId);
    playerCardInfo.setRaise(1);
    playerCardInfo.setScore(addChip);
    boolean b = true;
    for (PlayerCow p : playerCardInfos.values()) {
        if (room.getBankerId() != p.userId && 0 == p.getRaise()) {
            b = false;
        }
    }
    if (b) {
        dealFiveCard();
        noticePlayerCompare();
        this.step = IGameConstant.STEP_COMPARE;
        updateLastOperateTime();
    }
    return 0;
}
Also used : ResponseVo(com.code.server.constant.response.ResponseVo)

Example 2 with ResponseVo

use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.

the class GameCow method compare.

/**
 * 开牌
 * @return
 */
public int compare(long userId) {
    logger.info(userId + "  开牌: ");
    Map<String, Object> result = new HashMap<>();
    result.put("userId", userId);
    ResponseVo vo = new ResponseVo("gameService", "compareResponse", result);
    MsgSender.sendMsg2Player(vo, users);
    MsgSender.sendMsg2Player("gameService", "compare", 0, userId);
    PlayerCow playerCardInfo = playerCardInfos.get(userId);
    playerCardInfo.setKill(1);
    boolean b = true;
    for (PlayerCow p : playerCardInfos.values()) {
        if (0 == p.getKill()) {
            b = false;
        }
    }
    if (b) {
        // 自动结束
        this.step = 0;
        compute();
        sendResult();
        genRecord();
        room.clearReadyStatus(true);
        updateLastOperateTime();
        updateRoomLastTime();
        sendFinalResult();
    }
    return 0;
}
Also used : ResponseVo(com.code.server.constant.response.ResponseVo)

Example 3 with ResponseVo

use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.

the class GameCow method init.

public void init(List<Long> users) {
    // 初始化玩家
    for (Long uid : users) {
        PlayerCow playerCardInfo = getGameTypePlayerCardInfo();
        playerCardInfo.userId = uid;
        playerCardInfos.put(uid, playerCardInfo);
    }
    this.users.addAll(users);
    // 通知游戏开始
    MsgSender.sendMsg2Player(new ResponseVo("gameService", "gameCowBegin", "ok"), room.users);
    // 洗牌
    shuffle();
    // 发牌
    deal();
    noticePlayerBet();
    this.step = IGameConstant.STEP_RAISE;
    updateLastOperateTime();
}
Also used : ResponseVo(com.code.server.constant.response.ResponseVo)

Example 4 with ResponseVo

use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.

the class GameDouDiZhuJixian method dizhuAddTableCards.

protected void dizhuAddTableCards() {
    // 把底牌加到地主身上
    PlayerCardInfoDouDiZhu playerCardInfo = playerCardInfos.get(dizhu);
    if (playerCardInfo != null) {
        playerCardInfo.cards.addAll(tableCards);
        // 给所有人看
        MsgSender.sendMsg2Player(new ResponseVo("gameService", "showTableCard", tableCards), dizhu);
    }
}
Also used : ResponseVo(com.code.server.constant.response.ResponseVo)

Example 5 with ResponseVo

use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.

the class GameDouDiZhuLinFen method dizhuAddTableCards.

/**
 * 底牌加到地主身上
 */
protected void dizhuAddTableCards() {
    // 把底牌加到地主身上
    PlayerCardInfoDouDiZhu playerCardInfo = playerCardInfos.get(dizhu);
    if (playerCardInfo != null) {
        playerCardInfo.cards.addAll(tableCards);
        // 给所有人看
        MsgSender.sendMsg2Player(new ResponseVo("gameService", "showTableCard", tableCards), dizhu);
    }
}
Also used : ResponseVo(com.code.server.constant.response.ResponseVo)

Aggregations

ResponseVo (com.code.server.constant.response.ResponseVo)125 Club (com.code.server.db.model.Club)17 HashMap (java.util.HashMap)15 UserBean (com.code.server.constant.game.UserBean)8 IdWorker (com.code.server.util.IdWorker)8 ServerConfig (com.code.server.game.poker.config.ServerConfig)7 ArrayList (java.util.ArrayList)7 JsonNode (com.fasterxml.jackson.databind.JsonNode)6 ClubMember (com.code.server.constant.club.ClubMember)5 Charge (com.code.server.db.model.Charge)5 User (com.code.server.db.model.User)5 GameOfResult (com.code.server.constant.response.GameOfResult)4 UserOfResult (com.code.server.constant.response.UserOfResult)4 TimerNode (com.code.server.util.timer.TimerNode)4 RoomModel (com.code.server.constant.club.RoomModel)3 KafkaMsgKey (com.code.server.constant.kafka.KafkaMsgKey)3 com.code.server.game.mahjong.response (com.code.server.game.mahjong.response)3 MsgSender (com.code.server.game.room.kafka.MsgSender)3 MsgProducer (com.code.server.kafka.MsgProducer)3 Map (java.util.Map)3