diff --git a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin index b524886..aedb049 100644 Binary files a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin and b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin differ diff --git a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock index 974fd63..e0948fb 100644 Binary files a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock and b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock differ diff --git a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin index 06a01c8..4748d01 100644 Binary files a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin and b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin differ diff --git a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock index e8c2684..a91feb8 100644 Binary files a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock and b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock differ diff --git a/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock index c576cf2..b96f0b4 100644 Binary files a/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class b/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class index 5eea9d0..827cf90 100644 Binary files a/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class and b/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class differ diff --git a/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar b/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar index e3c36ee..1ba71e6 100644 Binary files a/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar and b/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar differ diff --git a/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin b/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin index 973c151..d75cb1a 100644 Binary files a/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin and b/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java b/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java index a3dc81a..a4d0bb3 100644 --- a/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java +++ b/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java @@ -654,23 +654,29 @@ public class HappyBirdMain extends Application { * Startet Spiel nach Namenseingabe */ public void startGameButtonClick() { - generateGameScreen(); + if (correctName() && correctAcronym()) + { + generateGameScreen(); - /*Klick auf den Pause-Button, um das Pause-Menü aufzurufen*/ - pauseButton.setOnAction(event -> { - if(!menuScreenRunning) { - pauseButtonClick(gameRunning); - gameRunning = !gameRunning; - } - }); + /*Klick auf den Pause-Button, um das Pause-Menü aufzurufen*/ + pauseButton.setOnAction(event -> { + if(!menuScreenRunning) { + pauseButtonClick(gameRunning); + gameRunning = !gameRunning; + } + }); + + /*ESC-Tast drücken, um das Pause-Menü aufzurufen*/ + scene.setOnKeyPressed(e -> { + if(e.getCode() == KeyCode.ESCAPE && !menuScreenRunning) { + pauseButtonClick(gameRunning); + gameRunning = !gameRunning; + } + }); + } else { + System.out.println("Name oder Kürzel falsch!"); + } - /*ESC-Tast drücken, um das Pause-Menü aufzurufen*/ - scene.setOnKeyPressed(e -> { - if(e.getCode() == KeyCode.ESCAPE && !menuScreenRunning) { - pauseButtonClick(gameRunning); - gameRunning = !gameRunning; - } - }); } /*** @@ -837,8 +843,8 @@ public class HappyBirdMain extends Application { */ public void writeIntoDatabase(int points) { - String playername = nameLabel.getText(); - String playeracronym = acronymLabel.getText(); + 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 (?, ?, ?);"; @@ -862,13 +868,23 @@ public class HappyBirdMain extends Application { */ public boolean correctName() { - String name = nameLabel.getText(); - if (!name.matches("[a-zA-ZÄÖÜäöüß ]*")) + String nametext = name.getText(); + if (!nametext.matches("[a-zA-ZÄÖÜäöüß ]*")) { + System.out.println("Fehler Schreibweise Name"); return false; } - if (name.charAt(0) < 'A' || name.charAt(0) > 'Z') + if (nametext.length() > 0) { + if (nametext.charAt(0) < 'A' || nametext.charAt(0) > 'Z') + { + System.out.println("Fehler Schreibweise Name 1. Buchstabe"); + return false; + } + } + else + { + System.out.println("Name leer"); return false; } return true; @@ -881,13 +897,17 @@ public class HappyBirdMain extends Application { */ public boolean correctAcronym() { - String acronym = acronymLabel.getText(); - if (acronym.length() < 3 || acronym.length() > 10) + String acronymtext = acronym.getText(); + System.out.println(acronymtext.length()); + System.out.println(acronymtext); + if (acronymtext.length() < 3 || acronymtext.length() > 10) { + System.out.println("Fehler Länge Kürzel"); return false; } - if (!acronym.matches("[A-Za-z0-9]*")) + if (!acronymtext.matches("[A-Za-z0-9]*")) { + System.out.println("Fehler Schreibweise Kürzel"); return false; } return true;