316317318319320321322323324325
public void saveCameraPreset(String name) { cameraPresets.add(name, camera.toJson()); } public void loadCameraPreset(String name) { JsonValue value = cameraPresets.get(name); if (!value.isUnknown()) { camera.fromJson(value.object()); } }
639640641642643644645646647648649650
} case SKYBOX: { JsonArray array = sky.get("skybox").array(); for (int i = 0; i < 6; ++i) { JsonValue value = array.get(i); skyboxFileName[i] = value.stringValue(""); } break; } default: break;
214215216217218219220221222223224
String[] path = name.split("\\."); JsonObject obj = desc; for (int j = 0; j < path.length-1; ++j) { obj = obj.get(path[j]).object(); } JsonValue jsonValue; try { jsonValue = new JsonNumber(Integer.parseInt(value)); } catch (Exception e) { jsonValue = new JsonString(value); }