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


Java Preferences.putString方法代碼示例

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


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

示例1: moveAutosaveKeyToFirstPlace

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void moveAutosaveKeyToFirstPlace() {
    if (!containsKey(AUTOSAVE_KEY, SAVE_SLOT_PREFS)) return;

    ArrayList<String> keys = getKeys(SAVE_SLOT_PREFS);
    keys.remove(AUTOSAVE_KEY);
    keys.add(0, AUTOSAVE_KEY);

    StringBuilder newKeys = new StringBuilder();
    for (String key : keys) {
        newKeys.append(key).append(" ");
    }

    Preferences preferences = getPreferences(SAVE_SLOT_PREFS);
    preferences.putString("keys", newKeys.toString());
    preferences.flush();
}
 
開發者ID:yiotro,項目名稱:Antiyoy,代碼行數:17,代碼來源:SaveSystem.java

示例2: storeConfiguration

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static void storeConfiguration() {
    Preferences prefs = Gdx.app.getPreferences("ss_train_config");
    prefs.putInteger("offset", offset);
    prefs.putInteger("input_offset", inputOffset);
    prefs.putInteger("song_vol", songVolume);
    prefs.putInteger("feedback_vol", feedbackVolume);
    prefs.putString("path_to_beatmaps", pathToBeatmaps);
    prefs.putBoolean("play_hint_sounds", playHintSounds);
    prefs.putInteger("note_speed", noteSpeed);
    prefs.putInteger("overall_difficulty", overallDifficulty);
    prefs.putBoolean("display_line", displayLine);
    prefs.putInteger("sorting_mode", sortMode);
    prefs.putInteger("sorting_order", sortOrder);
    prefs.putInteger("sync_mode", syncMode);
    prefs.flush();
}
 
開發者ID:kbz,項目名稱:SSTrain,代碼行數:17,代碼來源:GlobalConfiguration.java

示例3: storeConfiguration

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static void storeConfiguration() {
    Preferences prefs = Gdx.app.getPreferences("sif_train_config");
    prefs.putInteger("offset", offset);
    prefs.putInteger("input_offset", inputOffset);
    prefs.putInteger("song_vol", songVolume);
    prefs.putInteger("feedback_vol", feedbackVolume);
    prefs.putString("path_to_beatmaps", pathToBeatmaps);
    prefs.putBoolean("play_hint_sounds", playHintSounds);
    prefs.putInteger("note_speed", noteSpeed);
    prefs.putInteger("overall_difficulty", overallDifficulty);
    prefs.putInteger("sorting_mode", sortMode);
    prefs.putInteger("random_mode", randomMode);
    prefs.putInteger("sorting_order", sortOrder);
    prefs.putInteger("sync_mode", syncMode);
    prefs.flush();
}
 
開發者ID:kbz,項目名稱:SIFTrain,代碼行數:17,代碼來源:GlobalConfiguration.java

示例4: setUserName

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static void setUserName(String name) {
    Preferences prefs = Gdx.app.getPreferences(PREFERENCES_NAME);

    // make sure the name is correct
    if (name.length() < MIN_NAME_LENGTH) {
        name = name + "---";
    } else if (name.length() > MAX_NAME_LENGTH){
        name += name.substring(0, MAX_NAME_LENGTH - 1);
    }

    prefs.putString(PREFERENCES_USER_NAME, name.trim());
    prefs.flush();
}
 
開發者ID:tgobbens,項目名稱:fluffybalance,代碼行數:14,代碼來源:HighScoreController.java

示例5: saveProgress

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
private void saveProgress() {
    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < progress.length; i++) {
        if (!progress[i]) continue;
        builder.append(i).append(" ");
    }
    Preferences preferences = Gdx.app.getPreferences(PROGRESS_PREFS);
    preferences.putString("completed_levels", builder.toString());
    preferences.flush();
}
 
開發者ID:yiotro,項目名稱:Antiyoy,代碼行數:11,代碼來源:CampaignProgressManager.java

示例6: save

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void save() {
    Preferences preferences = Gdx.app.getPreferences(key);

    preferences.putBoolean("campaign", campaignMode);
    preferences.putInteger("players", numberOfHumans);
    preferences.putString("date", date);
    preferences.putInteger("level_index", levelIndex);

    replay.setTempSlayRules(GameRules.slayRules);
    replay.setTempColorOffset(gameController.colorIndexViewOffset);
    preferences.flush();

    replay.saveToPreferences(key);
}
 
開發者ID:yiotro,項目名稱:Antiyoy,代碼行數:15,代碼來源:RepSlot.java

