Java Code Examples for com.badlogic.gdx.utils.Json#writeValue()

The following examples show how to use com.badlogic.gdx.utils.Json#writeValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseActor.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
@Override
public void write(Json json) {
	BladeJson bjson = (BladeJson) json;
	if (bjson.getMode() == Mode.MODEL) {
		json.writeValue("id", id);
		json.writeValue("bbox", bbox.getVertices());
	} else {
		if (dirtyProps != 0L)
			json.writeValue("dirtyProps", dirtyProps);
	}

	if (bjson.getMode() == Mode.MODEL || isDirty(DirtyProps.POS)) {
		float worldScale = EngineAssetManager.getInstance().getScale();
		Vector2 scaledPos = new Vector2(bbox.getX() / worldScale, bbox.getY() / worldScale);
		json.writeValue("pos", scaledPos);
	}

	if (bjson.getMode() == Mode.MODEL || isDirty(DirtyProps.VISIBLE))
		json.writeValue("visible", visible);
}
 
Example 2
Source File: TextRenderer.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
@Override
public void write(Json json) {

	BladeJson bjson = (BladeJson) json;
	if (bjson.getMode() == Mode.MODEL) {
		json.writeValue("text", text);
		json.writeValue("fontName", fontName);
		json.writeValue("fontSize", fontSize);
		json.writeValue("borderWidth", borderWidth);
		json.writeValue("borderColor", borderColor);
		json.writeValue("borderStraight", borderStraight);
		json.writeValue("shadowOffsetX", shadowOffsetX);
		json.writeValue("shadowOffsetY", shadowOffsetY);
		json.writeValue("shadowColor", shadowColor);
		json.writeValue("align", textAlign);
		json.writeValue("orgAlign", orgAlign);
	} else {

	}
}
 
Example 3
Source File: DynamicRangeModule.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void write (Json json) {
    super.write(json);
    json.writeValue("lowMin", lowMin, float.class);
    json.writeValue("lowMax", lowMax, float.class);
    json.writeValue("highMin", highMin, float.class);
    json.writeValue("highMax", highMax, float.class);
}
 
Example 4
Source File: CustomClass.java    From skin-composer with MIT License 5 votes vote down vote up
@Override
public void write(Json json) {
    json.writeValue("fullyQualifiedName", fullyQualifiedName);
    json.writeValue("displayName", displayName);
    json.writeValue("styles", styles, Array.class, CustomStyle.class);
    json.writeValue("templateStyle", templateStyle);
    json.writeValue("declareAfterUIclasses", declareAfterUIclasses);
}
 
Example 5
Source File: GameState.java    From FruitCatcher with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Json json) {
	json.writeValue("active", active);
	json.writeValue("challenge", challenge);
	json.writeValue("kidsMode", kidsMode);
	json.writeValue("level", level);
	json.writeValue("totalScore", totalScore);		
}
 
Example 6
Source File: ModuleWrapper.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
  public void write (Json json) {
json.writeValue("id", getId());
if(!titleOverride.equals("")) {
          json.writeValue("titleOverride", titleOverride);
      }
json.writeValue("x", getX());
json.writeValue("y", getY());

json.writeObjectStart("module", module.getClass(), module.getClass());
json.writeValue("data", module, null);
json.writeObjectEnd();
  }
 
Example 7
Source File: Dialog.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Json json) {

	BladeJson bjson = (BladeJson) json;
	if (bjson.getMode() == Mode.MODEL) {
		json.writeValue("id", id);
		// json.writeValue("actor", actor);
	} else {
		json.writeValue("currentOption", currentOption);
	}

	json.writeValue("options", options, DialogOption.class, DialogOption.class);
}
 
Example 8
Source File: RandomRangeModule.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void write (Json json) {
    super.write(json);
    json.writeValue("min", min);
    json.writeValue("max", max);
    json.writeValue("distributed", distributed);
}
 
Example 9
Source File: OffsetModuleWrapper.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Json json) {
    super.write(json);

    json.writeValue("lowScale", lowShape.getScale());
    json.writeValue("highScale", highShape.getScale());
    json.writeValue("equals", equalsButton.isChecked());
}
 
