aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2023-06-08 23:52:32 -0400
committersowgro <tpoke.ferrari@gmail.com>2023-06-08 23:52:32 -0400
commit7a7afb82b1ca8878ae066f9b811ad4d8910d654a (patch)
tree6f12a01c11045ef0b7b63fc253a767e396281e88
parentaf36a57384060bd8695b94d3e20d8cd1b3553fe8 (diff)
downloadNPEhero-7a7afb82b1ca8878ae066f9b811ad4d8910d654a.tar.gz
NPEhero-7a7afb82b1ca8878ae066f9b811ad4d8910d654a.tar.bz2
NPEhero-7a7afb82b1ca8878ae066f9b811ad4d8910d654a.zip
small improvement to level validation
-rw-r--r--src/devmenu/DiffEditor.java9
-rw-r--r--src/devmenu/NotesEditor.java14
-rw-r--r--src/main/Difficulty.java12
3 files changed, 27 insertions, 8 deletions
diff --git a/src/devmenu/DiffEditor.java b/src/devmenu/DiffEditor.java
index 727510d..0991fb0 100644
--- a/src/devmenu/DiffEditor.java
+++ b/src/devmenu/DiffEditor.java
@@ -35,7 +35,7 @@ public class DiffEditor
Text bpmLabel = new Text("BPM");
TextField bpm = new TextField(diff.bpm+"");
- Text numBeatsLabel = new Text("Number of beats");
+ Text numBeatsLabel = new Text("Number of beats (set by notes editor)");
TextField numBeats = new TextField(diff.numBeats+"");
Text priorityLabel = new Text("priority (lower first)");
@@ -56,6 +56,11 @@ public class DiffEditor
Button playLevel = new Button("Launch level");
playLevel.setOnAction(e -> Driver.setMenu(new LevelSurround(diff.level, diff, new MainMenu())));
+ Button refresh = new Button("Refresh");
+ refresh.setOnAction( e -> {
+ numBeats.setText(diff.numBeats+"");
+ });
+
Button save = new Button("Save");
save.setOnAction(e -> { //assigns text feilds to values
diff.title = title.getText();
@@ -66,7 +71,7 @@ public class DiffEditor
});
VBox main = new VBox();
- main.getChildren().addAll(folderNameLabel,folderName,titleLabel,title,bpmLabel,bpm,numBeatsLabel,numBeats,priorityLabel,priority,editNotes,editScores,playLevel,save);
+ main.getChildren().addAll(folderNameLabel,folderName,titleLabel,title,bpmLabel,bpm,numBeatsLabel,numBeats,refresh,priorityLabel,priority,editNotes,editScores,playLevel,save);
Scene scene = new Scene(main);
primaryStage.setScene(scene);
primaryStage.show();
diff --git a/src/devmenu/NotesEditor.java b/src/devmenu/NotesEditor.java
index 269bf84..2ac0c88 100644
--- a/src/devmenu/NotesEditor.java
+++ b/src/devmenu/NotesEditor.java
@@ -85,15 +85,17 @@ public class NotesEditor
private void stop()
{
- try {
- Driver.soundController.endSong();
- diff.numBeats = (int)timer.time();
- timer = null;
- writer.close();
- help.setText(t1);
+ try
+ {
+ Driver.soundController.endSong();
+ diff.numBeats = (int)timer.time();
+ timer = null;
+ writer.close();
+ help.setText(t1);
}
catch (Exception e)
{
+ //System.err.println("tried to stop but already stopped");
}
}
} \ No newline at end of file
diff --git a/src/main/Difficulty.java b/src/main/Difficulty.java
index 3dba47b..d8587f1 100644
--- a/src/main/Difficulty.java
+++ b/src/main/Difficulty.java
@@ -72,6 +72,18 @@ public class Difficulty implements Comparable<Difficulty>
isValid1 = false;
}
+ if (bpm == 0.0)
+ {
+ System.err.println(thisDir+" is missing a bpm");
+ isValid1 = false;
+ }
+
+ if (numBeats == 0)
+ {
+ System.err.println(thisDir+" is missing the number of beats");
+ isValid1 = false;
+ }
+
isValid = isValid1;
}