public PokerTHMessage rejoinGameRequestMsg(int gameId, boolean autoLeave) { RejoinGameMessage rejoinRequest = RejoinGameMessage.newBuilder().setGameId(gameId).setAutoLeave(autoLeave).build(); LobbyMessage lobby = LobbyMessage.newBuilder() .setMessageType(LobbyMessageType.Type_RejoinGameMessage) .setRejoinGameMessage(rejoinRequest) .build(); PokerTHMessage msg = PokerTHMessage.newBuilder() .setMessageType(PokerTHMessageType.Type_LobbyMessage) .setLobbyMessage(lobby) .build(); return msg; }
public PokerTHMessage joinGameRequestMsg( int gameId, String password, boolean autoLeave, boolean spectateOnly) { JoinGameMessage.Builder joinBuilder = JoinGameMessage.newBuilder(); joinBuilder.setGameId(gameId); joinBuilder.setAutoLeave(autoLeave); joinBuilder.setSpectateOnly(spectateOnly); if (!password.isEmpty()) { joinBuilder.setPassword(password); } JoinGameMessage joinExisting = joinBuilder.build(); LobbyMessage lobby = LobbyMessage.newBuilder() .setMessageType(LobbyMessageType.Type_JoinGameMessage) .setJoinGameMessage(joinExisting) .build(); PokerTHMessage msg = PokerTHMessage.newBuilder() .setMessageType(PokerTHMessageType.Type_LobbyMessage) .setLobbyMessage(lobby) .build(); return msg; }
public PokerTHMessage createGameRequestMsg( NetGameInfo gameInfo, String password, boolean autoLeave) { CreateGameMessage.Builder createBuilder = CreateGameMessage.newBuilder(); createBuilder.setRequestId(1); createBuilder.setGameInfo(gameInfo); createBuilder.setAutoLeave(autoLeave); if (!password.isEmpty()) { createBuilder.setPassword(password); } CreateGameMessage createNew = createBuilder.build(); LobbyMessage lobby = LobbyMessage.newBuilder() .setMessageType(LobbyMessageType.Type_CreateGameMessage) .setCreateGameMessage(createNew) .build(); PokerTHMessage msg = PokerTHMessage.newBuilder() .setMessageType(PokerTHMessageType.Type_LobbyMessage) .setLobbyMessage(lobby) .build(); return msg; }