當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。