mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 11:29:46 +02:00
Ups
This commit is contained in:
@@ -4,22 +4,13 @@ import de.heatup.cfg.Config;
|
|||||||
import de.heatup.logging.Logger;
|
import de.heatup.logging.Logger;
|
||||||
|
|
||||||
public class HighscoreHandler {
|
public class HighscoreHandler {
|
||||||
private static String currentMap;
|
private int mapHash;
|
||||||
private static MapHighscore currentMapHighscore;
|
|
||||||
/**
|
/**
|
||||||
* Es muss vorher eine Karte geladen sein
|
* Es muss vorher eine Karte geladen sein
|
||||||
*/
|
*/
|
||||||
public HighscoreHandler() {
|
public HighscoreHandler(String mapString) {
|
||||||
// if highscore does not exist
|
mapHash = mapString.hashCode();
|
||||||
newMapHighscore();
|
// load file for serialization
|
||||||
// if it exists
|
|
||||||
// loadMapHighscore();
|
|
||||||
}
|
|
||||||
private static void newMapHighscore() {
|
|
||||||
currentMap = ChecksumGenerator.generateCheckSum(Config.mapFilePath);
|
|
||||||
currentMapHighscore = new MapHighscore();
|
|
||||||
Logger.write("HighscoreHandler - Map hashed: "+currentMap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,32 @@
|
|||||||
package de.heatup.highscore;
|
package de.heatup.highscore;
|
||||||
|
|
||||||
public class MapHighscore {
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class MapHighscore implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Map<Integer, ArrayList<String>> highscoreOfAllMaps = new HashMap<Integer, ArrayList<String>>();
|
||||||
|
|
||||||
|
public void setHighscore(int mapHash, String name, int score) {
|
||||||
|
|
||||||
|
ArrayList<String> mapHighscores = highscoreOfAllMaps.get(mapHash);
|
||||||
|
|
||||||
|
for (int i = 0; i<mapHighscores.size(); i++) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mapHighscores.size()>10) {
|
||||||
|
mapHighscores.remove(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user