本文整理汇总了Java中com.badlogic.gdx.Preferences.contains方法的典型用法代码示例。如果您正苦于以下问题:Java Preferences.contains方法的具体用法?Java Preferences.contains怎么用?Java Preferences.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.Preferences
的用法示例。
在下文中一共展示了Preferences.contains方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: loadConfiguration
import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
public void loadConfiguration() {
clear();
Preferences buttonIndexToKeyCodePreferences = Gdx.app.getPreferences(BUTTON_INDEX_TO_KEY_CODE_PREFERENCES);
Preferences buttonIndexToButtonPreferences = Gdx.app.getPreferences(BUTTON_INDEX_TO_BUTTON_PREFERENCES);
for(com.gradualgames.ggvm.Controller.Buttons button: com.gradualgames.ggvm.Controller.Buttons.values()) {
if (buttonIndexToKeyCodePreferences.contains(button.name())) {
buttonIndexToKeyCode.put(button, buttonIndexToKeyCodePreferences.getInteger(button.name()));
}
if (buttonIndexToButtonPreferences.contains(button.name())) {
buttonIndexToButton.put(button, buttonIndexToButtonPreferences.getInteger(button.name()));
}
}
Preferences actualAxisToAxisCodePreferences = Gdx.app.getPreferences(ACTUAL_AXIS_TO_AXIS_CODE_PREFERENCES);
for(Axis axis: Axis.values()) {
if (actualAxisToAxisCodePreferences.contains(axis.name())) {
actualAxisToAxisCode.put(axis, actualAxisToAxisCodePreferences.getInteger(axis.name()));
}
}
//If all mappings are empty after attempting to load config, attempt auto config
if (buttonIndexToKeyCode.isEmpty() &&
buttonIndexToButton.isEmpty() &&
actualAxisToAxisCode.isEmpty()) {
autoConfigure();
}
}
示例3: InitPreferences
import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
public void InitPreferences()
{
Preferences prefs = Gdx.app.getPreferences("MyPreferences");
if(!prefs.contains("sound"))
{
prefs.putBoolean("sound",true);
prefs.flush();
}
}
示例4: getBestScoreString
import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
/**
* Returns a human readable string presenting the locally saved best score.
* @return
*/
public static String getBestScoreString() {
Preferences prefs = JewelThief.getInstance().getPreferences();
if (prefs.contains(PrefsKeys.BEST_SCORE_NUM_JEWELS) && prefs.contains(PrefsKeys.BEST_SCORE_NUM_SECONDS))
return JewelThief.getInstance().getBundle().format(I18NKeys.YOUR_BEST_SCORE_IS,
prefs.getInteger(PrefsKeys.BEST_SCORE),
prefs.getInteger(PrefsKeys.BEST_SCORE_NUM_JEWELS),
Utils.secondsToTimeString(prefs.getInteger(PrefsKeys.BEST_SCORE_NUM_SECONDS)));
else
return "";
}
示例5: SoundManager
import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
private SoundManager() {
Preferences pref = Gdx.app.getPreferences(GameCore.TITLE);
mEffectsVolume = 1.0f;
mAmbience = AssetHandler.getInstance().getMusic("sound/nature.mp3");
mClicked = AssetHandler.getInstance().getSound("sound/click.wav");
mReleased = AssetHandler.getInstance().getSound("sound/release.wav");
mMove = AssetHandler.getInstance().getSound("sound/move.wav");
if (pref.contains(PreferenceStrings.MUSIC_VOLUME)) {
mAmbience.setVolume(pref.getFloat(PreferenceStrings.MUSIC_VOLUME) / 100.0f);
} else {
pref.putFloat(PreferenceStrings.MUSIC_VOLUME, 1.0f);
}
if (pref.contains(PreferenceStrings.EFFECTS_VOLUME)) {
mEffectsVolume = pref.getFloat(PreferenceStrings.EFFECTS_VOLUME) / 100.0f;
} else {
pref.putFloat(PreferenceStrings.EFFECTS_VOLUME, 1.0f);
}
mAmbience.setLooping(true);
mAmbience.play();
pref.flush();
}
示例6: clearAllData
import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
public static void clearAllData() {
Preferences prefScores = Gdx.app.getPreferences("Pref_Score");
if (prefScores.contains("name")) {
prefScores.clear();
prefScores.flush();
System.out.println("All data is cleared");
}
}
示例7: initiatePreference
import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private static void initiatePreference(final String name, final Preference preference,
final Preferences preferences) {
if (preferences.contains(name)) {
try {
preference.read(name, preferences);
} catch (final Exception exception) {
Exceptions.ignore(exception);
preference.set(preference.getDefault());
}
} else {
preference.set(preference.getDefault());
}
}
示例8: create
import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
@Override
public void create () {
new Font();
gameManager = (GameManager)Gdx.app.getApplicationListener();
intro = new Intro(gameManager);
QueueBuildCraft.getInstance().setGameManager(gameManager);
new Thread(new Runnable() {
@Override
public void run() {
Gdx.app.postRunnable(new Runnable() {
@Override
public void run() {
mapsScreen = new MapsScreen(gameManager);
screenEnklave = new ScreenEnklave(gameManager);
screenProfile = new ScreenProfile(gameManager);
screenCrafting = new ScreenCrafting(gameManager);
screenDescribeEnklave = new ScreenDescribeEnklave(gameManager);
screenExtensions = new ScreenExtensions(gameManager);
screenRooms = new ScreenRooms(gameManager);
screenCombat = new ScreenCombat(gameManager);
screenSetting = new ScreenSetting(gameManager);
raiderMap = new ScreenRaider(gameManager);
}
});
}
}).start();
screenLoading = new ScreenLoading(this);
Preferences pref = Gdx.app.getPreferences("ScreenPresentation");
if(pref.contains("presentation")){
if(!pref.getBoolean("presentation")) {
setScreen(screenLoading);
pref.putBoolean("presentation", true);
pref.flush();
}else{
setScreen(screenLoading);
}
}else{
setScreen(screenLoading);
pref.putBoolean("presentation", true);
pref.flush();
}
new Thread(new Runnable() {
@Override
public void run() {
Gdx.app.postRunnable(new Runnable() {
@Override
public void run() {
new GetProfile().makeRequestProfile();
}
});
}
}).start();
}
示例9: isPresentIn
import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
@Override
public boolean isPresentIn(final Preferences preferences) {
return preferences.contains(getName());
}
示例10: Save
import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
public Save(Preferences save) {
this.save = save;
if (!save.contains("name")) init();
load();
}