本文整理汇总了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();
}