コード例 #1
0
  @FXML
  private void handlePlay() {

    eGameState = eGameState.StartOfGame;

    // Clear all players hands
    hBoxP1Cards.getChildren().clear();
    hBoxP2Cards.getChildren().clear();
    hBoxP3Cards.getChildren().clear();
    hBoxP4Cards.getChildren().clear();

    // Face down card (will represent the deck)
    ImageView imgBottomCard =
        new ImageView(
            new Image(getClass().getResourceAsStream("/res/img/b1fh.png"), 75, 75, true, true));

    HboxCommonArea.getChildren().clear();
    HboxCommonArea.getChildren().add(imgBottomCard);
    HboxCommunityCards.getChildren().clear();

    // ensures play cannot be pressed without selecting a game type
    // this still allows you to hit draw, so something more robust is needed,
    // or something has to be added to handleDraw()
    if (this.mainApp.getiGameType() == null) {
      displayWarning("you must select a game to play from the menu");
      return;
    }

    // Get the Rule, start the Game
    Rule rle = new Rule(this.mainApp.getiGameType());
    gme = new GamePlay(rle);

    // Add the seated players to the game, create a GPPH for the player
    for (Player p : mainApp.GetSeatedPlayers()) {
      gme.addPlayerToGame(p);
      GamePlayPlayerHand GPPH = new GamePlayPlayerHand();
      GPPH.setGame(gme);
      GPPH.setPlayer(p);
      GPPH.setHand(new Hand());
      gme.addGamePlayPlayerHand(GPPH);
      DealFaceDownCards(gme.getNbrOfCards(), p.getiPlayerPosition());
    }

    // Add the common player (community player) to the game
    GamePlayPlayerHand GPCH = new GamePlayPlayerHand();
    GPCH.setGame(gme);
    GPCH.setPlayer(PlayerCommon);
    GPCH.setHand(new Hand());
    gme.addGamePlayCommonHand(GPCH);
    DealFaceDownCards(gme.getRule().GetCommunityCardsCount(), 0);

    // Add a deck to the game
    gme.setGameDeck(new Deck(rle.GetNumberOfJokers(), rle.GetRuleCards()));

    // Call common code to set the game controls
    SetGameControls(eGameState);
  }
コード例 #2
0
  @FXML
  private void handlePlay() {

    eGameState = eGameState.StartOfGame;

    // Clear all players hands
    hBoxP1Cards.getChildren().clear();
    hBoxP2Cards.getChildren().clear();
    hBoxP3Cards.getChildren().clear();
    hBoxP4Cards.getChildren().clear();

    // Face down card (will represent the deck)
    ImageView imgBottomCard =
        new ImageView(
            new Image(getClass().getResourceAsStream("/res/img/b1fh.png"), 75, 75, true, true));

    HboxCommonArea.getChildren().clear();
    HboxCommonArea.getChildren().add(imgBottomCard);
    HboxCommunityCards.getChildren().clear();

    // Get the Rule, start the Game
    Rule rle = new Rule(eGame.Omaha);
    gme = new GamePlay(rle);

    // Add the seated players to the game, create a GPPH for the player
    for (Player p : mainApp.GetSeatedPlayers()) {
      gme.addPlayerToGame(p);
      GamePlayPlayerHand GPPH = new GamePlayPlayerHand();
      GPPH.setGame(gme);
      GPPH.setPlayer(p);
      GPPH.setHand(new Hand());
      gme.addGamePlayPlayerHand(GPPH);
      DealFaceDownCards(gme.getNbrOfCards(), p.getiPlayerPosition());
    }

    // Add the common player (community player) to the game
    GamePlayPlayerHand GPCH = new GamePlayPlayerHand();
    GPCH.setGame(gme);
    GPCH.setPlayer(PlayerCommon);
    GPCH.setHand(new Hand());
    gme.addGamePlayCommonHand(GPCH);
    DealFaceDownCards(gme.getRule().GetCommunityCardsCount(), 0);

    // Add a deck to the game
    gme.setGameDeck(new Deck(rle.GetNumberOfJokers(), rle.GetRuleCards()));

    // Call common code to set the game controls
    SetGameControls(eGameState);
  }