use of com.code.server.constant.response.UserVo in project summer by foxsugar.
the class GameUserService method getUserMessage.
public int getUserMessage(KafkaMsgKey msgKey) {
UserBean userBean = userRedisService.getUserBean(msgKey.getUserId());
if (userBean == null) {
return ErrorCode.YOU_HAVE_NOT_LOGIN;
}
String roomId = userRedisService.getRoomId(msgKey.getUserId());
UserVo userVo = userBean.toVo();
userVo.setRoomId(roomId);
ResponseVo vo = new ResponseVo("userService", "getUserMessage", userVo);
sendMsg(msgKey, vo);
return 0;
}
use of com.code.server.constant.response.UserVo in project summer by foxsugar.
the class UserBean method toVo.
@Override
public UserVo toVo() {
UserVo userVo = new UserVo();
userVo.setId(this.id);
// required
userVo.setUsername(this.username);
// required
userVo.setImage(this.image);
// required
userVo.setSeatId(this.seatId);
// required
userVo.setAccount(this.account);
// required
userVo.setIpConfig(this.ipConfig);
// required
userVo.setMoney(this.money);
// required
userVo.setRoomId(this.roomId);
// required
userVo.setVip(this.vip);
// required
userVo.setUuid(this.uuid);
// required
userVo.setOpenId(this.openId);
// required
userVo.setSex(this.sex);
userVo.setReferee(this.referee);
userVo.setUserInfo(this.userInfo);
userVo.setGold(this.getGold());
userVo.setCoord(coord);
return userVo;
}
use of com.code.server.constant.response.UserVo 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