本文整理汇总了Java中com.badlogic.gdx.utils.JsonValue.getString方法的典型用法代码示例。如果您正苦于以下问题:Java JsonValue.getString方法的具体用法?Java JsonValue.getString怎么用?Java JsonValue.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.JsonValue
的用法示例。
在下文中一共展示了JsonValue.getString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromJson
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
protected static GjScoreboardEntry fromJson(JsonValue json, int rank, String currentPlayer) {
GjScoreboardEntry gje = new GjScoreboardEntry();
gje.rank = String.valueOf(rank);
gje.score = json.getString("score");
gje.sort = json.getLong("sort");
gje.tag = json.getString("extra_data");
String userId = json.getString("user_id");
if (userId != null && !userId.isEmpty()) {
gje.userId = userId;
gje.displayName = json.getString("user");
gje.currentPlayer = (currentPlayer != null && currentPlayer.equalsIgnoreCase(gje.displayName));
} else
gje.displayName = json.getString("guest");
gje.stored = json.getString("stored");
return gje;
}
示例2: 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);
}
}
示例3: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
String alias = jsonValue.getString("alias");
String source = jsonValue.getString("source");
String classString = jsonValue.getString("classAlias");
String dependenciesPath = jsonValue.getString(
"dependenciesPath",
getDefaultDependenciesPath(source));
if (!dependenciesPath.endsWith("/")) {
dependenciesPath += "/";
}
Class assetClass = SceneUtils.assetClassFromAlias(classString);
output = new Asset(alias, source, assetClass);
output.dependenciesPath = dependenciesPath;
}
示例4: read
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void read (Json json, JsonValue jsonData) {
if (jsonData.has("sortingLayerName"))
sortingLayerName = jsonData.getString("sortingLayerName");
if (jsonData.has("sortingOrder"))
sortingOrder = jsonData.getInt("sortingOrder");
if (jsonData.has("enabled"))
enabled = jsonData.getBoolean("enabled");
if (jsonData.has("shader")) {
Shader shader = new Shader("");
shader.read(json, jsonData.get("shader"));
this.shader = shader;
}
if(jsonData.has("srcBlendFunction"))
srcBlendFunction = jsonData.getInt("srcBlendFunction");
if(jsonData.has("dstBlendFunction"))
srcBlendFunction = jsonData.getInt("dstBlendFunction");
}
示例5: 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;
}
示例6: read
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void read(Json json, JsonValue jsonValue) {
try {
name = jsonValue.getString("name");
optional = jsonValue.getBoolean("optional");
if (jsonValue.get("value").isNumber()) {
type = Float.TYPE;
value = Double.parseDouble(jsonValue.getString("value"));
} else {
type = ClassReflection.forName(jsonValue.getString("type"));
if (jsonValue.get("value").isNull()) {
value = null;
} else {
value = jsonValue.getString("value");
}
}
} catch (ReflectionException ex) {
Gdx.app.error(getClass().toString(), "Error reading from serialized object" , ex);
DialogFactory.showDialogErrorStatic("Read Error...","Error reading from serialized object.\n\nOpen log?");
}
}
示例7: 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;
}
示例8: fromJson
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
protected static GjTrophy fromJson(JsonValue json) {
GjTrophy trophy = new GjTrophy();
trophy.difficulty = json.getString("difficulty");
trophy.trophyAchieved = json.getString("achieved");
trophy.iconUrl = json.getString("image_url");
trophy.trophyDesc = json.getString("description");
trophy.trophyTitle = json.getString("title");
trophy.trophyId = json.getString("id");
return trophy;
}
示例9: createMenu
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
private void createMenu() {
root = new Table();
root.setFillParent(true);
stage.addActor(root);
FileHandle fileHandle = Gdx.files.local(Core.DATA_PATH + "/data.json");
JsonReader reader = new JsonReader();
JsonValue val = reader.parse(fileHandle);
Label title = new Label(val.getString("title"), skin, "title");
root.add(title).padTop(50.0f).padBottom(75.0f);
root.row();
BouncingImage image = new BouncingImage(getCharacter());
root.add(image);
root.row();
ImageButton imageButton = new ImageButton(skin, "play");
root.add(imageButton).padTop(75.0f).expandY().top();
imageButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
getCore().getAssetManager().get(Core.DATA_PATH + "/sfx/jump.wav", Sound.class).play();
showCharacterDialog();
}
});
}
示例10: handleHttpResponse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void handleHttpResponse(Net.HttpResponse httpResponse) {
String result = httpResponse.getResultAsString();
Json json = new Json();
ArrayList list = json.fromJson(ArrayList.class, result);
Array<LeaderBoardEntry> leaderBoardEntries = new Array<LeaderBoardEntry>();
if (list != null) {
for (Object entry : list) {
if (entry != null && entry instanceof JsonValue) {
JsonValue jsonEntry = (JsonValue) entry;
// the reflection does not seem to work on iOS
// LeaderBoardEntry leaderBoardEntry = json.readValue(
// LeaderBoardEntry.class, (JsonValue)entry);
LeaderBoardEntry leaderBoardEntry = new LeaderBoardEntry();
try {
leaderBoardEntry.name = jsonEntry.getString("name");
leaderBoardEntry.rank = jsonEntry.getInt("rank");
leaderBoardEntry.score = jsonEntry.getInt("score");
} catch (IllegalArgumentException e) {
Gdx.app.log(TAG, "failed to read json: " + e.toString());
return;
}
leaderBoardEntries.add(leaderBoardEntry);
}
}
}
mListener.onSuccess(leaderBoardEntries);
}
示例11: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
pbrMaterial = new PbrMaterial();
pbrMaterial.targetNode = jsonValue.getString("targetNode", "");
String albedo = jsonValue.getString("albedo", "");
String metalness = jsonValue.getString("metalness", "");
String roughness = jsonValue.getString("roughness", "");
String normal = jsonValue.getString("normal", "");
String ambientOcclusion = jsonValue.getString("ambientOcclusion", "");
if (albedo != null) {
pbrMaterial.albedo = albedo;
}
if (metalness != null) {
pbrMaterial.metalness = metalness;
}
if (roughness != null) {
pbrMaterial.roughness = roughness;
}
if (normal != null) {
pbrMaterial.normal = normal;
}
if (ambientOcclusion != null) {
pbrMaterial.ambientOcclusion = ambientOcclusion;
}
}
示例12: read
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void read (Json json, JsonValue jsonData) {
super.read(json, jsonData);
if (jsonData.has("width"))
width = jsonData.getFloat("width");
if (jsonData.has("height"))
height = jsonData.getFloat("height");
if (jsonData.has("texture"))
texturePath = jsonData.getString("texture");
if (jsonData.has("srcX")) {
useCustomSrc = true;
srcX = jsonData.getInt("srcX");
}
if (jsonData.has("srcY"))
srcY = jsonData.getInt("srcY");
if (jsonData.has("srcWidth"))
srcWidth = jsonData.getInt("srcWidth");
if (jsonData.has("srcHeight"))
srcHeight = jsonData.getInt("srcHeight");
if (jsonData.has("originX"))
originX = jsonData.getFloat("originX");
if (jsonData.has("originY"))
originY = jsonData.getFloat("originY");
if (jsonData.has("minFilter"))
minFilter = jsonData.getString("minFilter").equals("Linear") ? TextureFilter.Linear : TextureFilter.Nearest;
if (jsonData.has("magFilter"))
magFilter = jsonData.getString("magFilter").equals("Linear") ? TextureFilter.Linear : TextureFilter.Nearest;
if (jsonData.has("tint"))
setColor(JsonUtil.readColorFromJson(jsonData, "tint"));
if (jsonData.has("uWrap")) {
String uWrapStrings = jsonData.getString("uWrap");
uWrap = uWrapStrings.equals("ClampToEdge") ? TextureWrap.ClampToEdge
: uWrapStrings.equals("Repeat") ? TextureWrap.Repeat : TextureWrap.MirroredRepeat;
}
if (jsonData.has("vWrap")) {
String vWrapStrings = jsonData.getString("vWrap");
vWrap = vWrapStrings.equals("ClampToEdge") ? TextureWrap.ClampToEdge
: vWrapStrings.equals("Repeat") ? TextureWrap.Repeat : TextureWrap.MirroredRepeat;
}
}
示例13: parse
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void parse(JsonValue jsonValue) {
boolean quantization = jsonValue.getBoolean("useQuantizedAabbCompression", true);
boolean buildBvh = jsonValue.getBoolean("buildBvh", true);
String asset = jsonValue.getString("asset", "");
shape = new BvhTriangleMeshRigidBodyShape(asset, quantization, buildBvh);
}
示例14: read
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void read (Json json, JsonValue jsonData) {
filePath = jsonData.getString("path");
isMusic = false;
loop = jsonData.getBoolean("loop");
playOnCreate = jsonData.getBoolean("playOnCreate");
}
示例15: read
import com.badlogic.gdx.utils.JsonValue; //导入方法依赖的package包/类
@Override
public void read (Json json, JsonValue jsonData) {
this.name = jsonData.getString("name");
if (jsonData.has("vertexShader")) {
this.individualShaders = true;
this.vertexShader = jsonData.getString("vertexShader");
this.fragmentShader = jsonData.getString("fragmentShader");
Gdx.app.postRunnable(new Runnable() {
@Override
public void run () {
Debug.log("load", Shader.this.fragmentShader);
Shader.this.manager.add(Shader.this.name, RavTech.files.getAssetHandle(vertexShader),
RavTech.files.getAssetHandle(fragmentShader));
}
});
}
String textureString = jsonData.get("textures").toString();
textureString = textureString.substring(textureString.indexOf('{'));
this.textures = json.fromJson(ObjectMap.class, String.class, textureString);
Gdx.app.postRunnable(new Runnable() {
@Override
public void run () {
Entries<String, String> entries = Shader.this.textures.iterator();
while (entries.hasNext) {
Entry<String, String> entry = entries.next();
if (!entry.value.endsWith(".framebuffer") && !RavTech.files.isLoaded(entry.value)) {
RavTech.files.loadAsset(entry.value, Texture.class, true);
((Texture)RavTech.files.getAsset(entry.value, Texture.class)).setFilter(TextureFilter.Linear, TextureFilter.Linear);
}
Shader.this.textures.put(entry.key, entry.value);
}
}
});
}