Example 10
Source File: CurveModule.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void write (Json json) {
    super.write(json);
    json.writeArrayStart("points");
    for (Vector2 point : getPoints()) {
        json.writeObjectStart();
        json.writeValue("x", point.x);
        json.writeValue("y", point.y);
        json.writeObjectEnd();
    }
    json.writeArrayEnd();
}
 
Example 11
Source File: StyleProperty.java    From skin-composer with MIT License 5 votes vote down vote up
@Override
public void write(Json json) {
    json.writeValue("type", type.getName());
    json.writeValue("name", name);
    json.writeValue("optional", optional);
    json.writeValue("value", value);
}
 
Example 12
Source File: MathModule.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void write (Json json) {
    super.write(json);
    json.writeValue("a", getDefaultA());
    json.writeValue("b", getDefaultB());
    json.writeValue("mathExpression", MathExpressionMappings.getNameForMathExpression(getExpression()));
}
 
Example 13
Source File: RepeatAction.java    From bladecoder-adventure-engine with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Json json) {
	json.writeValue("currentRepeat", currentRepeat);
}
 
Example 14
Source File: VerbManager.java    From bladecoder-adventure-engine with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Json json) {
	json.writeValue("verbs", verbs, verbs.getClass(), Verb.class);
}
 
Example 15
Source File: GLTFExtensions.java    From gdx-gltf with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Json json) {
	for (Entry<String, Object> extension : extentions) {
		json.writeValue(extension.key, extension.value);
	}
}
 
Example 16
Source File: InterpolationModule.java    From talos with Apache License 2.0 4 votes vote down vote up
@Override
public void write (Json json) {
    super.write(json);
    json.writeValue("interp", InterpolationMappings.getNameForInterpolation(getInterpolation()));
}
 
Example 17
Source File: CustomStyle.java    From skin-composer with MIT License 4 votes vote down vote up
@Override
public void write(Json json) {
    json.writeValue("name", name);
    json.writeValue("properties", properties, Array.class, CustomProperty.class);
    json.writeValue("deletable", deletable);
}
 
Example 18
Source File: InputFileSerializer.java    From gdx-texture-packer-gui with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Json json, InputFile model, Class knownType) {
    String path = PathUtils.relativize(model.getFileHandle().path(), root.getPath());

    json.writeObjectStart();
    json.writeValue("path", path);
    json.writeValue("type", model.getType().name());

    switch (model.getType()) {
        case Input:
            if (model.isDirectory()) {
                //### Input directory properties
                json.writeValue("dirFilePrefix", model.getDirFilePrefix());
                json.writeValue("recursive", model.isRecursive());
                json.writeValue("flattenPaths", model.isFlattenPaths());
            } else {
                //### Input file properties
                json.writeValue("regionName", model.getRegionName());
                // Ninepatch
                if (model.isProgrammaticNinePatch()) {
                    InputFile.NinePatchProps npp = model.getNinePatchProps();
                    json.writeObjectStart("ninepatch");
                    json.writeArrayStart("splits");
                    json.writeValue(npp.left);
                    json.writeValue(npp.right);
                    json.writeValue(npp.top);
                    json.writeValue(npp.bottom);
                    json.writeArrayEnd();
                    json.writeArrayStart("pads");
                    json.writeValue(npp.padLeft);
                    json.writeValue(npp.padRight);
                    json.writeValue(npp.padTop);
                    json.writeValue(npp.padBottom);
                    json.writeArrayEnd();
                    json.writeObjectEnd();
                }
            }
            break;
        case Ignore:
            //### Ignore file properties
            break;
    }
    json.writeObjectEnd();
}
 
Example 19
Source File: VectorFieldModule.java    From talos with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Json json) {
    super.write(json);
    json.writeValue("fgaAssetName", fgaFileName);
}
 
Example 20
Source File: ModuleWrapperGroup.java    From talos with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Json json) {
    json.writeValue("color", frameImage.getColor());
    json.writeValue("text", title.getText());
    json.writeValue("modules", wrappers);
}