Example usage for com.badlogic.gdx.utils Json readValue

List of usage examples for com.badlogic.gdx.utils Json readValue

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils Json readValue.

Prototype

public <T> T readValue(Class<T> type, Class elementType, T defaultValue, JsonValue jsonData) 

Source Link

Usage

From source file:com.bladecoder.engine.actions.ActionCallbackQueue.java

License:Apache License

@SuppressWarnings("unchecked")
public static void read(Json json, JsonValue jsonData) {
    ArrayList<String> q = json.readValue("queue", ArrayList.class, String.class, jsonData);

    queue.clear();//ww  w .jav  a  2s  .co  m

    for (String s : q) {
        queue.add(ActionCallbackSerialization.find(s));
    }
}

From source file:com.bladecoder.engine.actions.ChooseAction.java

License:Apache License

@Override
public void read(Json json, JsonValue jsonData) {
    chooseCount = json.readValue("chooseCount", int.class, 0, jsonData);
}

From source file:com.bladecoder.engine.actions.RepeatAction.java

License:Apache License

@Override
public void read(Json json, JsonValue jsonData) {
    currentRepeat = json.readValue("currentRepeat", int.class, 0, jsonData);
}

From source file:com.bladecoder.engine.actions.RunOnceAction.java

License:Apache License

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

From source file:com.bladecoder.engine.actions.RunVerbAction.java

License:Apache License

@Override
public void read(Json json, JsonValue jsonData) {
    ip = json.readValue("ip", int.class, -1, jsonData);
    state = json.readValue("state", String.class, jsonData);
    super.read(json, jsonData);
}

From source file:com.bladecoder.engine.anim.WalkTween.java

License:Apache License

@SuppressWarnings("unchecked")
@Override/*from   www . ja  va 2  s. c  o  m*/
public void read(Json json, JsonValue jsonData) {
    super.read(json, jsonData);

    walkingPath = json.readValue("path", ArrayList.class, Vector2.class, jsonData);
    currentStep = json.readValue("currentStep", Integer.class, jsonData);
    speed = json.readValue("speed", Float.class, jsonData);

    String walkCbSer = json.readValue("walkCb", String.class, jsonData);
    walkCb = ActionCallbackSerialization.find(walkCbSer);
}

From source file:com.bladecoder.engine.model.AtlasRenderer.java

License:Apache License

@SuppressWarnings("unchecked")
@Override//from ww w.j  a v  a2 s .c om
public void read(Json json, JsonValue jsonData) {

    if (SerializationHelper.getInstance().getMode() == Mode.MODEL) {

        fanims = json.readValue("fanims", HashMap.class, AtlasAnimationDesc.class, jsonData);
        initAnimation = json.readValue("initAnimation", String.class, jsonData);

    } else {

        String currentAnimationId = json.readValue("currentAnimation", String.class, jsonData);

        if (currentAnimationId != null)
            currentAnimation = (AtlasAnimationDesc) fanims.get(currentAnimationId);

        flipX = json.readValue("flipX", Boolean.class, jsonData);
        currentFrameIndex = json.readValue("currentFrameIndex", Integer.class, jsonData);
        faTween = json.readValue("faTween", FATween.class, jsonData);
    }
}

From source file:com.bladecoder.engine.model.CharacterActor.java

License:Apache License

@SuppressWarnings("unchecked")
@Override/*from w  w  w  . jav a2  s  .  com*/
public void read(Json json, JsonValue jsonData) {
    super.read(json, jsonData);

    if (SerializationHelper.getInstance().getMode() == Mode.MODEL) {
        dialogs = json.readValue("dialogs", HashMap.class, Dialog.class, jsonData);

        if (dialogs != null) {
            for (Dialog d : dialogs.values())
                d.setActor(id);
        }

    } else {
        if (dialogs != null) {
            JsonValue dialogsValue = jsonData.get("dialogs");

            for (Dialog d : dialogs.values()) {
                String id = d.getId();
                JsonValue dValue = dialogsValue.get(id);

                if (dValue != null)
                    d.read(json, dValue);
            }
        }

        standAnim = json.readValue("standAnim", String.class, jsonData);
        walkAnim = json.readValue("walkAnim", String.class, jsonData);
        talkAnim = json.readValue("talkAnim", String.class, jsonData);
    }

    walkingSpeed = json.readValue("walkingSpeed", float.class, walkingSpeed, jsonData);
    textColor = json.readValue("textColor", Color.class, jsonData);
}

From source file:com.bladecoder.engine.model.ImageRenderer.java

License:Apache License

@SuppressWarnings("unchecked")
@Override//from   w  ww  . j ava2s  .com
public void read(Json json, JsonValue jsonData) {

    if (SerializationHelper.getInstance().getMode() == Mode.MODEL) {
        fanims = json.readValue("fanims", HashMap.class, AnimationDesc.class, jsonData);
        initAnimation = json.readValue("initAnimation", String.class, jsonData);

    } else {

        String currentAnimationId = json.readValue("currentAnimation", String.class, jsonData);

        if (currentAnimationId != null)
            currentAnimation = fanims.get(currentAnimationId);
        flipX = json.readValue("flipX", Boolean.class, jsonData);
    }
}

From source file:com.bladecoder.engine.model.Sprite3DRenderer.java

License:Apache License

@SuppressWarnings("unchecked")
@Override//from ww w. j av a  2 s. c  o  m
public void read(Json json, JsonValue jsonData) {
    if (SerializationHelper.getInstance().getMode() == Mode.MODEL) {
        fanims = json.readValue("fanims", HashMap.class, AnimationDesc.class, jsonData);
        initAnimation = json.readValue("initAnimation", String.class, jsonData);
    } else {

        String currentAnimationId = json.readValue("currentAnimation", String.class, jsonData);

        if (currentAnimationId != null)
            currentAnimation = fanims.get(currentAnimationId);

        animationCb = ActionCallbackSerialization.find(json.readValue("animationCb", String.class, jsonData));

        currentCount = json.readValue("currentCount", Integer.class, jsonData);
        currentAnimationType = json.readValue("currentAnimationType", Tween.Type.class, jsonData);
        lastAnimationTime = json.readValue("lastAnimationTime", Float.class, jsonData);
    }

    float worldScale = EngineAssetManager.getInstance().getScale();
    width = (int) (json.readValue("width", Integer.class, jsonData) * worldScale);
    height = (int) (json.readValue("height", Integer.class, jsonData) * worldScale);
    cameraPos = json.readValue("cameraPos", Vector3.class, jsonData);
    cameraRot = json.readValue("cameraRot", Vector3.class, jsonData);
    cameraName = json.readValue("cameraName", String.class, jsonData);
    cameraFOV = json.readValue("cameraFOV", Float.class, jsonData);
    modelRotation = json.readValue("modelRotation", Float.class, jsonData);
    renderShadow = json.readValue("renderShadow", Boolean.class, jsonData);
}