[libgdx] Fixes for JsonRollback (to 3.7).

This commit is contained in:
NathanSweet 2019-08-20 18:59:44 +02:00
parent 47dbc797ef
commit c167d8bc52

View File

@ -135,8 +135,14 @@ public class JsonRollback {
if (map.isObject() && map.parent.isArray()) { // Probably a key. if (map.isObject() && map.parent.isArray()) { // Probably a key.
if (!map.has("time")) map.addChild("time", new JsonValue(0f)); if (!map.has("time")) map.addChild("time", new JsonValue(0f));
if (map.parent.name != null && map.parent.name.equals("rotate") && !map.has("angle")) if (map.parent.name != null) {
map.addChild("angle", new JsonValue(0f)); if (map.parent.name.equals("rotate") && !map.has("angle"))
map.addChild("angle", new JsonValue(0f));
else if (map.parent.name.equals("scale")) {
if (!map.has("x")) map.addChild("x", new JsonValue(1f));
if (!map.has("y")) map.addChild("y", new JsonValue(1f));
}
}
} }
JsonValue curve = map.get("curve"); JsonValue curve = map.get("curve");
@ -149,8 +155,8 @@ public class JsonRollback {
curve.addChild(new JsonValue(curve.asFloat())); curve.addChild(new JsonValue(curve.asFloat()));
curve.setType(ValueType.array); curve.setType(ValueType.array);
curve.addChild(new JsonValue(map.getFloat("c2", 0))); curve.addChild(new JsonValue(map.getFloat("c2", 0)));
curve.addChild(new JsonValue(map.getFloat("c3", 0))); curve.addChild(new JsonValue(map.getFloat("c3", 1)));
curve.addChild(new JsonValue(map.getFloat("c4", 0))); curve.addChild(new JsonValue(map.getFloat("c4", 1)));
map.remove("c2"); map.remove("c2");
map.remove("c3"); map.remove("c3");
map.remove("c4"); map.remove("c4");