JSON read/write generation
This commit is contained in:
@@ -730,7 +730,7 @@ public class Bullets implements ContentList{
|
||||
lifetime = 23f;
|
||||
speed = 1f;
|
||||
splashDamageRadius = 50f;
|
||||
splashDamage = 20f;
|
||||
splashDamage = 28f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -75,7 +75,7 @@ public class SpawnGroup implements Serializable{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write (Json json) {
|
||||
public void write(Json json){
|
||||
json.writeValue("type", type.name);
|
||||
if(begin != 0) json.writeValue("begin", begin);
|
||||
if(end != never) json.writeValue("end", end);
|
||||
@@ -87,7 +87,7 @@ public class SpawnGroup implements Serializable{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read (Json json, JsonValue data) {
|
||||
public void read(Json json, JsonValue data){
|
||||
type = content.getByName(ContentType.unit, data.getString("type", "dagger"));
|
||||
begin = data.getInt("begin", 0);
|
||||
end = data.getInt("end", never);
|
||||
|
||||
@@ -36,7 +36,7 @@ public abstract class SaveFileVersion{
|
||||
long playtime = stream.readLong();
|
||||
int build = stream.readInt();
|
||||
|
||||
Rules rules = Serialization.readRules(stream);
|
||||
Rules rules = Serialization.readRulesStreamJson(stream);
|
||||
String map = stream.readUTF();
|
||||
int wave = stream.readInt();
|
||||
return new SaveMeta(version, time, playtime, build, map, wave, rules);
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Save16 extends SaveFileVersion{
|
||||
stream.readInt(); //build
|
||||
|
||||
//general state
|
||||
state.rules = Serialization.readRules(stream);
|
||||
state.rules = Serialization.readRulesStreamJson(stream);
|
||||
String mapname = stream.readUTF();
|
||||
Map map = world.maps.all().find(m -> m.name().equals(mapname));
|
||||
if(map == null) map = new Map(customMapDirectory.child(mapname), 1, 1, new ObjectMap<>(), true);
|
||||
@@ -56,7 +56,7 @@ public class Save16 extends SaveFileVersion{
|
||||
stream.writeInt(Version.build); //build
|
||||
|
||||
//--GENERAL STATE--
|
||||
Serialization.writeRules(stream, state.rules);
|
||||
Serialization.writeRulesStreamJson(stream, state.rules);
|
||||
stream.writeUTF(world.getMap().name()); //map name
|
||||
|
||||
stream.writeInt(state.wave); //wave
|
||||
|
||||
Reference in New Issue
Block a user