aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2023-05-25 20:57:51 -0400
committersowgro <tpoke.ferrari@gmail.com>2023-05-25 20:57:51 -0400
commitfcd65070900865a9e0b547c49968988abcda5ab9 (patch)
tree92dca348a8adfad470f149dafa01a95780a895dc /src/main
parenta5d71e172b7202c5758837d896ffb8cafcb8da96 (diff)
downloadNPEhero-fcd65070900865a9e0b547c49968988abcda5ab9.tar.gz
NPEhero-fcd65070900865a9e0b547c49968988abcda5ab9.tar.bz2
NPEhero-fcd65070900865a9e0b547c49968988abcda5ab9.zip
Move levels outside of src, prepare for leaderboard writing and other small changes
Diffstat (limited to 'src/main')
-rw-r--r--src/main/Difficulty.java15
-rw-r--r--src/main/LeaderboardEntry.java35
-rw-r--r--src/main/Level.java5
-rw-r--r--src/main/LevelController.java2
4 files changed, 23 insertions, 34 deletions
diff --git a/src/main/Difficulty.java b/src/main/Difficulty.java
index 926d8d6..7955698 100644
--- a/src/main/Difficulty.java
+++ b/src/main/Difficulty.java
@@ -1,17 +1,19 @@
package main;
import java.io.File;
-
+import java.time.LocalDate;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
public class Difficulty
{
public String title;
- public ObservableList<LeaderboardEntry> leaderboard = FXCollections.observableArrayList();
+ private ObservableList<LeaderboardEntry> leaderboard = FXCollections.observableArrayList();
public File notes;
+ public int bpm;
public void parseMetadata(File file) {
+ //hi zach put json reader stuff here
title = "placeholderDiff";
}
@@ -19,4 +21,13 @@ public class Difficulty
//and here
leaderboard.add(new LeaderboardEntry("placeholderScore", 0, "0/0/0"));
}
+
+ public void addToLeaderboard(String name, int score) {
+ leaderboard.add(new LeaderboardEntry(name, score, ""+LocalDate.now())); //do not delete this tho its not a placeholder
+ //and make this write to the json also
+ }
+
+ public ObservableList<LeaderboardEntry> getLeaderboard() {
+ return leaderboard;
+ }
}
diff --git a/src/main/LeaderboardEntry.java b/src/main/LeaderboardEntry.java
index 673ca11..9a298b6 100644
--- a/src/main/LeaderboardEntry.java
+++ b/src/main/LeaderboardEntry.java
@@ -1,45 +1,28 @@
package main;
-import javafx.beans.property.SimpleIntegerProperty;
-import javafx.beans.property.SimpleStringProperty;
-
public class LeaderboardEntry
{
- private SimpleIntegerProperty score;
- private SimpleStringProperty name;
- private SimpleStringProperty date;
+ private int score;
+ private String name;
+ private String date;
- //all below is required for table view
public LeaderboardEntry(String name, int score, String date)
{
- this.name = new SimpleStringProperty(name);
- this.score = new SimpleIntegerProperty(score);
- this.date = new SimpleStringProperty(date);
+ this.name = name;
+ this.score = score;
+ this.date = date;
}
public int getScore() {
- return score.get();
- }
-
- public void setScore(int score) {
- this.score.set(score);
+ return score;
}
public String getName() {
- return name.get();
- }
-
- public void setName(String name) {
- this.name.set(name);
+ return name;
}
public String getDate()
{
- return date.get();
- }
-
- public void setDate(String date)
- {
- this.date = new SimpleStringProperty(date);
+ return date;
}
}
diff --git a/src/main/Level.java b/src/main/Level.java
index a9b5c48..4110d4f 100644
--- a/src/main/Level.java
+++ b/src/main/Level.java
@@ -2,17 +2,12 @@ package main;
import java.io.File;
import java.util.ArrayList;
-
-import javafx.beans.*;
-import javafx.beans.property.SimpleStringProperty;
import javafx.scene.image.Image;
import javafx.scene.paint.Color;
-
import java.io.FileWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
-
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
diff --git a/src/main/LevelController.java b/src/main/LevelController.java
index c364962..f4d7587 100644
--- a/src/main/LevelController.java
+++ b/src/main/LevelController.java
@@ -11,7 +11,7 @@ public class LevelController
public LevelController()
{
- for (File curFileInLevels: new File("src/assets/levels").listFiles()) //iterates through all files/folders in src/assets/levels
+ for (File curFileInLevels: new File("levels").listFiles()) //iterates through all files/folders in src/assets/levels
{
Level level = new Level();
for(File curFileInCurLevel: curFileInLevels.listFiles()) //iterates through all files/folders in src/assets/levels/LEVEL