Ejemplo n.º 1
0
 @FXML
 private void handleColorAction(ActionEvent e) {
   invalidColor = false;
   for (Player player : Config.getInstance().playerList) {
     if (colorPicker.getValue().equals(player.getColor())) {
       invalidColor = true;
     }
   }
   if (invalidColor) {
     colorLabel.setTextFill(Color.RED); // disallow same colors
   } else {
     colorLabel.setTextFill(Color.BLACK);
   }
   Config.getInstance()
       .playerList[Config.getInstance().currentPlayer]
       .setColor(colorPicker.getValue());
 }
Ejemplo n.º 2
0
 @FXML
 private void handleNameAction(Event e) {
   emptyName = false;
   for (Player player : Config.getInstance().playerList) {
     if (player.getName().equals("") && player.getId() < numSlider.getValue()) {
       emptyName = true;
     }
   }
   if (emptyName) {
     nameLabel.setTextFill(Color.RED); // disallow empty name
     startButton.setDisable(true);
   } else {
     nameLabel.setTextFill(Color.BLACK);
     startButton.setDisable(false);
   }
   Config.getInstance()
       .playerList[Config.getInstance().currentPlayer]
       .setName(nameField.getText());
 }