本文整理汇总了Java中com.badlogic.gdx.utils.JsonValue.get方法的典型用法代码示例。如果您正苦于以下问题:Java JsonValue.get方法的具体用法?Java JsonValue.get怎么用?Java JsonValue.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.JsonValue
的用法示例。
在下文中一共展示了JsonValue.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
JsonValue contextsJson = jsonValue.get("contexts");
for (JsonValue contextJson : contextsJson) {
String name = contextJson.getString("name");
JsonValue inputsJson = contextJson.get("inputs");
InputContext inputContext = new InputContext(name);
for (JsonValue inputJson : inputsJson) {
//inputContext.addInput(inputFromJson(inputJson));
}
inputContexts.add(inputContext);
}
}
示例2: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
ModelComponent modelComponent =
nhg.entities.createComponent(entity, ModelComponent.class);
String type = jsonValue.getString("graphicsType");
String asset = jsonValue.getString("asset", "");
boolean enabled = jsonValue.getBoolean("enabled", true);
JsonValue materialsJson = jsonValue.get("materials");
if (materialsJson != null) {
for (JsonValue mat : materialsJson) {
PbrMaterialJson pbrMaterialJson = new PbrMaterialJson();
pbrMaterialJson.parse(mat);
modelComponent.pbrMaterials.add(pbrMaterialJson.get());
}
}
modelComponent.type = ModelComponent.Type.fromString(type);
modelComponent.asset = asset;
modelComponent.enabled = enabled;
output = modelComponent;
}
示例3: AnimationDescription
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
public AnimationDescription(T key, JsonValue line) {
this.key = key;
this.startingFrame = line.getInt("start");
this.numberOfFrames = line.getInt("count");
this.playMode = line.getInt("mode");
this.sounds = readSoundInfo(line.get("sounds"));
JsonValue offset = line.get("middleOffset");
if (offset != null) {
middleOffsets.put(key, new Vector2(offset.getInt("x"), offset.getInt("y")));
}
JsonValue bounds = line.get("bounds");
if (bounds != null) {
for (JsonValue rectangle : bounds) {
this.bounds.put(Integer.valueOf(rectangle.name().trim()), new Rectangle(rectangle.getInt("x"),
rectangle.getInt("y"), rectangle.getInt("width"), rectangle.getInt("height")));
}
}
}
示例4: read
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void read (Json json, JsonValue jsonData) {
if (jsonData.has("time"))
time = jsonData.getInt("time");
if (jsonData.get("value").isNumber())
value = jsonData.getFloat("value");
else
value = new Color();
JsonValue curveValue = jsonData.get("curve");
JsonValue constraintsValue = curveValue.get("constraints");
int c1, c2, c3, c4;
c1 = constraintsValue.getInt("c1");
c2 = constraintsValue.getInt("c2");
c3 = constraintsValue.getInt("c3");
c4 = constraintsValue.getInt("c4");
curve = new Curve();
curve.constraints.set(c1, c2, c3, c4);
if (curveValue.has("type"))
curve.setType(json.readValue(Type.class, curveValue.get("type")));
}
示例5: parseBHTNode
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
final StructBHTNode parseBHTNode(int depth, JsonValue jv) {
String name = jv.name;
String args = jv.getString("args", null);
String key = jv.getString("key", null);
StructBHTNode BHTNode = new StructBHTNode();
BHTNode.type = name;
BHTNode.args = args;
BHTNode.key = key;
BHTNode.depth = depth;
int childrenCount = jv.size;
if(args != null) {
childrenCount -= 1;
}
if(key != null) {
childrenCount -= 1;
}
if(childrenCount > 0) {
BHTNode.children = new StructBHTNode[childrenCount];
}
for(int i = 0, count = 0; i < jv.size; ++i) {
JsonValue jv_child = jv.get(i);
if(jv_child.name == null) {
CCLog.error(TAG, "child name cannot be null!");
throw new GdxRuntimeException("child name cannot be null!");
}
if(jv_child.name.equals("args") || jv_child.name.equals("key")) {
continue;
}
BHTNode.children[count++] = parseBHTNode(depth+1, jv_child);
}
return BHTNode;
}
示例6: load
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
public static SerialArray<Tile> load(String map, HashMap<Integer, Player> players) {
JsonValue value = reader.parse(map);
float scale = value.getFloat("scale");
JsonValue regions = value.get("regions");
SerialArray<Tile> tiles = new SerialArray<>();
for (JsonValue region : regions) {
Color color = Color.valueOf(region.getString("color"));
for (JsonValue tile : region.get("tiles")) {
int x = tile.getInt("x"), y = tile.getInt("y");
int width = tile.getInt("w"), height = tile.getInt("h");
Tile t = new Tile(x * scale, y * scale, (int) (width * scale), (int) (height * scale), color);
t.setRegion(region.name);
t.setTroops(tile.getInt("troops"));
if (tile.get("city") != null) {
JsonValue city = tile.get("city");
float cx = city.getInt("x") * scale, cy = city.getInt("y") * scale;
City c = new City(cx + t.getX(), cy + t.getY(), city.getBoolean("major"));
t.setCity(c);
}
if (players.get(tile.getInt("owner")) != null) {
t.setOwner(players.get(tile.getInt("owner")));
}
t.setIndex(tile.getInt("index"));
tiles.add(t);
}
}
for (int i = 0; i < tiles.size; i++) {
tiles.get(i).setContacts(tiles);
}
return tiles;
}
示例7: readCurve
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
void readCurve (JsonValue map, CurveTimeline timeline, int frameIndex) {
JsonValue curve = map.get("curve");
if (curve == null) return;
if (curve.isString() && curve.asString().equals("stepped"))
timeline.setStepped(frameIndex);
else if (curve.isArray()) {
timeline.setCurve(frameIndex, curve.getFloat(0), curve.getFloat(1), curve.getFloat(2), curve.getFloat(3));
}
}
示例8: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
JsonValue positionJson = jsonValue.get("position");
JsonValue rotationJson = jsonValue.get("rotation");
JsonValue scaleJson = jsonValue.get("scale");
float xPosition = 0;
float yPosition = 0;
float zPosition = 0;
float xRotation = 0;
float yRotation = 0;
float zRotation = 0;
float xScale = 1;
float yScale = 1;
float zScale = 1;
if (positionJson != null) {
xPosition = positionJson.getFloat("x");
yPosition = positionJson.getFloat("y");
zPosition = positionJson.getFloat("z");
}
if (rotationJson != null) {
xRotation = rotationJson.getFloat("x");
yRotation = rotationJson.getFloat("y");
zRotation = rotationJson.getFloat("z");
}
if (scaleJson != null) {
xScale = scaleJson.getFloat("x");
yScale = scaleJson.getFloat("y");
zScale = scaleJson.getFloat("z");
}
position.set(xPosition, yPosition, zPosition);
rotation.set(xRotation, yRotation, zRotation);
scale.set(xScale, yScale, zScale);
}
示例9: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
String name = jsonValue.getString("name");
JsonValue entitiesJson = jsonValue.get("entities");
JsonValue assetsJson = jsonValue.get("assets");
output = new Scene(nhg, "root");
output.name = name;
for (JsonValue assetJson : assetsJson) {
AssetJson aj = new AssetJson();
aj.parse(assetJson);
Asset asset = aj.get();
output.assets.add(asset);
}
int rootEntity = output.sceneGraph.getRootEntity();
if (entitiesJson != null) {
for (JsonValue entity : entitiesJson) {
EntityJson entityJson = new EntityJson(nhg);
entityJson.setSceneGraph(output.sceneGraph);
entityJson.setParentEntity(rootEntity);
entityJson.parse(entity);
}
}
NodeComponent nodeComponent = nhg.entities.getComponent(rootEntity, NodeComponent.class);
nodeComponent.applyTransforms();
}
示例10: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
UiComponent uiComponent = nhg.entities.createComponent(entity, UiComponent.class);
uiComponent.fileName = jsonValue.getString("fileName", "");
String uiType = jsonValue.getString("uiType", "screen").toLowerCase();
if (uiType.contentEquals("screen")) {
uiComponent.type = UiComponent.Type.SCREEN;
} else if (uiType.contentEquals("panel")) {
uiComponent.type = UiComponent.Type.PANEL;
}
JsonValue dependenciesJson = jsonValue.get("dependencies");
for (int i = 0; i < dependenciesJson.size; i++) {
AssetJson assetJson = new AssetJson();
assetJson.parse(dependenciesJson.get(i));
Asset dependency = assetJson.get();
uiComponent.dependencies.add(dependency);
}
JsonValue actorNamesJson = jsonValue.get("actors");
for (int i = 0; i < actorNamesJson.size; i++) {
String actor = actorNamesJson.getString(i);
uiComponent.actorNames.add(actor);
}
output = uiComponent;
}
示例11: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
MessageComponent messageComponent =
nhg.entities.createComponent(entity, MessageComponent.class);
JsonValue filters = jsonValue.get("filters");
messageComponent.subscribe(filters.asStringArray());
output = messageComponent;
}
示例12: read
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void read (Json json, JsonValue jsonData) {
sortingLayers.clear();
JsonValue sortingLayersValue = jsonData.get("sortingLayers");
JsonValue currentLayerValue = sortingLayersValue.child();
while (currentLayerValue != null) {
sortingLayers.add(currentLayerValue.asString());
currentLayerValue = currentLayerValue.next();
}
backgroundColor = JsonUtil.readColorFromJson(jsonData, "backgroundColor");
ambientLightColor = JsonUtil.readColorFromJson(jsonData, "ambientLightColor");
}
示例13: loadRanges
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
protected void loadRanges(JsonValue root) {
if (root.has("duration")) {
durationRange.set(ConversionUtils.toVector2(root.get("duration")));
}
if (root.has("num_particles")) {
particlesRange.set(ConversionUtils.toVector2(root.get("num_particles")));
}
if (root.has("position_offset")) {
Vector2 minOffset = ConversionUtils.toVector2(root.get("position_offset").get(0));
Vector2 maxOffset = ConversionUtils.toVector2(root.get("position_offset").get(1));
xOffsetRange.set(minOffset.x, maxOffset.x);
yOffsetRange.set(minOffset.y, maxOffset.y);
}
if (root.has("angular_velocity")) {
angularVelocityRange.set(ConversionUtils.toVector2(root.get("angular_velocity")));
}
if (root.has("color")) {
Color minColor = ConversionUtils.toColor(root.get("color").get(0));
Color maxColor = ConversionUtils.toColor(root.get("color").get(1));
redRange.set(minColor.r, maxColor.r);
greenRange.set(minColor.g, maxColor.g);
blueRange.set(minColor.b, maxColor.b);
alphaRange.set(minColor.a, maxColor.a);
}
if (root.has("velocity")) {
JsonValue velocityRoot = root.get("velocity");
Vector2 minVelocity = ConversionUtils.toVector2(velocityRoot.get("range").get(0));
Vector2 maxVelocity = ConversionUtils.toVector2(velocityRoot.get("range").get(1));
vxRange.set(minVelocity.x, maxVelocity.x);
vyRange.set(minVelocity.y, maxVelocity.y);
velocitySplits.set(ConversionUtils.toVector2(velocityRoot.get("splits")));
}
}
示例14: load
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
protected void load(JsonValue json) {
Array<Vector2> legs = new Array<Vector2>();
for (JsonValue leg : json.get("legs")) {
legs.add(ConversionUtils.toVector2(leg));
}
pathHelper = new LinearPathHelper(legs);
}
示例15: load
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
protected void load(JsonValue json) {
JsonValue xRoot = json.get("x");
xAmplitude = xRoot.getFloat("amplitude");
xHShift = xRoot.getFloat("h_shift");
xVShift = xRoot.getFloat("v_shift");
xNumCycles = xRoot.getFloat("num_cycles");
JsonValue yRoot = json.get("y");
yAmplitude = yRoot.getFloat("amplitude");
yHShift = yRoot.getFloat("h_shift");
yVShift = yRoot.getFloat("v_shift");
yNumCycles = yRoot.getFloat("num_cycles");
}