@Override public void read (Json json, JsonValue jsonData) { super.read(json, jsonData); continuous = json.readValue("continous", boolean.class, jsonData); emissionValue = json.readValue("emission", ScaledNumericValue.class, jsonData); delayValue = json.readValue("delay", RangedNumericValue.class, jsonData); durationValue = json.readValue("duration", RangedNumericValue.class, jsonData); lifeValue = json.readValue("life", ScaledNumericValue.class, jsonData); lifeOffsetValue = json.readValue("lifeOffset", ScaledNumericValue.class, jsonData); } }
@Override public void read (Json json, JsonValue jsonMap) { name = json.readValue("name", String.class, jsonMap); emitter = json.readValue("emitter", Emitter.class, jsonMap); influencers.addAll(json.readValue("influencers", Array.class, Influencer.class, jsonMap)); renderer = json.readValue("renderer", ParticleControllerRenderer.class, jsonMap); }
/** @param type May be null if the type is unknown. * @return May be null. */ public <T> T readValue (String name, Class<T> type, JsonValue jsonMap) { return (T)readValue(type, null, jsonMap.get(name)); }
/** @param type May be null if the type is unknown. * @param elementType May be null if the type is unknown. * @return May be null. */ public <T> T readValue (String name, Class<T> type, Class elementType, JsonValue jsonMap) { return (T)readValue(type, elementType, jsonMap.get(name)); }
@Override public void read (Json json, JsonValue jsonData) { super.read(json, jsonData); side = json.readValue("side", SpawnSide.class, jsonData); } }
@Override public void read (Json json, JsonValue jsonData) { super.read(json, jsonData); isGlobal = json.readValue("isGlobal", boolean.class, jsonData); }
/** @param type May be null if the type is unknown. * @param elementType May be null if the type is unknown. * @return May be null. */ public <T> T readValue (String name, Class<T> type, Class elementType, T defaultValue, JsonValue jsonMap) { JsonValue jsonValue = jsonMap.get(name); return (T)readValue(type, elementType, defaultValue, jsonValue); }
public Color read (Json json, JsonValue jsonData, Class type) { if (jsonData.isString()) return get(jsonData.asString(), Color.class); String hex = json.readValue("hex", String.class, (String)null, jsonData); if (hex != null) return Color.valueOf(hex); float r = json.readValue("r", float.class, 0f, jsonData); float g = json.readValue("g", float.class, 0f, jsonData); float b = json.readValue("b", float.class, 0f, jsonData); float a = json.readValue("a", float.class, 1f, jsonData); return new Color(r, g, b, a); } });
public Object read (Json json, JsonValue jsonData, Class type) { String name = json.readValue("name", String.class, jsonData); Color color = json.readValue("color", Color.class, jsonData); Drawable drawable = newDrawable(name, color); if (drawable instanceof BaseDrawable) { BaseDrawable named = (BaseDrawable)drawable; named.setName(jsonData.name + " (" + name + ", " + color + ")"); } return drawable; } });
/** @param type May be null if the type is unknown. * @return May be null. */ public <T> T fromJson (Class<T> type, Reader reader) { return (T)readValue(type, null, new JsonReader().parse(reader)); }
/** @param type May be null if the type is unknown. * @return May be null. */ public <T> T fromJson (Class<T> type, Class elementType, String json) { return (T)readValue(type, elementType, new JsonReader().parse(json)); }
/** @param type May be null if the type is unknown. * @return May be null. */ public <T> T fromJson (Class<T> type, InputStream input) { return (T)readValue(type, null, new JsonReader().parse(input)); }
/** @param type May be null if the type is unknown. * @param elementType May be null if the type is unknown. * @return May be null. */ public <T> T fromJson (Class<T> type, Class elementType, InputStream input) { return (T)readValue(type, elementType, new JsonReader().parse(input)); }
/** @param type May be null if the type is unknown. * @return May be null. */ public <T> T fromJson (Class<T> type, FileHandle file) { try { return (T)readValue(type, null, new JsonReader().parse(file)); } catch (Exception ex) { throw new SerializationException("Error reading file: " + file, ex); } }
/** @param type May be null if the type is unknown. * @return May be null. */ public <T> T fromJson (Class<T> type, FileHandle file) { try { return (T)readValue(type, null, new JsonReader().parse(file)); } catch (Exception ex) { throw new SerializationException("Error reading file: " + file, ex); } }