Browse Source

add drawCard Btn

main^2
fdai7736 11 months ago
parent
commit
6f66a2e979
  1. 5
      src/main/java/de/hsfulda/onses/controllers/GameController.java
  2. 2
      src/main/resources/de/hsfulda/onses/views/game.fxml

5
src/main/java/de/hsfulda/onses/controllers/GameController.java

@ -26,6 +26,7 @@ public class GameController implements Controller {
final Pane enemyPane = (Pane) parent.lookup("#enemyPane");
final Pane playerPane = (Pane) parent.lookup("#playerPane");
final Button playButton = (Button) parent.lookup("#playCardBtn");
final Button drawCardButton = (Button) parent.lookup("#drawCardBtn");
CardController lastPlayedCardController = new CardController(game.getLastPlayedCard(), null);
PlayerController playerController = new PlayerController(gameService.getGame().getPlayerService().getPlayerList().getFirst());
@ -50,6 +51,10 @@ public class GameController implements Controller {
}
});
drawCardButton.setOnAction(e -> {
gameService.drawCard(1);
});
lastPlayedCardPane.getChildren().add(lastPlayedCardController.render());
playerPane.getChildren().add(playerController.render());

2
src/main/resources/de/hsfulda/onses/views/game.fxml

@ -36,7 +36,7 @@
<Pane fx:id="playerPane" layoutX="18.0" layoutY="460.0" prefHeight="228.0" prefWidth="950.0" style="-fx-border-color: red;" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="18.0" AnchorPane.rightAnchor="286.0" />
<Pane fx:id="enemyPane" layoutX="18.0" layoutY="14.0" prefHeight="228.0" prefWidth="950.0" style="-fx-border-color: red;" AnchorPane.leftAnchor="18.0" AnchorPane.rightAnchor="286.0" AnchorPane.topAnchor="10.0" />
<Pane fx:id="lastPlayedCardPane" layoutX="112.0" layoutY="245.0" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="200.0" prefWidth="130.0" AnchorPane.leftAnchor="112.0" AnchorPane.topAnchor="245.0" />
<Button layoutX="404.0" layoutY="329.0" mnemonicParsing="false" text="Draw Card" AnchorPane.leftAnchor="404.0" AnchorPane.topAnchor="329.0">
<Button fx:id="drawCardBtn" layoutX="404.0" layoutY="329.0" mnemonicParsing="false" text="Draw Card" AnchorPane.leftAnchor="404.0" AnchorPane.topAnchor="329.0">
<font>
<Font size="18.0" />
</font>

Loading…
Cancel
Save