Search in sources :

Example 1 with UserOfResult

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

the class RoomDouDiZhu method dissolutionRoom.

// @Override
// protected Game getGameInstance() {
// switch (gameType) {
// case GAMETYPE_LINFEN:
// return new GameDouDiZhuLinFen();
// case GAMETYPE_QIANAN:
// return new GameDouDiZhuQianAn();
// case GAMETYPE_LONGQI:
// return new GameDouDiZhu();
// case GAMETYPE_LONGQI_LINFEN:
// return new GameDouDiZhuLinFenLongQi();
// case GAMETYPE_LONGQI_LINFEN_NO_QIANG:
// return new GameDouDiZhuLinFenNoQiang();
// 
// case GAMETYPE_LONGQI_NO_QIANG:
// return new GameDouDiZhuNoQiang();
// default:
// return new GameDouDiZhu();
// }
// 
// }
public void dissolutionRoom() {
    if (RoomManager.getRoom(this.roomId) == null) {
        return;
    }
    RoomManager.removeRoom(this.roomId);
    // 结果类
    List<UserOfResult> userOfResultList = getUserOfResult();
    // 代开房 并且游戏未开始
    if (!isCreaterJoin && !this.isInGame && this.curGameNumber == 1) {
        drawBack();
        GameTimer.removeNode(this.prepareRoomTimerNode);
    }
    if ((this.isInGame || !isCreaterJoin) && this.curGameNumber == 1) {
        drawBack();
    }
    this.isInGame = false;
    // 存储返回
    GameOfResult gameOfResult = new GameOfResult();
    gameOfResult.setUserList(userOfResultList);
    gameOfResult.setEndTime(LocalDateTime.now().toString());
    MsgSender.sendMsg2Player(new ResponseVo("gameService", "askNoticeDissolutionResult", gameOfResult), users);
    // 战绩
    genRoomRecord();
}
Also used : UserOfResult(com.code.server.constant.response.UserOfResult) GameOfResult(com.code.server.constant.response.GameOfResult) ResponseVo(com.code.server.constant.response.ResponseVo)

Example 2 with UserOfResult

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

the class GameInfo method noticeDissolutionResult.

public void noticeDissolutionResult() {
    if (isRoomOver()) {
        List<UserOfResult> userOfResultList = this.room.getUserOfResult();
        // 存储返回
        GameOfResult gameOfResult = new GameOfResult();
        gameOfResult.setUserList(userOfResultList);
        RoomManager.removeRoom(room.getRoomId());
        MsgSender.sendMsg2Player("gameService", "noticeDissolutionResult", gameOfResult, users);
        // 战绩
        this.room.genRoomRecord();
    }
}
Also used : UserOfResult(com.code.server.constant.response.UserOfResult) GameOfResult(com.code.server.constant.response.GameOfResult)

Example 3 with UserOfResult

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

the class GameGoldPaijiu method sendFinalResult.

/**
 * 最终结算版
 */
public void sendFinalResult() {
    List<UserOfResult> userOfResultList = this.roomPaijiu().getUserOfResult();
    for (UserOfResult u : userOfResultList) {
        double d = Double.parseDouble(u.getScores());
        if (u.getUserId() == roomPaijiu().getBankerId()) {
            u.setScores(d + "");
            // userId-money
            RedisManager.getUserRedisService().addUserMoney(u.getUserId(), d - this.roomPaijiu().bankerInitScore());
        } else {
            u.setScores(d - RedisManager.getUserRedisService().getUserMoney(u.getUserId()) + "");
            // userId-money
            RedisManager.getUserRedisService().addUserMoney(u.getUserId(), d - RedisManager.getUserRedisService().getUserMoney(u.getUserId()));
        }
        MsgSender.sendMsg2Player(new ResponseVo("userService", "refresh", 0), u.getUserId());
    }
    // 存储返回
    GameOfResult gameOfResult = new GameOfResult();
    gameOfResult.setUserList(userOfResultList);
    MsgSender.sendMsg2Player("gameService", "gamePaijiuFinalResult", gameOfResult, users);
    RoomManager.removeRoom(this.roomPaijiu().getRoomId());
    // 庄家初始分 再减掉
    this.roomPaijiu().addUserSocre(this.roomPaijiu().getBankerId(), -this.roomPaijiu().bankerInitScore());
    // 战绩
    this.roomPaijiu().genRoomRecord();
/*for (Long l:this.roomPaijiu().userScores.keySet()) {
            RedisManager.getUserRedisService().setUserMoney(l, roomPaijiu().userScores.get(l));//userId-money
        }*/
}
Also used : UserOfResult(com.code.server.constant.response.UserOfResult) GameOfResult(com.code.server.constant.response.GameOfResult) ResponseVo(com.code.server.constant.response.ResponseVo)