示例7: saveToPreferences

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void saveToPreferences(String prefsKey) {
    Preferences preferences = Gdx.app.getPreferences(prefsKey);
    preferences.putString("initial", initialLevelString);

    preferences.putBoolean("slay_rules", tempSlayRules);
    preferences.putInteger("color_offset", tempColorOffset);
    preferences.putInteger("real_human_number", realNumberOfHumans);

    preferences.putString("actions", convertActionsToString());

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

示例8: saveSlot

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void saveSlot() {
    String fullLevel = getFullLevelString();
    Preferences prefs = Gdx.app.getPreferences(EDITOR_PREFS);
    prefs.putString(SLOT_NAME + currentSlotNumber, fullLevel);
    prefs.putInteger("chosen_color" + currentSlotNumber, GameRules.editorChosenColor);
    prefs.flush();
}
 
開發者ID:yiotro,項目名稱:Antiyoy,代碼行數:8,代碼來源:LevelEditor.java

示例9: setAndSaveLanguage

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static void setAndSaveLanguage(String langName) {
    Preferences preferences = Gdx.app.getPreferences(prefs);

    preferences.putBoolean("auto", false);
    preferences.putString("lang_name", langName);

    preferences.flush();

    Fonts.initFonts(); // calls loadLanguage()
    CityNameGenerator.getInstance().load();
}
 
開發者ID:yiotro,項目名稱:Antiyoy,代碼行數:12,代碼來源:CustomLanguageLoader.java

示例10: addKey

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void addKey(String newKey, String prefs) {
    if (containsKey(newKey, prefs)) return;

    Preferences preferences = getPreferences(prefs);
    String keys = getKeysString(preferences);
    preferences.putString("keys", newKey + " " + keys);
    preferences.flush();
}
 
開發者ID:yiotro,項目名稱:Antiyoy,代碼行數:9,代碼來源:SaveSystem.java

示例11: deleteSlot

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void deleteSlot(SaveSlotInfo saveSlotInfo, String prefs) {
    // currently this method is not used
    // but may be used in future

    Preferences preferences = getPreferences(prefs);

    StringBuilder newKeys = new StringBuilder();
    for (String key : getKeys(prefs)) {
        if (key.equals(saveSlotInfo.key)) continue;
        newKeys.append(key).append(" ");
    }

    preferences.putString("keys", newKeys.toString());
    preferences.flush();
}
 
開發者ID:yiotro,項目名稱:Antiyoy,代碼行數:16,代碼來源:SaveSystem.java

示例12: saveData

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static void saveData() {
	Preferences prefScores = Gdx.app.getPreferences("Pref_Score");
	prefScores.putString("name", PLAYR_NAME);
	prefScores.putInteger("level", LEVEL);
	prefScores.putInteger("score", SCORE);
	if (SCORE > BEST_SCORE) {
		prefScores.putInteger("bestscore", SCORE);
		prefScores.putString("bestplayer", PLAYR_NAME);
	}
	prefScores.flush();
}
 
開發者ID:wasimbeniwale,項目名稱:ArxxusGame,代碼行數:12,代碼來源:Data.java

示例13: save

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

		GameState state = new GameState();
		state.mapMetadata.set(mapMetadataManager.getMetadata());

		new ScreenshotHelper().saveMapTexture(state, getRawLayer());

		for (Entity entity : getActives()) {
			if (entity != null) {
				Pos pos = mPos.get(entity);
				Element element = new Element(mPersistable.get(entity).saveId,
						(int) pos.x, (int) pos.y);

				if ( mTeamMember.has(entity))
				{
					element.team=mTeamMember.get(entity).team;
				}

				state.elements.add(element);
			}
		}



		Json json = new Json();
		String jsonString = json.toJson(state);

		Preferences prefs = getPrefs();
		prefs.putString("state", jsonString);
		prefs.flush();
	}
 
開發者ID:DaanVanYperen,項目名稱:ns2-scc-profiler,代碼行數:32,代碼來源:PersistHandlerSystem.java

示例14: saveLocaleInPreferences

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
/** Saves current locale in the selected preferences.
 *
 * @param preferencesPath used to retrieve preferences with
 *            {@link com.github.czyzby.kiwi.util.gdx.preference.ApplicationPreferences#getPreferences(String)}
 *            method.
 * @param preferenceName name of the locale setting in the preferences. */
public void saveLocaleInPreferences(final String preferencesPath, final String preferenceName) {
    if (Strings.isEmpty(preferencesPath) || Strings.isEmpty(preferenceName)) {
        throw new GdxRuntimeException(
                "Preference path and name cannot be empty! These are set automatically if you annotate a path to preference with @I18nBundle and pass a corrent path to the preferences.");
    }
    final Preferences preferences = ApplicationPreferences.getPreferences(preferencesPath);
    preferences.putString(preferenceName, fromLocale(currentLocale.get()));
    preferences.flush();
}
 
開發者ID:gdx-libs,項目名稱:gdx-autumn-mvc,代碼行數:16,代碼來源:LocaleService.java

示例15: setProjectPath

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static void setProjectPath(String path){
    Preferences preferences = Gdx.app.getPreferences("white-projectPath");
    preferences.putString("project",path);
    preferences.flush();
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:6,代碼來源:Config.java


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