Java Code Examples for com.badlogic.gdx.utils.JsonValue#isNumber()

The following examples show how to use com.badlogic.gdx.utils.JsonValue#isNumber() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsonSkinSerializer.java    From beatoraja with GNU General Public License v3.0 5 votes vote down vote up
protected boolean testOption(JsonValue ops) {
	if (ops == null) {
		return true;
	} else if (ops.isNumber()) {
		return testNumber(ops.asInt());
	} else if (ops.isArray()) {
		boolean enabled = true;
		for (int j = 0; j < ops.size; j++) {
			JsonValue ops2 = ops.get(j);
			if (ops2.isNumber()) {
				enabled = testNumber(ops2.asInt());
			} else if (ops2.isArray()) {
				boolean enabled_sub = false;
				for (int k = 0; k < ops2.size; k++) {
					JsonValue ops3 = ops2.get(k);
					if (ops3.isNumber() && testNumber(ops3.asInt())) {
						enabled_sub = true;
						break;
					}
				}
				enabled = enabled_sub;
			} else {
				enabled = false;
			}
			if (!enabled)
				break;
		}
		return enabled;
	} else {
		return false;
	}
}
 
Example 2
Source File: JsonSkinSerializer.java    From beatoraja with GNU General Public License v3.0 5 votes vote down vote up
public T read(Json json, JsonValue jsonValue, Class cls) {
	if (jsonValue.isString() && luaPropertyLoader != null) {
		return luaPropertyLoader.apply(lua, jsonValue.asString());
	} else if (jsonValue.isNumber() && idPropertyLoader != null) {
		return idPropertyLoader.apply(jsonValue.asInt());
	} else {
		return null;
	}
}