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

The following examples show how to use com.badlogic.gdx.utils.Json#writeArrayEnd() . 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: AttachmentPoint.java    From talos with Apache License 2.0 6 votes vote down vote up
@Override
public void write(Json json) {
    if(attachedToSlot >= 0) {
        json.writeValue("slotId", attachedToSlot);
    }
    json.writeValue("type", type.name());
    if(type == Type.ATTACHED) {
        json.writeValue("attachmentType", attachmentType.name());
        json.writeValue("boneName", boneName);
        json.writeValue("offset", offset);
    } else {
        json.writeArrayStart("value");
        json.writeValue(numericalValue.get(0));
        json.writeValue(numericalValue.get(1));
        json.writeValue(numericalValue.get(2));
        json.writeArrayEnd();
    }
}
 
Example 2
Source File: GameScreenState.java    From FruitCatcher with Apache License 2.0 6 votes vote down vote up
@Override
public void write(Json json) {
	json.writeValue("startGameTime", startGameTime);
	json.writeValue("lastBadObjectTime", lastBadObjectTime);
	json.writeValue("lastBonusItemTime", lastBonusItemTime);
	json.writeValue("lastFruitTime", lastFruitTime);
	json.writeValue("isPaused", isPaused);
	json.writeValue("isStarted", isStarted);
	json.writeValue("basketX", basketX);
	json.writeValue("score", score);
	json.writeValue("secondsRemaining", secondsRemaining);
	json.writeValue("isFinished", isFinished);
	
	json.writeArrayStart("fallingObjects");
	for(FallingObjectState fallingObjectState: fallingObjectStates) {
		json.writeValue(fallingObjectState, FallingObjectState.class);
	}
	json.writeArrayEnd();
}
 
Example 3
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 4
Source File: GradientColorModule.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void write (Json json) {
	super.write(json);
	Array<ColorPoint> points = getPoints();
	json.writeArrayStart("points");
	for (ColorPoint point : points) {
           json.writeObjectStart();
           json.writeValue("r", point.color.r);
           json.writeValue("g", point.color.g);
           json.writeValue("b", point.color.b);
           json.writeValue("pos", point.pos);
           json.writeObjectEnd();
	}
	json.writeArrayEnd();
}
 
Example 5
Source File: OffsetModule.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();

    json.writeObjectStart("low");
    json.writeValue("edge", lowEdge);
    json.writeValue("shape", lowShape);
    json.writeValue("side", lowSide);
    json.writeObjectStart("rect");
    json.writeValue("x", lowPos.get(0));
    json.writeValue("y", lowPos.get(1));
    json.writeValue("width", lowSize.get(0));
    json.writeValue("height", lowSize.get(1));
    json.writeObjectEnd();
    json.writeObjectEnd();

    json.writeObjectStart("high");
    json.writeValue("edge", highEdge);
    json.writeValue("shape", highShape);
    json.writeValue("side", highSide);
    json.writeObjectStart("rect");
    json.writeValue("x", highPos.get(0));
    json.writeValue("y", highPos.get(1));
    json.writeValue("width", highSize.get(0));
    json.writeValue("height", highSize.get(1));
    json.writeObjectEnd();
    json.writeObjectEnd();
}
 
Example 6
Source File: MetaData.java    From talos with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Json json) {
    json.writeArrayStart("scopeDefaults");
    for(int i = 0; i < 10; i++) {
        NumericalValue val = TalosMain.Instance().globalScope.getDynamicValue(i);
        float[] arr = new float[4];
        for(int j = 0; j < 4; j++) {
            arr[j] = val.get(j);
        }
        json.writeValue(arr);
    }
    json.writeArrayEnd();

    // now sync preview widget stuff
    float camX = TalosMain.Instance().UIStage().PreviewWidget().getCameraPosX();
    float camY = TalosMain.Instance().UIStage().PreviewWidget().getCameraPosY();

    json.writeValue("previewCamPos", new Vector2(camX, camY));
    json.writeValue("previewCamZoom", TalosMain.Instance().UIStage().PreviewWidget().getCameraZoom());

    json.writeValue("bgImagePath", TalosMain.Instance().UIStage().PreviewWidget().getBackgroundImagePath());
    json.writeValue("bgImageIsInBack", TalosMain.Instance().UIStage().PreviewWidget().isBackgroundImageInBack());
    json.writeValue("bgImageSize", TalosMain.Instance().UIStage().PreviewWidget().getBgImageSize());
    json.writeValue("gridSize", TalosMain.Instance().UIStage().PreviewWidget().getGridSize());

    // particle position
    ParticleEffectInstance particleEffect = TalosMain.Instance().TalosProject().getParticleEffect();
    if(particleEffect != null) {
        json.writeValue("particlePositionX", particleEffect.getPosition().x);
        json.writeValue("particlePositionY", particleEffect.getPosition().y);
    }

    final ObjectMap<FileHandle, FileTracker.FileEntry> currentTabFiles = TalosMain.Instance().FileTracker().getCurrentTabFiles();

    if(currentTabFiles != null) {
        json.writeArrayStart("resourcePaths");
        for (ObjectMap.Entry<FileHandle, FileTracker.FileEntry> currentTabFile : currentTabFiles) {
            json.writeValue(currentTabFile.key.path());
        }
        json.writeArrayEnd();
    }
}
 
Example 7
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();
}