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

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

Introduction

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

Prototype

public void writeValue(String name, Object value, Class knownType, Class elementType) 

Source Link

Document

Writes the value as a field on the current JSON object, writing the class of the object if it differs from the specified known type.

Usage

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

License:Apache License

@Override
public void write(Json json) {
    if (SerializationHelper.getInstance().getMode() == Mode.MODEL) {

        json.writeValue("fanims", fanims, HashMap.class, AtlasAnimationDesc.class);
        json.writeValue("initAnimation", initAnimation);

    } else {/*from   www. j a va  2 s .  c om*/

        String currentAnimationId = null;

        if (currentAnimation != null)
            currentAnimationId = currentAnimation.id;

        json.writeValue("currentAnimation", currentAnimationId);

        json.writeValue("flipX", flipX);
        json.writeValue("currentFrameIndex", currentFrameIndex);

        json.writeValue("faTween", faTween, faTween == null ? null : FATween.class);
    }
}

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

License:Apache License

@Override
public void write(Json json) {
    super.write(json);
    json.writeValue("dialogs", dialogs, HashMap.class, Dialog.class);

    if (SerializationHelper.getInstance().getMode() == Mode.MODEL) {
    } else {//from   w ww.  j a va  2  s.  co  m
        json.writeValue("standAnim", standAnim);
        json.writeValue("walkAnim", walkAnim);
        json.writeValue("talkAnim", talkAnim);
    }

    json.writeValue("walkingSpeed", walkingSpeed);
    json.writeValue("textColor", textColor);
}

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

License:Apache License

@Override
public void write(Json json) {

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

        json.writeValue("fanims", fanims, HashMap.class, AnimationDesc.class);
        json.writeValue("initAnimation", initAnimation);

    } else {/*from www.j  av  a  2s  .co  m*/

        String currentAnimationId = null;

        if (currentAnimation != null)
            currentAnimationId = currentAnimation.id;

        json.writeValue("currentAnimation", currentAnimationId);

        json.writeValue("flipX", flipX);
    }
}

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

License:Apache License

@Override
public void write(Json json) {
    if (SerializationHelper.getInstance().getMode() == Mode.MODEL) {
        json.writeValue("fanims", fanims, HashMap.class, AnimationDesc.class);
        json.writeValue("initAnimation", initAnimation);
    } else {/*from w w  w.jav a  2  s .c om*/

        String currentAnimationId = null;

        if (currentAnimation != null)
            currentAnimationId = currentAnimation.id;

        json.writeValue("currentAnimation", currentAnimationId);

        json.writeValue("animationCb", ActionCallbackSerialization.find(animationCb));

        json.writeValue("currentCount", currentCount);
        json.writeValue("currentAnimationType", currentAnimationType);
        json.writeValue("lastAnimationTime", lastAnimationTime);

        // TODO: SAVE AND RESTORE CURRENT DIRECTION
        // TODO: shadowlight, cel light
    }

    float worldScale = EngineAssetManager.getInstance().getScale();
    json.writeValue("width", width / worldScale);
    json.writeValue("height", height / worldScale);
    json.writeValue("cameraPos", cameraPos, cameraPos == null ? null : Vector3.class);
    json.writeValue("cameraRot", cameraRot, cameraRot == null ? null : Vector3.class);
    json.writeValue("cameraName", cameraName, cameraName == null ? null : String.class);
    json.writeValue("cameraFOV", cameraFOV);
    json.writeValue("modelRotation", modelRotation);
    json.writeValue("renderShadow", renderShadow);
}

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

License:Apache License

@Override
public void write(Json json) {
    json.writeValue("verbs", verbs, verbs.getClass(), Verb.class);
}

From source file:com.bladecoder.engine.spine.SpineRenderer.java

License:Apache License

