コード例 #1
0
 private void loadGame() {
   try {
     selectedGame = FileManager.loadGame();
   } catch (Exception ex) {
     Logger.getLogger(GameSelectController.class.getName()).log(Level.SEVERE, null, ex);
   }
 }
コード例 #2
0
 private void loadLevel() {
   try {
     int dif = FileManager.loadLevel();
     levels.selectToggle(levelOne);
     for (Toggle e : levels.getToggles()) {
       if (Integer.parseInt(((ToggleButton) e).getText()) == dif) {
         e.setSelected(true);
       }
     }
   } catch (Exception ex) {
     Logger.getLogger(GameSelectController.class.getName()).log(Level.SEVERE, null, ex);
   }
 }
コード例 #3
0
 private void startGame(int level) {
   try {
     FileManager.saveLevel(level);
     Parent root = null;
     switch (selectedGame) {
       case "wordex":
         root = FXMLLoader.load(getClass().getResource(WORDEX));
         break;
       case "wordsearch":
         root = FXMLLoader.load(getClass().getResource(WORD_SEARCH));
         break;
       case "splitwords":
         root = FXMLLoader.load(getClass().getResource(SPLIT_WORDS));
         break;
       case "wordsFromALetter":
         root = FXMLLoader.load(getClass().getResource(WORDS_FROM_A_LETTER));
         break;
       case "correctSpelling":
         root = FXMLLoader.load(getClass().getResource(CORRECT_SPELLING));
         break;
       case "correctSpelling2":
         root = FXMLLoader.load(getClass().getResource(CORRECT_SPELLING2));
         break;
       case "namesAnimalsPlants":
         root = FXMLLoader.load(getClass().getResource(NAMES_ANIMALS_PLANTS));
         break;
       case "coloredBoxes":
         root = FXMLLoader.load(getClass().getResource(COLORED_BOXES));
         break;
       case "matchCards":
         root = FXMLLoader.load(getClass().getResource(MATCH_CARDS));
         break;
       case "faceNameHouse":
         root = FXMLLoader.load(getClass().getResource(FACE_NAME_HOUSE));
         break;
     }
     scale.scaleInterface(root);
     Stage stage = ((Stage) gameLabel.getScene().getWindow());
     stage.sceneProperty().get().setRoot(root);
   } catch (IOException ex) {
     Logger.getLogger(GameSelectController.class.getName()).log(Level.SEVERE, null, ex);
   }
 }
コード例 #4
0
 @Override
 public void initialize(URL url, ResourceBundle rb) {
   initButtons();
   try {
     player = FileManager.loadPlayer();
     playerLabel.setText(player.getName());
     playerLabel.setStyle("-fx-border-color:#00FF69;-fx-border-width:1;");
     loadLevel();
     loadGame();
     instructions();
     updateScores();
     gamePicture();
     instructions.setDisable(false);
     start.setDisable(false);
     updateGameLabel();
   } catch (Exception ex) {
     System.out.println("file error");
   }
 }
コード例 #5
0
 @FXML
 private void handleLevelButtonAction(ActionEvent event) {
   ToggleButton tb = (ToggleButton) event.getSource();
   tb.setSelected(true);
   FileManager.saveLevel(Integer.parseInt(tb.getText()));
 }