本文整理汇总了Java中com.badlogic.gdx.utils.Json.writeObjectStart方法的典型用法代码示例。如果您正苦于以下问题:Java Json.writeObjectStart方法的具体用法?Java Json.writeObjectStart怎么用?Java Json.writeObjectStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.Json
的用法示例。
在下文中一共展示了Json.writeObjectStart方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRequest
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Override
protected void getRequest(Json json) {
boolean hasStart = false;
try {
json.writeObjectStart();
} catch (IllegalStateException e) {
hasStart = true;
}
//write GC codes
json.writeObjectStart("CacheCode");
json.writeArrayStart("CacheCodes");
for (String gcCode : gcCodes) {
json.writeValue(gcCode);
}
json.writeArrayEnd();
json.writeObjectEnd();
super.getRequest(json);
if (!hasStart) json.writeObjectEnd();
}
示例2: getRequest
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Override
protected void getRequest(Json json) {
boolean hasStart = false;
try {
json.writeObjectStart();
} catch (IllegalStateException e) {
hasStart = true;
}
json.writeObjectStart("HiddenByUsers");
json.writeArrayStart("UserNames");
json.writeValue(OwnerName);
json.writeArrayEnd();
json.writeObjectEnd();
super.getRequest(json);
if (!hasStart) json.writeObjectEnd();
}
示例3: getRequest
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Override
protected void getRequest(Json json) {
boolean hasStart = false;
try {
json.writeObjectStart();
} catch (IllegalStateException e) {
hasStart = true;
}
json.writeObjectStart("PointRadius");
json.writeValue("DistanceInMeters", this.distanceInMeters);
json.writeObjectStart("Point");
json.writeValue("Latitude", pos.getLatitude());
json.writeValue("Longitude", pos.getLongitude());
json.writeObjectEnd();
json.writeObjectEnd();
super.getRequest(json);
if (!hasStart) json.writeObjectEnd();
}
示例4: getRequest
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Test
void getRequest() throws IOException {
String expected = TestUtils.getResourceRequestString("testsResources/GetYourUserProfile_request.txt",
isDummy ? null : apiKey);
GetYourUserProfile getYourUserProfile = new GetYourUserProfile(apiKey);
StringWriter writer = new StringWriter();
Json json = new Json(JsonWriter.OutputType.json);
json.setWriter(writer);
json.writeObjectStart();
getYourUserProfile.getRequest(json);
json.writeObjectEnd();
String actual = writer.toString();
//remove "DeviceOperatingSystem"
expected = expected.replace("UNKNOWN", GetYourUserProfile.getDeviceOperatingSystem());
assertEquals(expected, actual, "Should be equals");
}
示例5: write
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Override
public void write (Json json) {
json.writeValue("name", name);
json.writeArrayStart("components");
for (int i = 0; i < components.size; i++)
if (components.get(i) instanceof Rigidbody) {
Rigidbody rigidbody = (Rigidbody)components.get(i);
components.removeIndex(i);
components.insert(1, rigidbody);
}
for (int i = 0; i < components.size; i++) {
GameComponent component = components.get(i);
json.writeObjectStart();
json.writeValue("componentType", component.getType());
component.write(json);
json.writeObjectEnd();
}
json.writeArrayEnd();
}
示例6: write
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Override
public void write(Json json) {
json.writeObjectStart("tile");
json.writeValue("region", region);
json.writeValue("index", index);
json.writeValue("owner", owner.getId());
json.writeValue("troops", troops);
json.writeObjectEnd();
}
示例7: write
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Override
public void write(Json json) {
json.writeObjectStart("player");
json.writeValue("id", getId());
json.writeValue("color", getColor().toString());
json.writeObjectEnd();
}
示例8: write
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Override
public void write(Json json, Bounds object, Class knownType) {
json.writeObjectStart();
json.writeValue("width", object.width);
json.writeValue("height", object.height);
json.writeObjectEnd();
}
示例9: getRequest
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
/**
* see: https://api.groundspeak.com/LiveV6/geocaching.svc/help/operations/GetYourUserProfile#request-json
*
* @param json
*/
@Override
protected void getRequest(Json json) {
json.writeValue("AccessToken", this.gcApiKey);
json.writeObjectStart("ProfileOptions");
json.writeObjectEnd();
json.writeObjectStart("DeviceInfo");
json.writeValue("ApplicationSoftwareVersion", BuildInfo.getRevision());
json.writeValue("DeviceOperatingSystem", getDeviceOperatingSystem());
json.writeObjectEnd();
}
示例10: getRequest
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
/**
* see: https://api.groundspeak.com/LiveV6/geocaching.svc/help/operations/SearchForGeocaches
*
* @param json
*/
protected void getRequest(Json json) {
json.writeValue("AccessToken", this.gcApiKey);
json.writeValue("MaxPerPage", this.number);
json.writeValue("StartIndex", 0);
json.writeValue("IsLite", this.isLite);
json.writeValue("TrackableLogCount", trackableLogCount);
json.writeValue("GeocacheLogCount", geocacheLogCount);
if (this.available) {
json.writeObjectStart("GeocacheExclusions");
json.writeValue("Archived", false);
json.writeValue("Available", true);
json.writeObjectEnd();
}
if (this.excludeHides) {
json.writeObjectStart("NotHiddenByUsers");
json.writeArrayStart("UserNames");
json.writeValue(Config.GcLogin.getValue());
json.writeArrayEnd();
json.writeObjectEnd();
}
if (this.excludeFounds) {
json.writeObjectStart("NotFoundByUsers");
json.writeArrayStart("UserNames");
json.writeValue(Config.GcLogin.getValue());
json.writeArrayEnd();
json.writeObjectEnd();
}
}
示例11: write
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Override public void write(Json json, ClientServerMessage object, Class knownType) {
json.writeObjectStart();
json.writeValue("type", object.type.toString());
if (object.participantId != null) json.writeValue("participant", object.participantId);
if (object.data != null) json.writeValue("data", object.data);
json.writeObjectEnd();
}
示例12: writeColorToJson
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
public static void writeColorToJson (Json json, Color color, String name) {
json.writeObjectStart(name);
json.writeValue("r", color.r);
json.writeValue("g", color.g);
json.writeValue("b", color.b);
json.writeValue("a", color.a);
json.writeObjectEnd();
}
示例13: write
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Override
public void write (Json json) {
json.writeValue("angle", getAngle());
json.writeObjectStart("color");
json.writeValue("r", getColor().r);
json.writeValue("g", getColor().g);
json.writeValue("b", getColor().b);
json.writeValue("a", getColor().a);
json.writeObjectEnd();
json.writeValue("distance", getDistance());
json.writeValue("type", getLightType().toString());
json.writeValue("rayCount", getRayCount());
json.writeValue("isSoft", isSoft());
json.writeValue("softnessLength", getSoftnessLength());
}
示例14: write
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Override
public void write (Json json) {
json.writeValue("density", density);
json.writeObjectStart("filter");
json.writeValue("categoryBits", filter.categoryBits);
json.writeValue("maskBits", filter.maskBits);
json.writeValue("groupIndex", filter.groupIndex);
json.writeObjectEnd();
json.writeValue("friction", friction);
json.writeValue("isSensor", isSensor);
json.writeValue("restitution", restitution);
}
示例15: write
import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Override
public void write(Json json, ScaleFactorModel model, Class knownType) {
json.writeObjectStart();
json.writeValue("suffix", model.getSuffix());
json.writeValue("factor", model.getFactor());
json.writeObjectEnd();
}