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