mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 12:39:45 +02:00
Ups
This commit is contained in:
@@ -4,22 +4,13 @@ import de.heatup.cfg.Config;
|
||||
import de.heatup.logging.Logger;
|
||||
|
||||
public class HighscoreHandler {
|
||||
private static String currentMap;
|
||||
private static MapHighscore currentMapHighscore;
|
||||
private int mapHash;
|
||||
/**
|
||||
* Es muss vorher eine Karte geladen sein
|
||||
*/
|
||||
public HighscoreHandler() {
|
||||
// if highscore does not exist
|
||||
newMapHighscore();
|
||||
// if it exists
|
||||
// loadMapHighscore();
|
||||
public HighscoreHandler(String mapString) {
|
||||
mapHash = mapString.hashCode();
|
||||
// load file for serialization
|
||||
}
|
||||
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;
|
||||
|
||||
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