Facebook
From Przemysław Sokołowski, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 620
  1. package game.newgame;
  2.  
  3. import java.io.IOException;
  4.  
  5. import game.Main;
  6. import game.YourChar;
  7. import game.startStory.startStoryController;
  8. import javafx.collections.FXCollections;
  9. import javafx.collections.ObservableList;
  10. import javafx.fxml.FXML;
  11. import javafx.scene.control.ChoiceBox;
  12. import javafx.scene.control.Label;
  13. import javafx.scene.control.RadioButton;
  14. import javafx.scene.control.TextField;
  15.  
  16. public class NewGameController{
  17.  
  18.         ObservableList<String> classCharList = FXCollections
  19.                         .observableArrayList("Wojownik", "Zabójca", "Tarczownik");
  20.         private Main main;
  21.         public YourChar newChar;
  22.         @FXML
  23.         public TextField nameField;
  24.         @FXML
  25.         public ChoiceBox classCharBox;
  26.         @FXML
  27.         public RadioButton maleBtn;
  28.         @FXML
  29.         public RadioButton femaleBtn;
  30.         @FXML
  31.         private Label checker;
  32.  
  33.         @FXML
  34.         private void initialize(){
  35.                 classCharBox.setValue("Wojownik");
  36.                 classCharBox.setItems(classCharList);
  37.  
  38.         }
  39.         @FXML
  40.         private void back() throws IOException{
  41.                 main.showGuidMenu();
  42.         }
  43.         @FXML
  44.         private void next() throws IOException{
  45.                 if(nameField.getText().equals("") || !maleBtn.isSelected() && !femaleBtn.isSelected())
  46.                 {
  47.                         checker.setVisible(true);
  48.                 }
  49.                 else
  50.                 {
  51.                 YourChar newChar = new YourChar("hehe","hehe","hehe"); //TEN OBIEKT CHCE WIDZIEĆ W KLASIE startStoryController
  52.                 this.newChar = newChar;
  53.                 main.startStory();
  54.                 }
  55.         }
  56.  
  57. }