Example usage for com.badlogic.gdx Preferences putLong

List of usage examples for com.badlogic.gdx Preferences putLong

Introduction

In this page you can find the example usage for com.badlogic.gdx Preferences putLong.

Prototype

public Preferences putLong(String key, long val);

Source Link

Usage

From source file:com.maplescot.loggerbill.misc.Profile.java

License:Creative Commons License

public void save(Preferences prefs) {
    ckSum = makeCkSum();//  w w  w.j a  v  a2s .c  o m
    ckSumV = ckVersion;
    prefs.putBoolean(soundOnStr, soundOn);
    prefs.putBoolean(musicOnStr, musicOn);
    prefs.putLong(totalPlaysStr, totalPlays);
    prefs.putLong(totalChunksStr, totalChunks);
    prefs.putLong(totalTimeStr, totalTime);
    prefs.putLong(bestChunksStr, bestChunks);
    prefs.putFloat(bestCPSStr, bestCPS);
    prefs.putString(gplusStr, gplusId);
    prefs.putString(CKSUM, ckSum);
    prefs.putLong(CKSUMV, ckSumV);

    prefs.putString(achievementsStr, saveAchievements());
}

From source file:com.theosirian.ppioo.util.GameData.java

License:Open Source License

public GameData save() {
    Preferences state = Gdx.app.getPreferences(saveName);
    for (Player player : players) {
        if (player.isOwned()) {
            String key = "player-" + player.getId();
            state.putBoolean(key, true);
            state.putLong(key + "-date_acquired", player.getDateAcquired().getTime());
            state.putInteger(key + "-victories", player.getVictories());
            state.putInteger(key + "-defeats", player.getDefeats());
        }//from w w  w  . j a va 2  s  .  co  m
    }
    for (Fan fan : fans) {
        if (fan.isOwned()) {
            String key = "fan-" + fan.getId();
            state.putBoolean(key, true);
            state.putLong(key + "-date_acquired", fan.getDateAcquired().getTime());
            state.putInteger(key + "-victories", fan.getVictories());
            state.putInteger(key + "-defeats", fan.getDefeats());
        }
    }
    state.putInteger("money", money);
    state.putInteger("victories", victories);
    state.putInteger("defeats", defeats);
    state.flush();
    return this;
}