當前位置: 首頁>>代碼示例>>Java>>正文


Java FileHandle.nameWithoutExtension方法代碼示例

本文整理匯總了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;
}
 
開發者ID:LonamiWebs,項目名稱:Klooni1010,代碼行數:49,代碼來源:Theme.java


注:本文中的com.badlogic.gdx.files.FileHandle.nameWithoutExtension方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。