示例#1
0
  public void leaveGameLobby(CardGameType gameType, int lobbyId) {
    GameLobbyRequest glr = new GameLobbyRequest(player, lobbyId, gameType);
    isInLobby = false;
    setCurrentLobby(null, -1);
    ServerAccess.leaveLobby(glr);

    if (gameType == CardGameType.War) {
      obj = ServerAccess.getGameLobbyList(glr);
      if (obj != null) {
        warLobbies = (GameLobby[]) obj;
      }
    } else if (gameType == CardGameType.TexasHoldEm) {
      obj = ServerAccess.getGameLobbyList(glr);
      if (obj != null) {
        texasHoldemLobbies = (GameLobby[]) obj;
      }
    } else if (gameType == CardGameType.ERS) {
      obj = ServerAccess.getGameLobbyList(glr);
      if (obj != null) {
        ratscrewLobbies = (GameLobby[]) obj;
      }
    }

    return;
  }
示例#2
0
  /**
   * ******************************************************* Game lobby mgmt model calls.
   * *******************************************************
   */
  public void joinGameLobby(CardGameType gameType, int lobbyId) {
    GameLobbyRequest glr = new GameLobbyRequest(player, lobbyId, gameType);

    if (gameType == CardGameType.War) {
      /* Check for space in lobby */
      if (warLobbies[lobbyId].getPlayers().size() < 2) {
        isInLobby = true;
        setCurrentLobby(gameType, lobbyId);
        ServerAccess.joinLobby(glr);

        obj = ServerAccess.getGameLobbyList(glr);
        if (obj != null) {
          warLobbies = (GameLobby[]) obj;
        }
      }
    } else if (gameType == CardGameType.TexasHoldEm) {
      if (texasHoldemLobbies[lobbyId].getPlayers().size() < 4) {
        isInLobby = true;
        setCurrentLobby(gameType, lobbyId);
        ServerAccess.joinLobby(glr);

        obj = ServerAccess.getGameLobbyList(glr);
        if (obj != null) {
          texasHoldemLobbies = (GameLobby[]) obj;
        }
      }
    } else if (gameType == CardGameType.ERS) {
      System.out.println("hello");
      if (ratscrewLobbies[lobbyId].getPlayers().size() < 2) {
        isInLobby = true;
        setCurrentLobby(gameType, lobbyId);
        ServerAccess.joinLobby(glr);

        obj = ServerAccess.getGameLobbyList(glr);
        if (obj != null) {
          ratscrewLobbies = (GameLobby[]) obj;
        }
      }
    }
    return;
  }