Browse Source

show cards face down if the player is enemy

main^2
fdai7736 11 months ago
parent
commit
9b39a8f99f
  1. 6
      src/main/java/de/hsfulda/onses/controllers/CardController.java

6
src/main/java/de/hsfulda/onses/controllers/CardController.java

@ -23,6 +23,7 @@ public class CardController implements Controller {
final Pane mainPane = (Pane) parent.lookup("#cardPane"); final Pane mainPane = (Pane) parent.lookup("#cardPane");
final Label cardName = (Label) parent.lookup("#labelName"); final Label cardName = (Label) parent.lookup("#labelName");
if(!card.isFacedown()) {
switch(card.getColor()) { switch(card.getColor()) {
case RED -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: red")); case RED -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: red"));
case BLUE -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: blue")); case BLUE -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: blue"));
@ -30,7 +31,11 @@ public class CardController implements Controller {
case YELLOW -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: yellow")); case YELLOW -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: yellow"));
default -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: black")); default -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: black"));
} }
}
if(card.isFacedown()) {
cardName.setText("Card");
} else {
switch(card.getValue()) { switch(card.getValue()) {
case ONE -> cardName.setText("1"); case ONE -> cardName.setText("1");
case TWO -> cardName.setText("2"); case TWO -> cardName.setText("2");
@ -46,6 +51,7 @@ public class CardController implements Controller {
case DRAWTWO -> cardName.setText("+2"); case DRAWTWO -> cardName.setText("+2");
case REVERSE -> cardName.setText("reverse"); case REVERSE -> cardName.setText("reverse");
} }
}
return parent; return parent;

Loading…
Cancel
Save