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(Object value) 

Source Link

Document

Writes the value, without writing the class of the object.

Usage

From source file:com.strategames.engine.gameobject.types.Door.java

License:Open Source License

@Override
protected void writeValues(Json json) {
    json.writeArrayStart("nextLevelPosition");
    json.writeValue(entryLevel[0]);
    json.writeValue(entryLevel[1]);//from  w  w  w.  j  a v  a2  s. co  m
    json.writeArrayEnd();
}

From source file:com.vlaaad.dice.pvp.messaging.messages.Start.java

License:Open Source License

public static void register() {
    Config.json.addClassTag("start", Start.class);
    Config.json.addClassTag("coordinate", Grid2D.Coordinate.class);
    Config.json.setElementType(Start.class, "order", String.class);
    Config.json.setSerializer(Grid2D.Coordinate.class, new Json.Serializer<Grid2D.Coordinate>() {
        @Override//from  w  w  w.j  a  va2s . c om
        public void write(Json json, Grid2D.Coordinate object, Class knownType) {
            json.writeArrayStart();
            json.writeValue(object.x());
            json.writeValue(object.y());
            json.writeArrayEnd();
        }

        @Override
        public Grid2D.Coordinate read(Json json, JsonValue jsonData, Class type) {
            return new Grid2D.Coordinate(jsonData.getInt(0), jsonData.getInt(1));
        }
    });
}