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


Java Preferences.getString方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.Preferences.getString方法的典型用法代碼示例。如果您正苦於以下問題:Java Preferences.getString方法的具體用法?Java Preferences.getString怎麽用?Java Preferences.getString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.Preferences的用法示例。


在下文中一共展示了Preferences.getString方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: makeRequestEnklave

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void makeRequestEnklave(){
    Preferences pref = Gdx.app.getPreferences("informationLog");
    String acces = pref.getString("accesstoken");
    HttpRequestBuilder builder = new HttpRequestBuilder();
    Net.HttpRequest request = builder.newRequest().method(Net.HttpMethods.GET).url(url + enkNearby).build();
    request.setHeader("Authorization", "Bearer " + acces);
    Gdx.net.sendHttpRequest(request, new Net.HttpResponseListener() {
        @Override
        public void handleHttpResponse(Net.HttpResponse httpResponse) {
            String response = httpResponse.getResultAsString();
            JSONArray jsonArray = new JSONArray(response);
            ListEnklaves.getInstance().setListEnklave(jsonArray);
            Gdx.app.log("response enklave : " + httpResponse.getStatus().getStatusCode(), " message " +response);
        }

        @Override
        public void failed(Throwable t) {
            Gdx.app.log("response : " + t.getMessage(), "fdg " + t.getLocalizedMessage());
        }

        @Override
        public void cancelled() {
            Gdx.app.log("response ","cancelled");
        }
    });
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:27,代碼來源:NearbyEnklave.java

示例2: loadProgress

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
private void loadProgress() {
    clearProgress();

    Preferences preferences = Gdx.app.getPreferences(PROGRESS_PREFS);
    String completedLevels = preferences.getString("completed_levels", "");

    StringTokenizer tokenizer = new StringTokenizer(completedLevels, " ");
    while (tokenizer.hasMoreTokens()) {
        String token = tokenizer.nextToken();
        int index = Integer.valueOf(token);
        if (index >= progress.length) break;
        progress[index] = true;
    }

    checkToImportOldProgress(preferences);
}
 
開發者ID:yiotro,項目名稱:Antiyoy,代碼行數:17,代碼來源:CampaignProgressManager.java

示例3: loadSlot

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void loadSlot() {
    Preferences prefs = Gdx.app.getPreferences(EDITOR_PREFS);
    String fullLevel = prefs.getString(SLOT_NAME + currentSlotNumber, "");

    LoadingParameters instance = LoadingParameters.getInstance();

    if (fullLevel.length() < 3) {
        instance.mode = LoadingParameters.MODE_EDITOR_NEW;
        instance.levelSize = FieldController.SIZE_BIG;
        instance.playersNumber = 1;
        instance.colorNumber = 5;
        instance.colorOffset = 0;
        instance.difficulty = 1;
    } else {
        instance.mode = LoadingParameters.MODE_EDITOR_LOAD;
        instance.applyFullLevel(fullLevel);
        instance.colorOffset = 0;
    }

    LoadingManager.getInstance().startGame(instance);
    GameRules.editorChosenColor = prefs.getInteger("chosen_color" + currentSlotNumber);

    defaultValues();
}
 
開發者ID:yiotro,項目名稱:Antiyoy,代碼行數:25,代碼來源:LevelEditor.java

示例4: tryToImportOldSave

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
private void tryToImportOldSave(String key) {
    Preferences preferences = getPreferences(key);
    String activeHexes = preferences.getString("save_active_hexes", "");
    if (activeHexes.length() < 3) return; // empty slot

    addKey(key, SAVE_SLOT_PREFS);

    SaveSlotInfo saveSlotInfo = new SaveSlotInfo();
    saveSlotInfo.name = getNameString(preferences);
    if (saveSlotInfo.name.length() < 3) {
        saveSlotInfo.name = "slot";
    }
    saveSlotInfo.description = getDescriptionString(preferences);
    if (saveSlotInfo.description.length() < 3) {
        saveSlotInfo.description = "old save";
    }
    saveSlotInfo.key = key;

    editSlot(key, saveSlotInfo, SAVE_SLOT_PREFS);
}
 
開發者ID:yiotro,項目名稱:Antiyoy,代碼行數:21,代碼來源:SaveSystem.java

示例5: loadTempFilePath

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
protected File loadTempFilePath() {
    try {
        Preferences preferences = Gdx.app.getPreferences(PREFERENCES_FILE);
        int revision = preferences.getInteger(prefKeyFileRevision, -1);
        // Check if the revisions are the same
        if (this.fileRevision != revision) return null;

        String absolutePath = preferences.getString(prefKeyFilePath, null);
        if (absolutePath != null) {
            return new File(absolutePath);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
開發者ID:crashinvaders,項目名稱:gdx-texture-packer-gui,代碼行數:17,代碼來源:KTXProcessor.java

示例6: loadConfiguration

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static void loadConfiguration() {
    Preferences prefs = Gdx.app.getPreferences("ss_train_config");
    offset = prefs.getInteger("offset", 0);
    inputOffset = prefs.getInteger("input_offset", 0);
    songVolume = prefs.getInteger("song_vol", 100);
    feedbackVolume = prefs.getInteger("feedback_vol", 100);
    pathToBeatmaps = prefs.getString("path_to_beatmaps", Gdx.files.getExternalStoragePath() + "sstrain");
    playHintSounds = prefs.getBoolean("play_hint_sounds", false);
    noteSpeed = prefs.getInteger("note_speed", 6);
    overallDifficulty = prefs.getInteger("overall_difficulty", 7);
    displayLine = prefs.getBoolean("display_line", true);
    // default to song name sorting
    sortMode = prefs.getInteger("sorting_mode", SongUtils.SORTING_MODE_SONG_NAME);
    // default ascending order
    sortOrder = prefs.getInteger("sorting_order", SongUtils.SORTING_MODE_ASCENDING);
    // sync mode
    syncMode = prefs.getInteger("sync_mode", SongUtils.SYNC_MODE_1);

}
 
開發者ID:kbz,項目名稱:SSTrain,代碼行數:20,代碼來源:GlobalConfiguration.java

示例7: loadConfiguration

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static void loadConfiguration() {
    Preferences prefs = Gdx.app.getPreferences("sif_train_config");
    offset = prefs.getInteger("offset", 0);
    inputOffset = prefs.getInteger("input_offset", 0);
    songVolume = prefs.getInteger("song_vol", 100);
    feedbackVolume = prefs.getInteger("feedback_vol", 100);
    pathToBeatmaps = prefs.getString("path_to_beatmaps", Gdx.files.getExternalStoragePath() + "beatmaps");
    playHintSounds = prefs.getBoolean("play_hint_sounds", false);
    noteSpeed = prefs.getInteger("note_speed", 6);
    overallDifficulty = prefs.getInteger("overall_difficulty", 7);
    // default to song name sorting
    sortMode = prefs.getInteger("sorting_mode", SongUtils.SORTING_MODE_SONG_NAME);
    sortOrder = prefs.getInteger("sorting_order", SongUtils.SORTING_MODE_ASCENDING);
    // default to the new mode
    randomMode = prefs.getInteger("random_mode", SongUtils.RANDOM_MODE_NEW);
    // sync mode
    syncMode = prefs.getInteger("sync_mode", SongUtils.SYNC_MODE_1);

}
 
開發者ID:kbz,項目名稱:SIFTrain,代碼行數:20,代碼來源:GlobalConfiguration.java

示例8: loadData

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static void loadData() {
	Preferences prefScores = Gdx.app.getPreferences("Pref_Score");
	if (prefScores.contains("name")) {
		PLAYR_NAME = prefScores.getString("name");
		LEVEL = prefScores.getInteger("level");
		SCORE = prefScores.getInteger("score");
		BEST_SCORE = prefScores.getInteger("bestscore");
		BEST_PLAYR_NAME = prefScores.getString("bestplayer");
	} else {
		// if first application launch
		PLAYR_NAME = "Player";
		LEVEL = 1;
		SCORE = 0;
		BEST_SCORE = SCORE;
		BEST_PLAYR_NAME = PLAYR_NAME;
	}
	System.out.println(BEST_SCORE);
}
 
開發者ID:wasimbeniwale,項目名稱:ArxxusGame,代碼行數:19,代碼來源:Data.java

示例9: parsePreference

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
/** @param rawLmlData unparsed LML data that might or might not start with preference key (which will be stripped).
 * @return parsed preference value. */
protected String parsePreference(final String rawLmlData) {
    String preferenceKey = LmlUtilities.stripMarker(rawLmlData, syntax.getPreferenceMarker());
    final Preferences preferences;
    if (Strings.contains(rawLmlData, syntax.getIdSeparatorMarker())) {
        // Preferences name is given, as preference key contains separator. Extracting specific preferences.
        final int separatorIndex = preferenceKey.indexOf(syntax.getIdSeparatorMarker());
        final String preferencesName = preferenceKey.substring(0, separatorIndex);
        preferences = data.getPreferences(preferencesName);
        preferenceKey = preferenceKey.substring(separatorIndex + 1, preferenceKey.length());
    } else {
        // No specific preferences name. Using default preferences.
        preferences = data.getDefaultPreferences();
    }
    if (preferences == null) {
        throwError("Preferences container not found for preference: " + rawLmlData);
    }
    return preferences.getString(preferenceKey, Nullables.DEFAULT_NULL_STRING);
}
 
開發者ID:czyzby,項目名稱:gdx-lml,代碼行數:21,代碼來源:AbstractLmlParser.java

示例10: getProjectPath

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static String getProjectPath(){
    Preferences preferences = Gdx.app.getPreferences("white-projectPath");
    String path = preferences.getString("project","");
    StringBuilder stringBuilder =  new StringBuilder();
    stringBuilder.append(path);
    if (!path.endsWith("/")){
        stringBuilder.append("/");
    }

    return stringBuilder.toString();
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:12,代碼來源:Config.java

示例11: sendMessage

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void sendMessage(String message){
    final Preferences pref = Gdx.app.getPreferences("informationLog");
    String acces = pref.getString("accesstoken");
    JSONObject json = new JSONObject();
    json.accumulate("txt",message);
    HttpRequestBuilder builder = new HttpRequestBuilder();
    Net.HttpRequest request = builder.newRequest().method(Net.HttpMethods.POST).url(url + join).build();
    request.setHeader("Authorization", "Bearer " + acces);
    request.setHeader("Content-type", "application/json");
    request.setContent(json.toString());
    Gdx.net.sendHttpRequest(request, new Net.HttpResponseListener() {
        @Override
        public void handleHttpResponse(Net.HttpResponse httpResponse) {
            //Gdx.app.log("response :"+httpResponse.getStatus().getStatusCode(),"message "+httpResponse.getResultAsString());
        }

        @Override
        public void failed(Throwable t) {
            //Gdx.app.log("response :","failed "+t);
        }

        @Override
        public void cancelled() {
            //Gdx.app.log("response :","cancel ");
        }
    });
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:28,代碼來源:SendFaction.java

示例12: sendMessage

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void sendMessage(String message){
        final Preferences pref = Gdx.app.getPreferences("informationLog");
        String acces = pref.getString("accesstoken");
        JSONObject json = new JSONObject();
        json.accumulate("txt",message);
        HttpRequestBuilder builder = new HttpRequestBuilder();
        Net.HttpRequest request = builder.newRequest().method(Net.HttpMethods.POST).url(url + join).build();
        request.setHeader("Authorization", "Bearer " + acces);
        request.setHeader("Content-type", "application/json");
        request.setContent(json.toString());
        Gdx.net.sendHttpRequest(request, new Net.HttpResponseListener() {
            @Override
            public void handleHttpResponse(Net.HttpResponse httpResponse) {
//                Gdx.app.log("response :"+httpResponse.getStatus().getStatusCode(),"message "+httpResponse.getResultAsString());
            }

            @Override
            public void failed(Throwable t) {
                //Gdx.app.log("response :","failed "+t);
            }

            @Override
            public void cancelled() {
                //Gdx.app.log("response :","cancel ");
            }
        });
    }
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:28,代碼來源:SendLocation.java

示例13: makeRequest

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void makeRequest(int id){
    final Preferences pref = Gdx.app.getPreferences("informationLog");
    String acces = pref.getString("accesstoken");
    JSONObject json = new JSONObject();
    json.accumulate("faction_id",id);
    HttpRequestBuilder builder = new HttpRequestBuilder();
    Net.HttpRequest request = builder.newRequest().method(Net.HttpMethods.POST).url(url + join).build();
    request.setHeader("Authorization", "Bearer " + acces);
    request.setHeader("Content-type", "application/json");
    request.setContent(json.toString());
    Gdx.net.sendHttpRequest(request, new Net.HttpResponseListener() {
        @Override
        public void handleHttpResponse(Net.HttpResponse httpResponse) {
            //Gdx.app.log("response :","message "+httpResponse.getResultAsString());
        }

        @Override
        public void failed(Throwable t) {
            //Gdx.app.log("response :","failed ");
        }

        @Override
        public void cancelled() {
            //Gdx.app.log("response :","cancel ");
        }
    });
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:28,代碼來源:JoinFaction.java

示例14: makeRequest

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void makeRequest(int id, final ScreenCombat screenCombat){
    final Preferences pref = Gdx.app.getPreferences("informationLog");
    final String acces = pref.getString("accesstoken");
    JSONObject parameters = new JSONObject();
    parameters.accumulate("enklave_combat_id",id);
    HttpRequestBuilder builder = new HttpRequestBuilder();
    Net.HttpRequest request = builder.newRequest().method(Net.HttpMethods.POST).url(url + prof).build();
    request.setHeader("Authorization", "Bearer " + acces);
    request.setHeader("Content-type", "application/json");
    request.setContent(parameters.toString());
    Gdx.net.sendHttpRequest(request, new Net.HttpResponseListener() {
        @Override
        public void handleHttpResponse(Net.HttpResponse httpResponse) {
            screenCombat.showCover();
            Gdx.app.log("raspuns hit Enklave cod :"+httpResponse.getStatus().getStatusCode()," message : "+httpResponse.getResultAsString());
        }

        @Override
        public void failed(Throwable t) {

        }

        @Override
        public void cancelled() {

        }
    });
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:29,代碼來源:HitEnklave.java

示例15: makeRequest

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void makeRequest(int id, final ScreenCombat screenCombat){
    final Preferences pref = Gdx.app.getPreferences("informationLog");
    final String acces = pref.getString("accesstoken");
    JSONObject jsonObject = new JSONObject();
    jsonObject.accumulate("enklave_id", id);
    HttpRequestBuilder builder = new HttpRequestBuilder();
    Net.HttpRequest request = builder.newRequest().method(Net.HttpMethods.POST).url(url + prof).build();
    request.setHeader("Authorization", "Bearer " + acces);
    request.setHeader("Content-type", "application/json");
    request.setContent(jsonObject.toString());
    Gdx.net.sendHttpRequest(request, new Net.HttpResponseListener() {
        @Override
        public void handleHttpResponse(Net.HttpResponse httpResponse) {
            String res = httpResponse.getResultAsString();
            Gdx.app.log("raspuns start code "+httpResponse.getStatus().getStatusCode(),"rasp mess: "+res);
            if(httpResponse.getStatus().getStatusCode()<300){
                JSONObject j = new JSONObject(res);
                informationProfile.getDateUserGame().setEnklaveCombatId(j.getInt("enklave_combatant_id"));
                InformationEnklave.getInstance().setCombatId(j.getInt("enklave_combat_id"));
                informationProfile.getDateUserGame().setInCombat(true);
            }else{
                JSONObject json = new JSONObject(res);
                if(json.getString("detail").contentEquals("You already joined this combat once"))
                    InformationProfile.getInstance().getDateUserGame().setEnklaveCombatId(-1);
                informationProfile.getDateUserGame().setInCombat(true);
                screenCombat.dialogExit(json.getString("detail").substring(0,20)+"\n"+json.getString("detail").substring(21));
            }
        }

        @Override
        public void failed(Throwable t) {
            Gdx.app.log("error parse data : ","err: "+t);
        }

        @Override
        public void cancelled() {

        }
    });
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:41,代碼來源:StartCombat.java


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