本文整理汇总了Java中com.badlogic.gdx.utils.JsonValue.getFloat方法的典型用法代码示例。如果您正苦于以下问题:Java JsonValue.getFloat方法的具体用法?Java JsonValue.getFloat怎么用?Java JsonValue.getFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.JsonValue
的用法示例。
在下文中一共展示了JsonValue.getFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stickConfigurationFromJson
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
private StickConfiguration stickConfigurationFromJson(JsonValue stickConfigurationJson) {
boolean invertHorizontalAxis = stickConfigurationJson.getBoolean("invertHorizontalAxis");
boolean invertVerticalAxis = stickConfigurationJson.getBoolean("invertVerticalAxis");
float deadZoneRadius = stickConfigurationJson.getFloat("deadZoneRadius");
float horizontalSensitivity = stickConfigurationJson.getFloat("horizontalSensitivity");
float verticalSensitivity = stickConfigurationJson.getFloat("verticalSensitivity");
StickConfiguration stickConfiguration = new StickConfiguration();
stickConfiguration.setInvertHorizontalAxis(invertHorizontalAxis);
stickConfiguration.setInvertVerticalAxis(invertVerticalAxis);
stickConfiguration.setDeadZoneRadius(deadZoneRadius);
stickConfiguration.setHorizontalSensitivity(horizontalSensitivity);
stickConfiguration.setVerticalSensitivity(verticalSensitivity);
return stickConfiguration;
}
示例2: readTextureDescriptor
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
public ObjectMap<Integer, Array<AnimationDescription>> readTextureDescriptor(FileHandle textureDescriptor)
throws IOException {
JsonValue descriptor = new JsonReader().parse(textureDescriptor);
JsonValue frame = descriptor.get("frame");
frameWidth = frame.getInt("width");
frameHeight = frame.getInt("height");
frameDuration = 1 / frame.getFloat("fps");
JsonValue offset = descriptor.get("middleOffset");
middleOffset = new Vector2(offset.getInt("x", 0), offset.getInt("y", 0));
middleOffsets = new ObjectMap<T, Vector2>();
JsonValue object = descriptor.get("object");
objectWidth = object.getInt("width");
objectHeight = object.getInt("height");
ObjectMap<Integer, Array<AnimationDescription>> returnValue = new ObjectMap<Integer, Array<AnimationDescription>>();
for (JsonValue animation : descriptor.get("animations")) {
readAnimation(animation, returnValue);
}
return returnValue;
}
示例3: 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")));
}
示例4: 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;
}
示例5: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
vec = new Vector3(
jsonValue.getFloat("x"),
jsonValue.getFloat("y"),
jsonValue.getFloat("z"));
}
示例6: 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);
}
示例7: readValue
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
public void readValue (Json json, JsonValue currententry) {
String classname = currententry.get("componentType").asString();
GameComponent component = null;
if (classname.equals("Transform")) {
transform.read(json, currententry);
return;
}
if (classname.equals("SpriteRenderer"))
component = new SpriteRenderer(currententry.getString("texture"), currententry.getFloat("width"),
currententry.getFloat("height"));
else if (classname.equals("Rigidbody"))
component = new Rigidbody();
else if (classname.equals("BoxCollider"))
component = new BoxCollider();
else if (classname.equals("AudioEmitter"))
component = new AudioEmitter();
else if (classname.equals("Light"))
component = new Light(LightType.ConeLight);
else if (classname.equals("ScriptComponent"))
component = new ScriptComponent();
else if (classname.equals("GameObject"))
component = new GameObject();
else if (classname.equals("CircleCollider"))
component = new CircleCollider();
else if (classname.equals("FontRenderer"))
component = new FontRenderer();
else if (classname.equals("Animator"))
component = new SpriterAnimator();
else if (classname.equals("Camera"))
component = new Camera();
if (!classname.equals("Transform")) {
addComponent(component);
component.read(json, currententry);
}
}
示例8: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
float radius = jsonValue.getFloat("radius", 1.0f);
float height = jsonValue.getFloat("height", 1.0f);
shape = new CapsuleRigidBodyShape(radius, height);
}
示例9: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
float width = jsonValue.getFloat("width", 0.0f) * 0.5f;
float height = jsonValue.getFloat("height", 0.0f) * 0.5f;
float depth = jsonValue.getFloat("depth", 0.0f) * 0.5f;
shape = new BoxRigidBodyShape(width, height, depth);
}
示例10: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
float radius = jsonValue.getFloat("radius", 1.0f);
float height = jsonValue.getFloat("height", 1.0f);
shape = new ConeRigidBodyShape(radius, height);
}
示例11: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
float width = jsonValue.getFloat("width", 0.0f) * 0.5f;
float height = jsonValue.getFloat("height", 0.0f) * 0.5f;
float depth = jsonValue.getFloat("depth", 0.0f) * 0.5f;
shape = new CylinderRigidBodyShape(width, height, depth);
}
示例12: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue wheelJson) {
WheelComponent wheelComponent = null;
VehicleComponent vehicleComponent = nhg.entities.getComponent(parentEntity, VehicleComponent.class);
if (vehicleComponent != null) {
Vector3Json attachmentPointJson = new Vector3Json();
attachmentPointJson.parse(wheelJson.get("attachmentPoint"));
Vector3Json directionJson = new Vector3Json();
directionJson.parse(wheelJson.get("direction"));
Vector3Json axisJson = new Vector3Json();
axisJson.parse(wheelJson.get("axis"));
int wheelIndex = wheelJson.getInt("wheelIndex");
float radius = wheelJson.getFloat("radius", 0.1f);
float suspensionRestLength = wheelJson.getFloat("suspensionRestLength", radius * 0.3f);
float wheelFriction = wheelJson.getFloat("friction", 5f);
boolean frontWheel = wheelJson.getBoolean("frontWheel", false);
wheelComponent = nhg.entities.createComponent(entity, WheelComponent.class);
wheelComponent.wheelIndex = wheelIndex;
wheelComponent.suspensionRestLength = suspensionRestLength;
wheelComponent.wheelFriction = wheelFriction;
wheelComponent.frontWheel = frontWheel;
wheelComponent.attachmentPoint = attachmentPointJson.get();
wheelComponent.direction = directionJson.get();
wheelComponent.axis = axisJson.get();
wheelComponent.vehicleComponent = vehicleComponent;
}
output = wheelComponent;
}
示例13: load
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
protected void load(JsonValue json) {
if (json.has("loop_delay")) {
loopDelay = json.getFloat("loop_delay");
}
if (json.has("textures")) {
loadSprites(json.get("textures").asStringArray());
}
if (json.has("ranges")) {
loadRanges(json.get("ranges"));
}
if (json.has("modifiers")) {
loadModifiers(json.get("modifiers"));
}
}
示例14: 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");
}
示例15: CharacterAnimationDescription
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
public CharacterAnimationDescription(Pair<String, Orientation> key, JsonValue line) {
super(key, line);
this.numberOfSteps = line.getInt("numberOfSteps", 0);
this.framesPerStep = line.getInt("framesPerStep", 0);
this.tilesTravelledPerStep = line.getFloat("tilesTravelledPerStep", 0);
this.hitFrame = line.getInt("hitFrame", 0);
}