@Override
public void write(Json json) {

    if (SerializationHelper.getInstance().getMode() == Mode.MODEL) {
        json.writeValue("fanims", fanims, HashMap.class, AnimationDesc.class);
        json.writeValue("initAnimation", initAnimation);
    } else {//from ww w  .  ja  v  a 2 s .  co  m
        String currentAnimationId = null;

        if (currentAnimation != null)
            currentAnimationId = currentAnimation.id;

        json.writeValue("currentAnimation", currentAnimationId,
                currentAnimationId == null ? null : String.class);

        json.writeValue("flipX", flipX);

        json.writeValue("cb", ActionCallbackSerialization.find(animationCb));
        json.writeValue("currentCount", currentCount);

        if (currentAnimationId != null)
            json.writeValue("currentAnimationType", currentAnimationType);

        json.writeValue("lastAnimationTime", lastAnimationTime);
        json.writeValue("complete", complete);
    }
}

From source file:org.bladecoder.bladeengine.model.AtlasRenderer.java

License:Apache License

@Override
public void write(Json json) {

    json.writeValue("fanims", fanims, HashMap.class, AtlasFrameAnimation.class);

    String currentFrameAnimationId = null;

    if (currentFrameAnimation != null)
        currentFrameAnimationId = currentFrameAnimation.id;

    json.writeValue("currentFrameAnimation", currentFrameAnimationId);

    json.writeValue("initFrameAnimation", initFrameAnimation);

    json.writeValue("flipX", flipX);
    json.writeValue("currentFrameIndex", currentFrameIndex);

    json.writeValue("faTween", faTween, faTween == null ? null : FATween.class);
}

From source file:org.bladecoder.bladeengine.model.SpineRenderer.java

License:Apache License

@Override
public void write(Json json) {

    json.writeValue("fanims", fanims, HashMap.class, FrameAnimation.class);

    String currentFrameAnimationId = null;

    if (currentFrameAnimation != null)
        currentFrameAnimationId = currentFrameAnimation.id;

    json.writeValue("currentFrameAnimation", currentFrameAnimationId,
            currentFrameAnimationId == null ? null : String.class);

    json.writeValue("initFrameAnimation", initFrameAnimation);

    json.writeValue("flipX", flipX);

    if (animationCbSer != null)
        json.writeValue("cb", animationCbSer);
    else//from   ww  w .j av a 2 s  .  c  o  m
        json.writeValue("cb", ActionCallbackSerialization.find(animationCb),
                animationCb == null ? null : String.class);

    json.writeValue("currentCount", currentCount);
    json.writeValue("currentAnimationType", currentAnimationType);
    json.writeValue("lastAnimationTime", lastAnimationTime);
}

From source file:org.bladecoder.bladeengine.model.Sprite3DRenderer.java

License:Apache License

@Override
public void write(Json json) {
    json.writeValue("fanims", fanims, HashMap.class, FrameAnimation.class);

    String currentFrameAnimationId = null;

    if (currentFrameAnimation != null)
        currentFrameAnimationId = currentFrameAnimation.id;

    json.writeValue("currentFrameAnimation", currentFrameAnimationId);

    json.writeValue("initFrameAnimation", initFrameAnimation);

    json.writeValue("width", width);
    json.writeValue("height", height);
    json.writeValue("cameraPos", cameraPos, cameraPos == null ? null : Vector3.class);
    json.writeValue("cameraRot", cameraRot, cameraRot == null ? null : Vector3.class);
    json.writeValue("cameraName", cameraName, cameraName == null ? null : String.class);
    json.writeValue("cameraFOV", cameraFOV);
    json.writeValue("modelRotation", modelRotation);

    if (animationCbSer != null)
        json.writeValue("cb", animationCbSer);
    else/*from   www.j  a v a2  s  . c om*/
        json.writeValue("animationCb", ActionCallbackSerialization.find(animationCb),
                animationCb == null ? null : String.class);

    json.writeValue("currentCount", currentCount);
    json.writeValue("currentAnimationType", currentAnimationType);
    json.writeValue("renderShadow", renderShadow);
    json.writeValue("lastAnimationTime", lastAnimationTime);

    // TODO: SAVE AND RESTORE CURRENT DIRECTION
    // TODO: shadowlight, cel light
}

From source file:org.bladecoder.bladeengine.model.VerbManager.java

License:Apache License

@Override
public void write(Json json) {
    json.writeValue("verbs", verbs, verbs == null ? null : verbs.getClass(), Verb.class);
}