From 6c216a309838bf1cbeb19070ce180c0170ccd3c9 Mon Sep 17 00:00:00 2001 From: sowgro Date: Thu, 1 Jun 2023 00:53:04 -0400 Subject: early code for level editor gui --- src/main/Difficulty.java | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'src/main/Difficulty.java') 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 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() { + + } } -- cgit v1.2.3