public static WorldVO create(JsonValue worldObject) { WorldVO worldVO = new WorldVO(); worldVO.id = worldObject.getInt("id"); worldVO.unlock = worldObject.getInt("stars_to_unlock"); JsonValue levels = worldObject.get("levels"); int len = levels.size; worldVO.levelVOs = new LevelVO[len]; for (int i = 0; i < len; i++) { worldVO.levelVOs[i] = LevelVO.create(levels.get(i)); }
private boolean jsonHasCode200AndBody(JsonValue jsonValue) { return jsonValue.has("code") && jsonValue.getInt("code") == 200 && jsonValue.has("body"); }
private boolean jsonHasCode200AndBody(JsonValue jsonValue) { return jsonValue.has("code") && jsonValue.getInt("code") == 200 && jsonValue.has("body"); }
/**获取默认物理攻击符卡*/public static Spellcard patk() { return Game.item.get(Game.prop.get("system").getInt("patkSpellcardId"), Spellcard.class); } /**获取默认魔法攻击符卡*/public static Spellcard matk() { return Game.item.get(Game.prop.get("system").getInt("matkSpellcardId"), Spellcard.class); }
/**获取默认魔法攻击符卡*/public static Spellcard matk() { return Game.item.get(Game.prop.get("system").getInt("matkSpellcardId"), Spellcard.class); }
public Note(Integer id, JsonValue value) { super(id, value); packable = false; index = value.has("index") ? value.getLong("index") : 0; spellcard = value.has("spellcard") ? value.getInt("spellcard") : null; }
@Override public void deserializeState(String data) { if (data == null) return; JsonValue jsonValue = new JsonReader().parse(data); level = jsonValue.getInt("level", level); removeGamma = jsonValue.getBoolean("removeGamma", removeGamma); }
public Spellcard(Integer id, JsonValue value) { super(id, value); description2 = value.has("description2") ? value.getString("description2") : ""; cost = value.has("cost") ? value.getInt("cost") : 0; }
JsonValue json = new JsonReader().parse(text); Array<Weapon> weapons = new Array<Weapon>(); JsonValue weaponsJson = json.get("weapons"); for (JsonValue weaponJson : weaponsJson.iterator()) // iterator() returns a list of children { Weapon newWeapon = new Weapon(); newWeapon.name = weaponJson.getString("name"); newWeapon.price = weaponJson.getInt("price"); weapons.add(newWeapon); }
public BaseItem(Integer id, JsonValue value) { this.id = id; this.disable = value.has("disable") ? value.getBoolean("disable") : false; this.description = value.getString("description"); this.throwable = value.has("throwable") ? value.getBoolean("throwable") : true; this.name = value.getString("name"); this.type = value.getString("type"); this.packable = value.has("packable") ? value.getBoolean("packable") : true; this.buy = value.has("buy") ? value.getInt("buy") : 0; this.sell = value.has("sell") ? value.getInt("sell") : 0; }
public UsableItem(Integer id, JsonValue value) { super(id, value); forward = value.has("forward") ? ItemForward.valueOf(value.getString("forward")) : ItemForward.friend; range = value.has("range") ? ItemRange.valueOf(value.getString("range")) : ItemRange.one; occasion = value.has("occasion") ? ItemOccasion.valueOf(value.getString("occasion")) : ItemOccasion.all; animation = value.has("animation") ? value.getInt("animation") : 0; deadable = value.has("deadable") ? ItemDeadable.valueOf(value.getString("deadable")) : ItemDeadable.no; delay = value.has("delay") ? value.getInt("delay") : 0; }
public Equipment(Integer id, JsonValue value) { super(id, value); //装备是不可以叠加的 packable = false; if(value.has("onlyFor")) onlyFor = value.get("onlyFor").asIntArray(); description2 = value.has("description2") ? value.getString("description2") : ""; equipType = Parts.valueOf(value.getString("equipType")); animation = value.has("animation") ? value.getInt("animation") : 0; }
private void parseBasics(Meta meta, JsonValue jsonRoot) { meta.setVersion(jsonRoot.getInt(Meta.JSON_VERSION)); meta.setLastModified(jsonRoot.getLong(Meta.JSON_LAST_MOD)); meta.setUuid(jsonRoot.getString(Meta.JSON_UUID)); meta.setType(AssetType.valueOf(jsonRoot.getString(Meta.JSON_TYPE))); }
public Scene load(String name) { final JsonReader reader = new JsonReader(); final JsonValue json = reader.parse(root.child(name)); Scene scene = new Scene(); scene.setId(json.getInt(JsonScene.ID)); scene.setName(json.getString(JsonScene.NAME)); // game objects for(JsonValue go : json.get(JsonScene.GAME_OBJECTS)) { scene.sceneGraph.addGameObject(convertGameObject(scene.sceneGraph, go)); } return scene; }
private void parseTerrain(Meta meta, JsonValue jsonTerrain) { if(jsonTerrain == null) return; final MetaTerrain terrain = new MetaTerrain(); terrain.setSize(jsonTerrain.getInt(MetaTerrain.JSON_SIZE)); terrain.setSplatmap(jsonTerrain.getString(MetaTerrain.JSON_SPLATMAP, null)); terrain.setSplatBase(jsonTerrain.getString(MetaTerrain.JSON_SPLAT_BASE, null)); terrain.setSplatR(jsonTerrain.getString(MetaTerrain.JSON_SPLAT_R, null)); terrain.setSplatG(jsonTerrain.getString(MetaTerrain.JSON_SPLAT_G, null)); terrain.setSplatB(jsonTerrain.getString(MetaTerrain.JSON_SPLAT_B, null)); terrain.setSplatA(jsonTerrain.getString(MetaTerrain.JSON_SPLAT_A, null)); meta.setTerrain(terrain); }