com.badlogic.gdx.utils.Json.writeArrayStart()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(161)

本文整理了Java中com.badlogic.gdx.utils.Json.writeArrayStart()方法的一些代码示例,展示了Json.writeArrayStart()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Json.writeArrayStart()方法的具体详情如下:
包路径:com.badlogic.gdx.utils.Json
类名称:Json
方法名:writeArrayStart

Json.writeArrayStart介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

throw new SerializationException("Serialization of an Array other than the known type is not supported.\n"
    + "Known type: " + knownType + "\nActual type: " + actualType);
writeArrayStart();
Array array = (Array)value;
for (int i = 0, n = array.size; i < n; i++)
  throw new SerializationException("Serialization of a Queue other than the known type is not supported.\n"
    + "Known type: " + knownType + "\nActual type: " + actualType);
writeArrayStart();
Queue queue = (Queue)value;
for (int i = 0, n = queue.size; i < n; i++)
if (typeName != null && actualType != ArrayList.class && (knownType == null || knownType != actualType)) {
  writeObjectStart(actualType, knownType);
  writeArrayStart("items");
  for (Object item : (Collection)value)
    writeValue(item, elementType, null);
  writeObjectEnd();
} else {
  writeArrayStart();
  for (Object item : (Collection)value)
    writeValue(item, elementType, null);
if (elementType == null) elementType = actualType.getComponentType();
int length = ArrayReflection.getLength(value);
writeArrayStart();
for (int i = 0; i < length; i++)
  writeValue(ArrayReflection.get(value, i), elementType, null);

代码示例来源:origin: libgdx/libgdx

throw new SerializationException("Serialization of an Array other than the known type is not supported.\n"
    + "Known type: " + knownType + "\nActual type: " + actualType);
writeArrayStart();
Array array = (Array)value;
for (int i = 0, n = array.size; i < n; i++)
  throw new SerializationException("Serialization of a Queue other than the known type is not supported.\n"
    + "Known type: " + knownType + "\nActual type: " + actualType);
writeArrayStart();
Queue queue = (Queue)value;
for (int i = 0, n = queue.size; i < n; i++)
if (typeName != null && actualType != ArrayList.class && (knownType == null || knownType != actualType)) {
  writeObjectStart(actualType, knownType);
  writeArrayStart("items");
  for (Object item : (Collection)value)
    writeValue(item, elementType, null);
  writeObjectEnd();
} else {
  writeArrayStart();
  for (Object item : (Collection)value)
    writeValue(item, elementType, null);
if (elementType == null) elementType = actualType.getComponentType();
int length = ArrayReflection.getLength(value);
writeArrayStart();
for (int i = 0; i < length; i++)
  writeValue(ArrayReflection.get(value, i), elementType, null);

代码示例来源:origin: junkdog/artemis-odb

@Override
public void write(Json json, ArchetypeMapper.TransmuterEntry object, Class knownType) {
  json.writeArrayStart();
  for (int i = 0; i < object.componentTypes.size(); i++) {
    Class<? extends Component> type = object.componentTypes.get(i);
    String name = identifiers.typeToName.get(type);
    json.writeValue(name);
  }
  json.writeArrayEnd();
}

代码示例来源:origin: org.mini2Dx/mini2Dx-core

private <T> void writeArray(Field field, Object array, Json json) throws SerializationException {
  if (field != null) {
    json.writeArrayStart(field.getName());
  } else {
    json.writeArrayStart();
  }
  
  int arrayLength = Array.getLength(array);
  for (int i = 0; i < arrayLength; i++) {
    writeObject(field, Array.get(array, i), null, json);
  }
  json.writeArrayEnd();
}

代码示例来源:origin: junkdog/artemis-odb

@Override
public void write(Json json, Bag bag, Class knownType) {
  json.writeArrayStart();
  for (Object item : bag)
    json.writeValue(item);
  json.writeArrayEnd();
}

代码示例来源:origin: SquidPony/SquidLib

@Override
public void write(Json json, char[][] object, Class knownType) {
  if(object == null)
  {
    json.writeValue(null);
    return;
  }
  int sz = object.length;
  json.writeArrayStart();
  for (int i = 0; i < sz; i++) {
    json.writeValue(String.valueOf(object[i]));
  }
  json.writeArrayEnd();
}

代码示例来源:origin: org.mini2Dx/mini2Dx-core

private <T> void writeSerializedCollection(Field field, SerializedCollection collection, Json json) throws SerializationException {
  if (field != null) {
    json.writeArrayStart(field.getName());
  } else {
    json.writeArrayStart();
  }
  
  int arrayLength = collection.getLength();
  for (int i = 0; i < arrayLength; i++) {
    writeObject(field, collection.get(i), null, json);
  }
  json.writeArrayEnd();
  collection.dispose();
}

代码示例来源:origin: junkdog/artemis-odb

private void writeGroups(Json json, Entity e) {
  if (groupManager == null)
    return;
  ImmutableBag<String> groups = groupManager.getGroups(e);
  if (groups.size() == 0)
    return;
  json.writeArrayStart("groups");
  for (String group : groups) {
    json.writeValue(group);
  }
  json.writeArrayEnd();
}

代码示例来源:origin: SquidPony/SquidLib

@Override
public void write(Json json, Coord object, Class knownType) {
  if(object == null)
  {
    json.writeValue(null);
    return;
  }
  json.writeArrayStart();
  json.writeValue(object.x, int.class);
  json.writeValue(object.y, int.class);
  json.writeArrayEnd();
}

代码示例来源:origin: junkdog/artemis-odb

@Override
public void write(Json json, IntBag entities, Class knownType) {
  recursionLevel++;
  if (recursionLevel == 1) {
    json.writeObjectStart();
    for (int i = 0, s = entities.size(); s > i; i++) {
      Entity e = world.getEntity(entities.get(i));
      json.writeValue(Integer.toString(e.getId()), e);
    }
    json.writeObjectEnd();
  } else {
    json.writeArrayStart();
    for (int i = 0, s = entities.size(); s > i; i++) {
      json.writeValue(entities.get(i));
    }
    json.writeArrayEnd();
  }
  recursionLevel--;
}

代码示例来源:origin: SquidPony/SquidLib

@Override
public void write(Json json, IntDoubleOrderedMap object, Class knownType) {
  if(object == null)
  {
    json.writeValue(null);
    return;
  }
  json.writeObjectStart();
  json.writeArrayStart("k");
  IntDoubleOrderedMap.KeyIterator ki = object.keySet().iterator();
  while (ki.hasNext())
    json.writeValue(ki.nextInt());
  json.writeArrayEnd();
  json.writeArrayStart("v");
  IntDoubleOrderedMap.DoubleIterator vi = object.values().iterator();
  while (vi.hasNext())
    json.writeValue(vi.nextDouble());
  json.writeArrayEnd();
  json.writeValue("f", object.f);
  json.writeObjectEnd();
}

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

json.writeValue("icon", icon);
json.writeArrayStart("actions");
for (Action a : actions) {
  ActionUtils.writeJson(a, json);
  json.writeValue("currentTarget", currentTarget);
json.writeArrayStart("actions");
for (Action a : actions) {
  if (a instanceof Serializable) {

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

json.writeArrayStart("actions");
for (Action a : actions) {
  ActionUtils.writeJson(a, json);
json.writeArrayStart("actionsSer");
for (Action a : actions) {
  if (a instanceof Serializable) {

代码示例来源:origin: com.badlogicgames.gdx/gdx

throw new SerializationException("Serialization of an Array other than the known type is not supported.\n"
    + "Known type: " + knownType + "\nActual type: " + actualType);
writeArrayStart();
Array array = (Array)value;
for (int i = 0, n = array.size; i < n; i++)
  throw new SerializationException("Serialization of a Queue other than the known type is not supported.\n"
    + "Known type: " + knownType + "\nActual type: " + actualType);
writeArrayStart();
Queue queue = (Queue)value;
for (int i = 0, n = queue.size; i < n; i++)
if (typeName != null && actualType != ArrayList.class && (knownType == null || knownType != actualType)) {
  writeObjectStart(actualType, knownType);
  writeArrayStart("items");
  for (Object item : (Collection)value)
    writeValue(item, elementType, null);
  writeObjectEnd();
} else {
  writeArrayStart();
  for (Object item : (Collection)value)
    writeValue(item, elementType, null);
if (elementType == null) elementType = actualType.getComponentType();
int length = ArrayReflection.getLength(value);
writeArrayStart();
for (int i = 0; i < length; i++)
  writeValue(ArrayReflection.get(value, i), elementType, null);

代码示例来源:origin: crashinvaders/gdx-texture-packer-gui

InputFile.NinePatchProps npp = model.getNinePatchProps();
json.writeObjectStart("ninepatch");
json.writeArrayStart("splits");
json.writeValue(npp.left);
json.writeValue(npp.right);
json.writeValue(npp.bottom);
json.writeArrayEnd();
json.writeArrayStart("pads");
json.writeValue(npp.padLeft);
json.writeValue(npp.padRight);

相关文章