com.badlogic.gdx.utils.Json.readValue()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中com.badlogic.gdx.utils.Json.readValue()方法的一些代码示例,展示了Json.readValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Json.readValue()方法的具体详情如下:
包路径:com.badlogic.gdx.utils.Json
类名称:Json
方法名:readValue

Json.readValue介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

@Override
  public void read (Json json, JsonValue jsonData) {
    alphaValue = json.readValue("alpha", ScaledNumericValue.class, jsonData);
    colorValue = json.readValue("color", GradientColorValue.class, jsonData);
  }
}

代码示例来源:origin: libgdx/libgdx

@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);
  }
}

代码示例来源:origin: libgdx/libgdx

@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);
}

代码示例来源:origin: libgdx/libgdx

@Override
public void read (Json json, JsonValue jsonData) {
  super.read(json, jsonData);
  lowMin = json.readValue("lowMin", float.class, jsonData);
  lowMax = json.readValue("lowMax", float.class, jsonData);
}

代码示例来源:origin: libgdx/libgdx

@Override
  public void read (Json json, JsonValue jsonData) {
    data = json.readValue("data", ObjectMap.class, jsonData);
    assets.addAll(json.readValue("indices", int[].class, jsonData));
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void read (Json json, JsonValue jsonData) {
  super.read(json, jsonData);
  lowMin = json.readValue("lowMin", float.class, jsonData);
  lowMax = json.readValue("lowMax", float.class, jsonData);
}

代码示例来源:origin: libgdx/libgdx

@Override
public void read (Json json, JsonValue jsonData) {
  super.read(json, jsonData);
  colors = json.readValue("colors", float[].class, jsonData);
  timeline = json.readValue("timeline", float[].class, jsonData);
}

代码示例来源:origin: libgdx/libgdx

/** @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));
}

代码示例来源:origin: libgdx/libgdx

/** @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));
}

代码示例来源:origin: libgdx/libgdx

@Override
  public void read (Json json, JsonValue jsonData) {
    super.read(json, jsonData);
    side = json.readValue("side", SpawnSide.class, jsonData);
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void read (Json json, JsonValue jsonData) {
  super.read(json, jsonData);
  isGlobal = json.readValue("isGlobal", boolean.class, jsonData);
}

代码示例来源:origin: libgdx/libgdx

/** @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);
}

代码示例来源:origin: libgdx/libgdx

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);
  }
});

代码示例来源:origin: libgdx/libgdx

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;
  }
});

代码示例来源:origin: libgdx/libgdx

/** @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));
}

代码示例来源:origin: libgdx/libgdx

/** @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));
}

代码示例来源:origin: libgdx/libgdx

/** @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));
}

代码示例来源:origin: libgdx/libgdx

/** @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));
}

代码示例来源:origin: libgdx/libgdx

/** @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);
  }
}

代码示例来源:origin: libgdx/libgdx

/** @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);
  }
}

相关文章