diff --git a/src/main/java/controller/GameController.java b/src/main/java/controller/GameController.java index 019ef710..aa13c8e9 100644 --- a/src/main/java/controller/GameController.java +++ b/src/main/java/controller/GameController.java @@ -677,4 +677,8 @@ public int getPlayerDeckSize() { public int getOpponentDeckSize() { return game.getOpponentGameBoard().getOwner().getUserDeck().getActiveDeck().getMainDeck().size(); } + + public String getGamePhase() { + return game.getPhase(); + } } \ No newline at end of file diff --git a/src/main/java/view/gui/DuelMenuGui.java b/src/main/java/view/gui/DuelMenuGui.java index 5468abe3..1cfeffcd 100644 --- a/src/main/java/view/gui/DuelMenuGui.java +++ b/src/main/java/view/gui/DuelMenuGui.java @@ -72,6 +72,8 @@ public class DuelMenuGui extends MenuGui { public Text playerNickNameText; @FXML public Text playerUserNameText; + @FXML + public Label phaseLabel; static { duelMenuMethods = DuelMenuGui.class.getDeclaredMethods(); @@ -200,6 +202,7 @@ public void updateGameBoard() { updatePlayerLifePoint(); updateOpponentLifePoint(); updateDecks(); + updatePhase(); } private void updateFields(ArrayList cardData, String fieldName) { @@ -319,6 +322,11 @@ private void updateDecks() { fieldPane.getChildren().addAll(playerDeckStackPane, opponentDeckStackPane); } + private void updatePhase() { + String phase = gameController.getGamePhase(); + phaseLabel.setText(phase); + } + private boolean getVisibility(String fieldName, String cardName) { boolean isVisible = true; if (fieldName.equals(CARD_FIELDS[3])) { @@ -645,8 +653,9 @@ public ArrayList getCardsForTribute(int i) { "Leave field empty to cancel summon."); String[] numbers = input.split(" "); ArrayList positions = new ArrayList<>(); + // add (position - 1) to ArrayList because zero-indexed fields: for (String num : numbers) - positions.add(Integer.parseInt(num)); + positions.add(Integer.parseInt(num) - 1); return positions; } catch (NumberFormatException exception) { showMessage("Invalid input format. Try again!"); diff --git a/src/main/java/view/gui/GetInput.java b/src/main/java/view/gui/GetInput.java index b71ebb19..bc05f0ce 100644 --- a/src/main/java/view/gui/GetInput.java +++ b/src/main/java/view/gui/GetInput.java @@ -38,6 +38,7 @@ public static Boolean getTwoChoiceAnswer(String question, String trueOption, Str BorderPane borderPane = new BorderPane(); Text text = new Text(question); + text.setWrappingWidth(350); text.setFont(new Font("Bold", 14)); text.setStyle("-fx-fill: white"); HBox hBox = new HBox(text); @@ -67,7 +68,7 @@ public static Boolean getTwoChoiceAnswer(String question, String trueOption, Str hBox1.getChildren().addAll(yesButton, noButton); borderPane.setBottom(hBox1); - Scene scene = new Scene(borderPane, 350, 70); + Scene scene = new Scene(borderPane, 400, 150); getYesOrNoAnswerPopupWindow.setScene(scene); getYesOrNoAnswerPopupWindow.setTitle("Duel"); getYesOrNoAnswerPopupWindow.showAndWait(); @@ -83,6 +84,7 @@ public static String getStringAnswerPopupWindow(String title, String question) { BorderPane borderPane = new BorderPane(); Text text = new Text(question); + text.setWrappingWidth(450); text.setFont(new Font("Bold", 14)); text.setStyle("-fx-background-color: #0404e9; -fx-fill: white"); TextField textField = new TextField(null); @@ -111,7 +113,7 @@ public static String getStringAnswerPopupWindow(String title, String question) { hBox.setAlignment(Pos.CENTER); borderPane.setBottom(hBox); - getStringAnswerPopupWindow.setScene(new Scene(borderPane, 450, 250)); + getStringAnswerPopupWindow.setScene(new Scene(borderPane, 500, 300)); getStringAnswerPopupWindow.setResizable(false); getStringAnswerPopupWindow.setTitle(title); getStringAnswerPopupWindow.showAndWait(); diff --git a/src/main/java/view/gui/ShowGameMessage.java b/src/main/java/view/gui/ShowGameMessage.java index 8b12667a..ecb25bd9 100644 --- a/src/main/java/view/gui/ShowGameMessage.java +++ b/src/main/java/view/gui/ShowGameMessage.java @@ -37,7 +37,6 @@ public void start(Stage prevStage) throws IOException { stage.initStyle(StageStyle.UNDECORATED); stage.toFront(); stage.requestFocus(); - stage.setAlwaysOnTop(true); stage.show(); } diff --git a/src/main/java/view/gui/ShowOutput.java b/src/main/java/view/gui/ShowOutput.java index 553d283d..1200bd9e 100644 --- a/src/main/java/view/gui/ShowOutput.java +++ b/src/main/java/view/gui/ShowOutput.java @@ -22,6 +22,7 @@ public static void showOutput(String title, String header) { BorderPane borderPane = new BorderPane(); Text text = new Text(header); + text.setWrappingWidth(400); text.setFont(new Font("Arial", 14)); text.setStyle("-fx-fill: white"); HBox hBox = new HBox(text); @@ -39,7 +40,7 @@ public static void showOutput(String title, String header) { bottomHBox.setAlignment(Pos.CENTER); borderPane.setBottom(bottomHBox); - showOutPutPopUpWindow.setScene(new Scene(borderPane, 400, 120)); + showOutPutPopUpWindow.setScene(new Scene(borderPane, 450, 150)); showOutPutPopUpWindow.setTitle(title); showOutPutPopUpWindow.showAndWait(); } diff --git a/src/main/resources/view/gui/DuelMenuGui.fxml b/src/main/resources/view/gui/DuelMenuGui.fxml index f56a36c0..37257333 100644 --- a/src/main/resources/view/gui/DuelMenuGui.fxml +++ b/src/main/resources/view/gui/DuelMenuGui.fxml @@ -10,10 +10,11 @@ - + - +
@@ -26,20 +27,23 @@ - - - + + +
- + - @@ -47,9 +51,11 @@
- - - + + +
@@ -57,19 +63,20 @@ - @@ -77,143 +84,161 @@
- - - - - - - -
+ + + + + +
@@ -222,5 +247,4 @@ - diff --git a/src/main/resources/view/gui/styles/DuelMenuGui.css b/src/main/resources/view/gui/styles/DuelMenuGui.css index 96ae219b..d418c4d9 100644 --- a/src/main/resources/view/gui/styles/DuelMenuGui.css +++ b/src/main/resources/view/gui/styles/DuelMenuGui.css @@ -3,6 +3,11 @@ -fx-background-color: #93a1a7; } +.button { + -fx-background-color: #dd0202; + -fx-text-fill: white; +} + #selectedCardDescription { -fx-background-color: #eee0b1; -fx-font-family: Arial; @@ -10,11 +15,14 @@ -fx-border-color: #cb9a45; } -.button { - -fx-background-color: #dd0202; - -fx-text-fill: white; -} - #buttonPane { -fx-background-color: #141414; +} + +#phaseLabel { + -fx-background-color: #dd0202; + -fx-text-fill: white; + -fx-font-family: Arial; + -fx-font-weight: bold; + -fx-background-radius: 3px; } \ No newline at end of file