mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-06 08:38:30 +09:00
savegames are finally sorted
This commit is contained in:
@@ -200,10 +200,13 @@ public class App implements ApplicationListener {
|
|||||||
/**
|
/**
|
||||||
* Sorted by the lastplaytime, in reverse order (index 0 is the most recent game played)
|
* Sorted by the lastplaytime, in reverse order (index 0 is the most recent game played)
|
||||||
*/
|
*/
|
||||||
public static TreeMap<UUID, DiskSkimmer> savegameWorlds = new TreeMap<>();
|
public static ArrayList<UUID> sortedSavegameWorlds = new ArrayList();
|
||||||
public static TreeMap<UUID, String> savegameWorldsName = new TreeMap<>();
|
public static HashMap<UUID, DiskSkimmer> savegameWorlds = new HashMap<>(); // UNSORTED even with the TreeMap
|
||||||
public static TreeMap<UUID, DiskSkimmer> savegamePlayers = new TreeMap<>();
|
public static HashMap<UUID, String> savegameWorldsName = new HashMap<>();
|
||||||
public static TreeMap<UUID, String> savegamePlayersName = new TreeMap<>();
|
|
||||||
|
public static ArrayList<UUID> sortedPlayers = new ArrayList();
|
||||||
|
public static HashMap<UUID, DiskSkimmer> savegamePlayers = new HashMap<>();
|
||||||
|
public static HashMap<UUID, String> savegamePlayersName = new HashMap<>();
|
||||||
|
|
||||||
public static void updateListOfSavegames() {
|
public static void updateListOfSavegames() {
|
||||||
AppUpdateListOfSavegames();
|
AppUpdateListOfSavegames();
|
||||||
|
|||||||
@@ -672,10 +672,12 @@ class Codex : KVHashMap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun AppUpdateListOfSavegames() {
|
fun AppUpdateListOfSavegames() {
|
||||||
App.savegamePlayers.clear()
|
App.sortedSavegameWorlds.clear()
|
||||||
App.savegamePlayersName.clear()
|
|
||||||
App.savegameWorlds.clear()
|
App.savegameWorlds.clear()
|
||||||
App.savegameWorldsName.clear()
|
App.savegameWorldsName.clear()
|
||||||
|
App.sortedPlayers.clear()
|
||||||
|
App.savegamePlayers.clear()
|
||||||
|
App.savegamePlayersName.clear()
|
||||||
|
|
||||||
println("Listing saved worlds...")
|
println("Listing saved worlds...")
|
||||||
|
|
||||||
@@ -699,9 +701,11 @@ fun AppUpdateListOfSavegames() {
|
|||||||
val worldUUID = UUID.fromString(json.getString("worldIndex"))
|
val worldUUID = UUID.fromString(json.getString("worldIndex"))
|
||||||
App.savegameWorlds[worldUUID] = it
|
App.savegameWorlds[worldUUID] = it
|
||||||
App.savegameWorldsName[worldUUID] = it.getDiskName(Common.CHARSET)
|
App.savegameWorldsName[worldUUID] = it.getDiskName(Common.CHARSET)
|
||||||
|
App.sortedSavegameWorlds.add(worldUUID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("Listing saved players...")
|
println("Listing saved players...")
|
||||||
|
|
||||||
// create list of players
|
// create list of players
|
||||||
@@ -724,6 +728,7 @@ fun AppUpdateListOfSavegames() {
|
|||||||
val playerUUID = UUID.fromString(json.getString("uuid"))
|
val playerUUID = UUID.fromString(json.getString("uuid"))
|
||||||
App.savegamePlayers[playerUUID] = it
|
App.savegamePlayers[playerUUID] = it
|
||||||
App.savegamePlayersName[playerUUID] = it.getDiskName(Common.CHARSET)
|
App.savegamePlayersName[playerUUID] = it.getDiskName(Common.CHARSET)
|
||||||
|
App.sortedPlayers.add(playerUUID)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,7 +168,8 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
Thread {
|
Thread {
|
||||||
// read savegames
|
// read savegames
|
||||||
var savegamesCount = 0
|
var savegamesCount = 0
|
||||||
App.savegameWorlds.forEach { (_, skimmer) ->
|
App.sortedSavegameWorlds.forEach { uuid ->
|
||||||
|
val skimmer = App.savegameWorlds[uuid]!!
|
||||||
val x = uiX
|
val x = uiX
|
||||||
val y = titleTopGradEnd + cellInterval * savegamesCount
|
val y = titleTopGradEnd + cellInterval * savegamesCount
|
||||||
try {
|
try {
|
||||||
@@ -182,7 +183,8 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
savegamesCount = 0
|
savegamesCount = 0
|
||||||
App.savegamePlayers.forEach { (_, skimmer) ->
|
App.sortedPlayers.forEach { uuid ->
|
||||||
|
val skimmer = App.savegamePlayers[uuid]!!
|
||||||
val x = uiX
|
val x = uiX
|
||||||
val y = titleTopGradEnd + cellInterval * savegamesCount
|
val y = titleTopGradEnd + cellInterval * savegamesCount
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user