本文整理汇总了Java中com.badlogic.gdx.files.FileHandle.nameWithoutExtension方法的典型用法代码示例。如果您正苦于以下问题:Java FileHandle.nameWithoutExtension方法的具体用法?Java FileHandle.nameWithoutExtension怎么用?Java FileHandle.nameWithoutExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.files.FileHandle
的用法示例。
在下文中一共展示了FileHandle.nameWithoutExtension方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import com.badlogic.gdx.files.FileHandle; //导入方法依赖的package包/类
private Theme update(final FileHandle handle) {
if (skin == null) {
throw new NullPointerException("A Theme.skin must be set before updating any Theme instance");
}
final JsonValue json = new JsonReader().parse(handle.readString());
name = handle.nameWithoutExtension();
displayName = json.getString("name");
price = json.getInt("price");
JsonValue colors = json.get("colors");
// Java won't allow unsigned integers, we need to use Long
background = new Color((int)Long.parseLong(colors.getString("background"), 16));
foreground = new Color((int)Long.parseLong(colors.getString("foreground"), 16));
JsonValue buttonColors = colors.get("buttons");
Color[] buttons = new Color[buttonColors.size];
for (int i = 0; i < buttons.length; ++i) {
buttons[i] = new Color((int)Long.parseLong(buttonColors.getString(i), 16));
if (buttonStyles[i] == null) {
buttonStyles[i] = new ImageButton.ImageButtonStyle();
}
// Update the style. Since every button uses an instance from this
// array, the changes will appear on screen automatically.
buttonStyles[i].up = skin.newDrawable("button_up", buttons[i]);
buttonStyles[i].down = skin.newDrawable("button_down", buttons[i]);
}
currentScore = new Color((int)Long.parseLong(colors.getString("current_score"), 16));
highScore = new Color((int)Long.parseLong(colors.getString("high_score"), 16));
bonus = new Color((int)Long.parseLong(colors.getString("bonus"), 16));
bandColor = new Color((int)Long.parseLong(colors.getString("band"), 16));
textColor = new Color((int)Long.parseLong(colors.getString("text"), 16));
emptyCell = new Color((int)Long.parseLong(colors.getString("empty_cell"), 16));
JsonValue cellColors = colors.get("cells");
cells = new Color[cellColors.size];
for (int i = 0; i < cells.length; ++i) {
cells[i] = new Color((int)Long.parseLong(cellColors.getString(i), 16));
}
String cellTextureFile = json.getString("cell_texture");
cellTexture = SkinLoader.loadPng("cells/"+cellTextureFile);
return this;
}