use of com.code.server.game.mahjong.logic.RoomInfo in project summer by foxsugar.
the class GameLogicService method playCard.
public static int playCard(String roomId, long userId, String card) {
RoomInfo roomInfo = (RoomInfo) RoomManager.getRoom(roomId);
GameInfo gameInfo = getGameInfo(roomId);
if (roomInfo != null) {
roomInfo.setCanDissloution(false);
}
return gameInfo.chupai(userId, card);
}
use of com.code.server.game.mahjong.logic.RoomInfo in project summer by foxsugar.
the class ReconnService method reconnection.
public static int reconnection(String roomId, long userId) {
AllMessage allMessage = new AllMessage();
allMessage.setExist(false);
RoomInfo roomInfo = (RoomInfo) RoomManager.getRoom(roomId);
if (roomInfo != null) {
allMessage.setExist(true);
List<UserVo> userList = new ArrayList<>();
allMessage.setRoom(getRoomInfo(roomInfo));
allMessage.setBanker(roomInfo.getBankerId());
allMessage.setCurGameNumber(roomInfo.getCurGameNumber());
allMessage.setUserScores(roomInfo.getUserScores());
allMessage.setUserStatus(roomInfo.getUserStatus());
// 圈数
allMessage.setCircleNum(roomInfo.getCurCircle());
allMessage.getLaZhuang().putAll(roomInfo.getLaZhuang());
allMessage.getLaZhuangStatus().putAll(roomInfo.getLaZhuangStatus());
for (UserBean userBean : RedisManager.getUserRedisService().getUserBeans(roomInfo.getUsers())) {
userList.add(userBean.toVo());
}
// 在线状态
for (long uid : roomInfo.getUsers()) {
allMessage.getOfflineStatus().put(uid, RedisManager.getUserRedisService().getGateId(uid) != null);
}
GameInfo gameInfo = (GameInfo) roomInfo.getGame();
roomInfo.getReady(userId);
if (gameInfo != null) {
ReconnectResp reconnect = new ReconnectResp(gameInfo, userId);
allMessage.setGameId(gameInfo.getGameId());
allMessage.setCardNumber(gameInfo.getRemainCards().size());
allMessage.setReconnectResp(reconnect);
}
allMessage.setUsers(userList);
if (roomInfo.getTimerNode() != null) {
long time = roomInfo.getTimerNode().getStart() + roomInfo.getTimerNode().getInterval() - System.currentTimeMillis();
allMessage.setRemainTime(time);
}
}
ResponseVo vo = new ResponseVo("reconnService", "reconnection", allMessage);
MsgSender.sendMsg2Player(vo, userId);
return 0;
}
Aggregations