当前位置: 首页>>代码示例>>Java>>正文


Java Preferences.contains方法代码示例

本文整理汇总了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);
}
 
开发者ID:wasimbeniwale,项目名称:ArxxusGame,代码行数:19,代码来源:Data.java

示例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();
    }
}
 
开发者ID:gradualgames,项目名称:ggvm,代码行数:28,代码来源:KeyboardInputProcessor.java

示例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();
	}
}
 
开发者ID:luarca84,项目名称:Caramelos,代码行数:10,代码来源:CaramelosGame.java

示例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 "";
}
 
开发者ID:cdetamble,项目名称:jewelthief,代码行数:15,代码来源:Utils.java

示例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();
	}
 
开发者ID:nkarasch,项目名称:ChessGDX,代码行数:28,代码来源:SoundManager.java

示例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");
	}
}
 
开发者ID:wasimbeniwale,项目名称:ArxxusGame,代码行数:10,代码来源:Data.java

示例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());
    }
}
 
开发者ID:gdx-libs,项目名称:gdx-autumn-mvc,代码行数:15,代码来源:PreferencesService.java

示例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();
   }
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:54,代码来源:GameManager.java

示例9: isPresentIn

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
@Override
public boolean isPresentIn(final Preferences preferences) {
    return preferences.contains(getName());
}
 
开发者ID:gdx-libs,项目名称:gdx-kiwi,代码行数:5,代码来源:PreferenceWrapper.java

示例10: Save

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
public Save(Preferences save) {
    this.save = save;
    if (!save.contains("name")) init();
    load();
}
 
开发者ID:naomiHauret,项目名称:OdysseeDesMaths,代码行数:6,代码来源:Save.java


注:本文中的com.badlogic.gdx.Preferences.contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。