completely abolishing GSON; new save format impl wip

This commit is contained in:
minjaesong
2021-08-23 16:55:51 +09:00
parent df1ebdf93d
commit e15d5c9b05
58 changed files with 421 additions and 2101 deletions

View File

@@ -20,7 +20,7 @@ internal object ExportAV : ConsoleCommand {
if (player == null) return
JsonWriter.writeToFile(
player.actorValue,
player,
AppLoader.defaultDir + "/Exports/" + args[1] + ".json")
Echo("ExportAV: exported to " + args[1] + ".json")

View File

@@ -1,22 +1,31 @@
package net.torvald.terrarum.modulebasegame.console
import com.badlogic.gdx.utils.Json
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.console.ConsoleCommand
import net.torvald.terrarum.console.Echo
import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.serialise.WriteMeta
import net.torvald.terrarum.utils.JsonWriter
import java.io.IOException
/**
* Created by minjaesong on 2017-07-18.
*/
object ExportLayerData : ConsoleCommand {
override fun execute(args: Array<String>) {
/*try {
val outfile = WriteLayerDataZip()
WriteWorldInfo()
Echo("Layer data exported to ${outfile!!.canonicalPath}")
try {
val str = WriteMeta(Terrarum.ingame!! as TerrarumIngame).invoke()
val writer = java.io.FileWriter(AppLoader.defaultDir + "/Exports/savegame.json", false)
writer.write(str)
writer.close()
Echo("Exportlayer: exported to savegame.json")
}
catch (e: Exception) {
catch (e: IOException) {
Echo("Exportlayer: IOException raised.")
e.printStackTrace()
EchoError("Layer data export failed; see console for error traces.")
}*/
}
}
override fun printUsage() {

View File

@@ -13,7 +13,7 @@ import java.io.IOException
/**
* Created by minjaesong on 2016-02-10.
*/
internal object GsonTest : ConsoleCommand {
/*internal object GsonTest : ConsoleCommand {
override fun execute(args: Array<String>) {
if (args.size == 2) {
@@ -51,4 +51,4 @@ internal object GsonTest : ConsoleCommand {
Echo("Usage: gsontest filename-without-extension")
}
}
}*/

View File

@@ -5,7 +5,6 @@ import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
import net.torvald.terrarum.console.ConsoleCommand
import net.torvald.terrarum.console.Echo
import net.torvald.terrarum.modulebasegame.gameworld.GameWorldExtension
import net.torvald.terrarum.serialise.ReadLayerDataZip
import java.io.File
/**
@@ -13,7 +12,7 @@ import java.io.File
*/
object ImportLayerData : ConsoleCommand {
override fun execute(args: Array<String>) {
if (args.size < 2) {
/*if (args.size < 2) {
ExportLayerData.printUsage()
return
}
@@ -28,7 +27,7 @@ object ImportLayerData : ConsoleCommand {
(Terrarum.ingame!!.world).spawnX * TILE_SIZED
)
Echo("Successfully loaded ${args[1]}")
Echo("Successfully loaded ${args[1]}")*/
}
override fun printUsage() {