Browse Source

show cards face down if the player is enemy

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

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

@ -23,28 +23,34 @@ public class CardController implements Controller {
final Pane mainPane = (Pane) parent.lookup("#cardPane");
final Label cardName = (Label) parent.lookup("#labelName");
switch(card.getColor()) {
case RED -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: red"));
case BLUE -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: blue"));
case GREEN -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: green"));
case YELLOW -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: yellow"));
default -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: black"));
if(!card.isFacedown()) {
switch(card.getColor()) {
case RED -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: red"));
case BLUE -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: blue"));
case GREEN -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: green"));
case YELLOW -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: yellow"));
default -> mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: black"));
}
}
switch(card.getValue()) {
case ONE -> cardName.setText("1");
case TWO -> cardName.setText("2");
case THREE -> cardName.setText("3");
case FOUR -> cardName.setText("4");
case FIVE -> cardName.setText("5");
case SIX -> cardName.setText("6");
case SEVEN -> cardName.setText("7");
case EIGHT -> cardName.setText("8");
case NINE -> cardName.setText("9");
case SKIP -> cardName.setText("skip player");
case CHOOSE -> cardName.setText("wish card");
case DRAWTWO -> cardName.setText("+2");
case REVERSE -> cardName.setText("reverse");
if(card.isFacedown()) {
cardName.setText("Card");
} else {
switch(card.getValue()) {
case ONE -> cardName.setText("1");
case TWO -> cardName.setText("2");
case THREE -> cardName.setText("3");
case FOUR -> cardName.setText("4");
case FIVE -> cardName.setText("5");
case SIX -> cardName.setText("6");
case SEVEN -> cardName.setText("7");
case EIGHT -> cardName.setText("8");
case NINE -> cardName.setText("9");
case SKIP -> cardName.setText("skip player");
case CHOOSE -> cardName.setText("wish card");
case DRAWTWO -> cardName.setText("+2");
case REVERSE -> cardName.setText("reverse");
}
}

Loading…
Cancel
Save