本文整理匯總了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;
}