End-Screen - anfang des Eingbindens des Spiel-Neustarts & Persönliche Highscores
This commit is contained in:
parent
98bcfec0fd
commit
3610c3fb7a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -25,6 +25,7 @@ public class HappyBirdMain extends Application {
|
||||
private int collectedPoints;
|
||||
private int playerhighscore;
|
||||
private boolean openEndScreen = false;
|
||||
private boolean endScreenOpened = false;
|
||||
/* Formatierungsklasse */
|
||||
private final FormatingClass formatingClass = new FormatingClass();
|
||||
|
||||
@ -445,8 +446,9 @@ public class HappyBirdMain extends Application {
|
||||
for (Rectangle rectangle : pipesToRemove) {
|
||||
pipesArrayList.remove(rectangle);
|
||||
}
|
||||
} else {
|
||||
} else if (endScreenOpened == false) {
|
||||
generateEndScreen();
|
||||
endScreenOpened = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -895,9 +897,10 @@ public class HappyBirdMain extends Application {
|
||||
*/
|
||||
public String calculatePersonalHighscores() {
|
||||
String bestFiveHighscores = "PLAYER\t\tSCORE\n\n";
|
||||
String currentPlayer = acronymLabel.getText();
|
||||
String currentPlayer = acronym.getText();
|
||||
int i = 0;
|
||||
String sql = "SELECT * FROM happybirddb WHERE kuerzel = '" + currentPlayer + "' ORDER BY punkte DESC LIMIT 5;";
|
||||
System.out.println(sql);
|
||||
try (ResultSet rs = datenbank.st.executeQuery(sql)) {
|
||||
while (rs.next())
|
||||
{
|
||||
@ -1035,6 +1038,11 @@ public class HappyBirdMain extends Application {
|
||||
*/
|
||||
private void restartGameButtonClick() {
|
||||
pane.getChildren().remove(endScreen);
|
||||
pane.getChildren().remove(happyBird);
|
||||
for (Rectangle pipe : pipesArrayList) {
|
||||
pane.getChildren().remove(pipe);
|
||||
}
|
||||
collectedPoints = 0;
|
||||
startGameButtonClick();
|
||||
}
|
||||
|
||||
@ -1044,6 +1052,7 @@ public class HappyBirdMain extends Application {
|
||||
*/
|
||||
private void personalHighscoresButtonClick() {
|
||||
/* alle Buttons ausblenden */
|
||||
System.out.println("Highscore-Button");
|
||||
for(Button button : endscreenButtons) {
|
||||
button.setVisible(false);
|
||||
}
|
||||
@ -1057,12 +1066,11 @@ public class HappyBirdMain extends Application {
|
||||
currentScoreEndscreenLabel.setVisible(false);
|
||||
|
||||
/* Highscore-Label (Hintergrund) formatieren und einfügen */
|
||||
highscoreMenuLabel.setLayoutX(275);
|
||||
highscoreMenuLabel.setLayoutY(225);
|
||||
highscoreMenuLabel.setPrefHeight(300);
|
||||
highscoreMenuLabel.setPrefSize(250, 250);
|
||||
highscoreMenuLabel.setVisible(true);
|
||||
highscoreMenuLabel.setLayoutX(75);
|
||||
highscoreMenuLabel.setLayoutY(150);
|
||||
highscoreMenuLabel.setPrefSize(250, 300);
|
||||
endScreen.getChildren().add(highscoreMenuLabel);
|
||||
highscoreMenuLabel.setVisible(true);
|
||||
|
||||
/* Highscores des Spielers einfügen */
|
||||
String personalBestScores = calculatePersonalHighscores();
|
||||
@ -1078,6 +1086,7 @@ public class HappyBirdMain extends Application {
|
||||
currentScoreEndscreenLabel.setVisible(true);
|
||||
highscoreMenuLabel.setVisible(false);
|
||||
backEndscreenButton.setVisible(false);
|
||||
endScreen.getChildren().remove(highscoreMenuLabel);
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user