diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2023-06-01 00:53:04 -0400 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2023-06-01 00:53:04 -0400 |
commit | 6c216a309838bf1cbeb19070ce180c0170ccd3c9 (patch) | |
tree | 461f877b9417621cb0a19b1bbc735c8455a570ba /src/main/Difficulty.java | |
parent | 99584f39f8e8f3b69255135665040c2a947d4021 (diff) | |
download | NPEhero-6c216a309838bf1cbeb19070ce180c0170ccd3c9.tar.gz NPEhero-6c216a309838bf1cbeb19070ce180c0170ccd3c9.tar.bz2 NPEhero-6c216a309838bf1cbeb19070ce180c0170ccd3c9.zip |
early code for level editor gui
Diffstat (limited to 'src/main/Difficulty.java')
-rw-r--r-- | src/main/Difficulty.java | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/src/main/Difficulty.java b/src/main/Difficulty.java index 8420886..2c74956 100644 --- a/src/main/Difficulty.java +++ b/src/main/Difficulty.java @@ -16,6 +16,7 @@ import javafx.collections.ObservableList; public class Difficulty { + public File thisDir; public String title; private ObservableList<LeaderboardEntry> leaderboard = FXCollections.observableArrayList(); public File notes; @@ -24,8 +25,37 @@ public class Difficulty public int numBeats; private File leaderboardFile; + public Difficulty(File file) + { + thisDir = file; + readData(); + } + + public void readData() + { + for(File cur: thisDir.listFiles()) //iterates through all files/folders in src/assets/levels/LEVEL/DIFFICULTY + { + if (cur.getName().equals("metadata.json")) + { + parseMetadata(cur); + } + if (cur.getName().equals("leaderboard.json")) + { + parseLeaderboard(cur); + } + if (cur.getName().equals("notes.txt")) + { + notes = cur; + } + if (cur.getName().equals("song.wav")) + { + song = cur; + } + } + } + - public void parseMetadata(File file) throws FileNotFoundException, IOException + public void parseMetadata(File file) { JSONParser jsonParser = new JSONParser(); //parser to read the file @@ -46,7 +76,7 @@ public class Difficulty } } - public void parseLeaderboard(File file) throws FileNotFoundException, IOException + public void parseLeaderboard(File file) { leaderboardFile = file; JSONParser jsonParser = new JSONParser(); //parser to read the file @@ -103,4 +133,13 @@ public class Difficulty { return leaderboard; } + + public String toString() + { + return title; + } + + public void writeMetadata() { + + } } |