mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-17 00:56:07 +09:00
sort savefiles by making last played coming first
This commit is contained in:
@@ -7,7 +7,6 @@ import com.badlogic.gdx.graphics.Texture
|
|||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.App.printdbg
|
|
||||||
import net.torvald.terrarum.langpack.Lang
|
import net.torvald.terrarum.langpack.Lang
|
||||||
import net.torvald.terrarum.serialise.Common
|
import net.torvald.terrarum.serialise.Common
|
||||||
import net.torvald.terrarum.serialise.LoadSavegame
|
import net.torvald.terrarum.serialise.LoadSavegame
|
||||||
@@ -40,18 +39,17 @@ class UILoadDemoSavefiles : UICanvas() {
|
|||||||
|
|
||||||
// read savegames
|
// read savegames
|
||||||
init {
|
init {
|
||||||
File(App.defaultSaveDir).listFiles().forEachIndexed { index, file ->
|
File(App.defaultSaveDir).listFiles().map { file ->
|
||||||
printdbg(this, "save file: ${file.absolutePath}")
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val x = (width - UIItemDemoSaveCells.WIDTH) / 2
|
VDUtil.readDiskArchive(file, charset = Common.CHARSET)
|
||||||
val y = 144 + (24 + UIItemDemoSaveCells.HEIGHT) * index
|
|
||||||
val disk = VDUtil.readDiskArchive(file, charset = Common.CHARSET)
|
|
||||||
addUIitem(UIItemDemoSaveCells(this, x, y, disk))
|
|
||||||
}
|
}
|
||||||
catch (e: Throwable) {
|
catch (e: Throwable) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
|
}.sortedByDescending { (it as VirtualDisk).entries[0]!!.modificationDate }.forEachIndexed { index, disk ->
|
||||||
|
val x = (width - UIItemDemoSaveCells.WIDTH) / 2
|
||||||
|
val y = 144 + (24 + UIItemDemoSaveCells.HEIGHT) * index
|
||||||
|
addUIitem(UIItemDemoSaveCells(this, x, y, disk as VirtualDisk))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +136,7 @@ class UIItemDemoSaveCells(
|
|||||||
|
|
||||||
// TODO draw border
|
// TODO draw border
|
||||||
batch.color = highlightCol
|
batch.color = highlightCol
|
||||||
Toolkit.drawBoxBorder(batch, x.toInt()-1, y.toInt()-1, width+1, height+1)
|
Toolkit.drawBoxBorder(batch, x.toInt()-1, y.toInt()-1, width+2, height+2)
|
||||||
|
|
||||||
// draw thumbnail
|
// draw thumbnail
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
|
|||||||
Reference in New Issue
Block a user