Korrekturen am Neustart-Button, Hauptmenü-Button aus dem End-Screen, Fix der INSERT-Abfrage
This commit is contained in:
parent
43ba9226e2
commit
1f0fedeaac
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.
@ -447,6 +447,7 @@ public class HappyBirdMain extends Application {
|
||||
pipesArrayList.remove(rectangle);
|
||||
}
|
||||
} else if (endScreenOpened == false) {
|
||||
writeIntoDatabase();
|
||||
generateEndScreen();
|
||||
endScreenOpened = true;
|
||||
}
|
||||
@ -916,18 +917,19 @@ public class HappyBirdMain extends Application {
|
||||
|
||||
/***
|
||||
* Fügt die erreichte Punktzahl des Spielers für den Spieler mit seinem Namen und Kürzel in die Datenbank ein
|
||||
* @param points die erreichten Punkte
|
||||
*
|
||||
*/
|
||||
public void writeIntoDatabase(int points) {
|
||||
public void writeIntoDatabase() {
|
||||
String playername = name.getText();
|
||||
String playeracronym = acronym.getText();
|
||||
/*String sql = "INSERT INTO happybirddb(name, kuerzel, punkte) VALUES ('" + playername + "', '" + points +
|
||||
"', '" + playeracronym + "');";*/
|
||||
String sql = "INSERT INTO happybirddb (name, kuerzel, punkte) VALUES (?, ?, ?);";
|
||||
try (PreparedStatement ps = datenbank.con.prepareStatement(sql)) {
|
||||
ps.setString(2, playername);
|
||||
ps.setInt(3, points);
|
||||
ps.setString(4, playeracronym);
|
||||
ps.setString(1, playername);
|
||||
ps.setString(2, playeracronym);
|
||||
ps.setInt(3, collectedPoints / 2);
|
||||
System.out.println(ps);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -1101,6 +1103,16 @@ public class HappyBirdMain extends Application {
|
||||
*/
|
||||
private void backMenuButtonClick() {
|
||||
pane.getChildren().remove(endScreen);
|
||||
pane.getChildren().clear();
|
||||
for (Rectangle pipe : pipesArrayList) {
|
||||
pane.getChildren().remove(pipe);
|
||||
}
|
||||
pipesArrayList.clear();
|
||||
collectedPoints = 0;
|
||||
currentScoreLabel.setText("SCORE: " + collectedPoints);
|
||||
endScreenOpened = false;
|
||||
openEndScreen = false;
|
||||
endScreen.getChildren().clear();
|
||||
generateMenueScreen();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user