本文整理汇总了Java中com.badlogic.gdx.utils.JsonValue.JsonIterator类的典型用法代码示例。如果您正苦于以下问题:Java JsonIterator类的具体用法?Java JsonIterator怎么用?Java JsonIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JsonIterator类属于com.badlogic.gdx.utils.JsonValue包,在下文中一共展示了JsonIterator类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadTagGroups
import com.badlogic.gdx.utils.JsonValue.JsonIterator; //导入依赖的package包/类
private void loadTagGroups(JsonValue value) {
JsonIterator iterator = value.iterator();
while(iterator.hasNext()) {
loadTagGroup(iterator.next());
}
}
示例2: loadLayers
import com.badlogic.gdx.utils.JsonValue.JsonIterator; //导入依赖的package包/类
private void loadLayers(JsonValue value) {
JsonIterator iterator = value.iterator();
int track = 0;
while(iterator.hasNext()) {
loadLayer(iterator.next(), track++);
}
}
示例3: loadLayer
import com.badlogic.gdx.utils.JsonValue.JsonIterator; //导入依赖的package包/类
private void loadLayer(JsonValue value, int track) {
String name = value.name;
Array<Entry> entries = new Array<Entry>();
JsonIterator iterator = value.iterator();
while(iterator.hasNext()) {
entries.add(loadEntry(iterator.next()));
}
data.mutableLayers.add(new Layer(name, entries, track));
}
示例4: loadTransitions
import com.badlogic.gdx.utils.JsonValue.JsonIterator; //导入依赖的package包/类
private void loadTransitions(JsonValue value) {
data.defaultDuration = value.getFloat("defaultDuration");
if (!value.has("list")) { return; }
JsonIterator iterator = value.get("list").iterator();
while (iterator.hasNext()) {
loadTransition(iterator.next());
}
}
示例5: loadFixtureDefs
import com.badlogic.gdx.utils.JsonValue.JsonIterator; //导入依赖的package包/类
private void loadFixtureDefs(JsonValue root) {
JsonValue fixtures = root.get("fixtures");
JsonIterator fixturesIt = fixtures.iterator();
int index = 0;
while (fixturesIt.hasNext()) {
JsonValue fixture = fixturesIt.next();
FixtureDef fixtureDef = new FixtureDef();
fixtureDef.density = fixture.getFloat("density", 1.0f);
fixtureDef.restitution = fixture.getFloat("restitution", 0.0f);
fixtureDef.friction = fixture.getFloat("friction", 1.0f);
fixtureDef.isSensor = fixture.getBoolean("isSensor", false);
fixtureDef.shape = loadShape(fixture);
loadFilter(fixture, fixtureDef.filter);
String id = fixture.getString("id", "");
logger.info("loading fixture with id " + id);
physicsData.fixtureNames.add(id);
physicsData.fixtureIdx.put(id, index);
physicsData.fixtureDefs.add(fixtureDef);
++index;
}
}
示例6: loadArchetypes
import com.badlogic.gdx.utils.JsonValue.JsonIterator; //导入依赖的package包/类
public void loadArchetypes() {
try {
JsonReader reader = new JsonReader();
JsonValue root = reader.parse(Gdx.files.internal(ARCHETYPES_FILE));
JsonIterator entitiesIt = root.iterator();
while (entitiesIt.hasNext()) {
JsonValue entity = entitiesIt.next();
loadEntityArchetype(Gdx.files.internal(entity.asString()));
}
}
catch (Exception e) {
logger.error("failed to process entity list " + ARCHETYPES_FILE);
}
}
示例7: ParticleEffectPools
import com.badlogic.gdx.utils.JsonValue.JsonIterator; //导入依赖的package包/类
public ParticleEffectPools() {
logger = new Logger(TAG, Env.debugLevel);
logger.info("initialising");
pools = new ObjectMap<String, ParticleEffectPool>();
try {
JsonReader reader = new JsonReader();
JsonValue root = reader.parse(Gdx.files.internal(PARTICLES_FILE));
JsonIterator particlesIt = root.iterator();
while (particlesIt.hasNext()) {
JsonValue particleValue = particlesIt.next();
String effectName = particleValue.asString();
logger.info("loading " + effectName);
ParticleEffect effect = new ParticleEffect();
effect.load(Gdx.files.internal(effectName), Gdx.files.internal(PARTICLES_FOLDER));
pools.put(effectName, new ParticleEffectPool(effect,
Env.particlePoolInitialCapacity,
Env.particlePoolMaxCapacity));
}
}
catch (Exception e) {
logger.error("failed to list directory " + PARTICLES_FILE);
}
}
示例8: loadGroups
import com.badlogic.gdx.utils.JsonValue.JsonIterator; //导入依赖的package包/类
private void loadGroups(String assetFile) {
groups = new ObjectMap<String, Array<Asset>>();
logger.info("loading file " + assetFile);
// try {
Json json = new Json();
JsonReader reader = new JsonReader();
JsonValue root = reader.parse(Gdx.files.internal(assetFile));
JsonIterator groupIt = root.iterator();
while (groupIt.hasNext()) {
JsonValue groupValue = groupIt.next();
if (groups.containsKey(groupValue.name)) {
logger.error("group " + groupValue.name + " already exists, skipping");
continue;
}
logger.info("registering group " + groupValue.name);
Array<Asset> assets = new Array<Asset>();
JsonIterator assetIt = groupValue.iterator();
while (assetIt.hasNext()) {
JsonValue assetValue = assetIt.next();
Asset asset = json.fromJson(Asset.class, assetValue.toString());
assets.add(asset);
}
groups.put(groupValue.name, assets);
}
// }
// catch (Exception e) {
// logger.error("error loading file " + assetFile + " " + e.getMessage());
// }
}
示例9: loadMaterialsFile
import com.badlogic.gdx.utils.JsonValue.JsonIterator; //导入依赖的package包/类
private void loadMaterialsFile(FileHandle materialsFile) {
logger.info("adding default material");
FixtureDef fixtureDef = new FixtureDef();
fixtureDef.density = 1.0f;
fixtureDef.friction = 1.0f;
fixtureDef.restitution = 0.0f;
materials.put("default", fixtureDef);
logger.info("loading materials file");
try {
JsonReader reader = new JsonReader();
JsonValue root = reader.parse(materialsFile);
JsonIterator materialIt = root.iterator();
while (materialIt.hasNext()) {
JsonValue materialValue = materialIt.next();
if (!materialValue.has("name")) {
logger.error("material without name");
continue;
}
String name = materialValue.getString("name");
fixtureDef = new FixtureDef();
fixtureDef.density = materialValue.getFloat("density", 1.0f);
fixtureDef.friction = materialValue.getFloat("friction", 1.0f);
fixtureDef.restitution = materialValue.getFloat("restitution", 0.0f);
logger.info("adding material " + name);
materials.put(name, fixtureDef);
}
} catch (Exception e) {
logger.error("error loading " + materialsFile.name() + " " + e.getMessage());
}
}
示例10: loadAsync
import com.badlogic.gdx.utils.JsonValue.JsonIterator; //导入依赖的package包/类
@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle file, AnimationStateDataLoaderParameter parameter) {
logger.info("loading " + fileName);
data = new AnimationStateData(manager.get(parameter.skeletonName, SkeletonData.class));
try {
JsonReader reader = new JsonReader();
JsonValue root = reader.parse(file);
float defaultBlend = root.get("defaultBlend").asFloat();
logger.info("default blend: " + defaultBlend + "s");
data.setDefaultMix(defaultBlend);
JsonIterator blendIt = root.get("blends").iterator();
while (blendIt.hasNext()) {
JsonValue blendValue = blendIt.next();
String from = blendValue.get("from").asString();
String to = blendValue.get("to").asString();
float duration = blendValue.get("duration").asFloat();
data.setMix(from, to , duration);
logger.info("blend: " + from + " -> " + to + " [" + duration + "s]");
}
}
catch (Exception e) {
logger.error("error loading " + fileName + " " + e.getMessage());
}
}
示例11: loadAsync
import com.badlogic.gdx.utils.JsonValue.JsonIterator; //导入依赖的package包/类
/**
* Aynchronously loads the animation data animations
*/
@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle file, AnimationParameter parameter) {
logger.info("loading " + fileName);
animationData = new SpriteAnimationData();
// Retrieve texture
animationData.texture = manager.get(stripExtension(fileName) + ".png", Texture.class);
try {
JsonReader reader = new JsonReader();
JsonValue root = reader.parse(file);
animationData.rows = root.getInt("rows");
animationData.columns = root.getInt("columns");
animationData.frameDuration = root.getFloat("frameDuration");
JsonValue animations = root.get("animations");
JsonIterator animationsIt = animations.iterator();
boolean first = true;
while (animationsIt.hasNext()) {
JsonValue animationValue = animationsIt.next();
String name = animationValue.getString("name");
String frames = animationValue.getString("frames");
Animation animation = new Animation(animationData.frameDuration,
getAnimationFrames(animationData.texture, frames),
getPlayMode(animationValue.getString("mode", "normal")));
animationData.animations.put(name, animation);
logger.info("" + fileName + " loaded animation " + name);
if (first) {
animationData.defaultAnimation = animation;
first = false;
}
}
} catch (Exception e) {
logger.error("error loading file " + fileName + " " + e.getMessage());
}
}