Example 4 with UserOfResult

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

the class RoomGoldPaijiu method dissolutionRoom.

/**
 * 解散房间
 */
@Override
public void dissolutionRoom() {
    // 庄家初始分 再减掉
    RoomManager.removeRoom(this.roomId);
    // 结果类
    List<UserOfResult> userOfResultList = getUserOfResult();
    // 代开房 并且游戏未开始
    if (!isCreaterJoin && !this.isInGame && (this.curGameNumber == 1)) {
        drawBack();
        GameTimer.removeNode(this.prepareRoomTimerNode);
    }
    this.isInGame = false;
    // 存储返回
    GameOfResult gameOfResult = new GameOfResult();
    for (UserOfResult u : userOfResultList) {
        double d = Double.parseDouble(u.getScores());
        if (u.getUserId() == this.getBankerId()) {
            u.setScores(d + "");
            // userId-money
            RedisManager.getUserRedisService().addUserMoney(u.getUserId(), d - this.bankerInitScore());
        } else {
            u.setScores(d - RedisManager.getUserRedisService().getUserMoney(u.getUserId()) + "");
            // userId-money
            RedisManager.getUserRedisService().addUserMoney(u.getUserId(), d - RedisManager.getUserRedisService().getUserMoney(u.getUserId()));
        }
        MsgSender.sendMsg2Player(new ResponseVo("userService", "refresh", 0), u.getUserId());
    }
    gameOfResult.setUserList(userOfResultList);
    gameOfResult.setEndTime(LocalDateTime.now().toString());
    MsgSender.sendMsg2Player(new ResponseVo("gameService", "askNoticeDissolutionResult", gameOfResult), users);
    // 庄家初始分 再减掉
    this.addUserSocre(this.getBankerId(), -this.bankerInitScore());
    // 战绩
    genRoomRecord();
}
Also used : UserOfResult(com.code.server.constant.response.UserOfResult) GameOfResult(com.code.server.constant.response.GameOfResult) ResponseVo(com.code.server.constant.response.ResponseVo)

Example 5 with UserOfResult

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

the class GameCow method sendFinalResult.

/**
 * 最后结算
 */
protected void sendFinalResult() {
    // 所有牌局都结束
    if (room.getCurGameNumber() > room.getGameNumber()) {
        List<UserOfResult> userOfResultList = this.room.getUserOfResult();
        // 存储返回
        GameOfResult gameOfResult = new GameOfResult();
        gameOfResult.setUserList(userOfResultList);
        MsgSender.sendMsg2Player("gameService", "gameFinalResult", gameOfResult, users);
        RoomManager.removeRoom(room.getRoomId());
        // 战绩
        this.room.genRoomRecord();
        RoomManager.getRobotRoom().remove(room);
    }
}
Also used : UserOfResult(com.code.server.constant.response.UserOfResult) GameOfResult(com.code.server.constant.response.GameOfResult)

Aggregations

GameOfResult (com.code.server.constant.response.GameOfResult)5 UserOfResult (com.code.server.constant.response.UserOfResult)5 ResponseVo (com.code.server.constant.response.ResponseVo)3