Android Open Source - FloppyThreeD Score Manager






From Project

Back to project page FloppyThreeD.

License

The source code is released under:

MIT License

If you think the Android project FloppyThreeD listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.jtechapps.FloppyThreeD;
/*from  w ww  .  j  a va 2 s .co m*/
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences;

public class ScoreManager {
  /**
   * Compares the players score and if the new score is higher then it will set the new high score.
   * @param score score to compare to high score.
   * @return true if score is a new highscore
   */
  public boolean compareScore(int score){
    if(score>getHighScore()){
      setHighScore(score);
      return true;
    }
    else {
      return false;
    }
  }
  
  public int getHighScore(){
    Preferences prefs = Gdx.app.getPreferences("FloppyThreeD");
    int highscore = prefs.getInteger("highscore", 0);
    return highscore;
  }
  
  public void setHighScore(int scoretoset){
    Preferences prefs = Gdx.app.getPreferences("FloppyThreeD");
    prefs.putInteger("highscore", scoretoset);
    prefs.flush();
  }
}




Java Source Code List

com.jtechapps.FloppyThreeD.FloppyGame.java
com.jtechapps.FloppyThreeD.IOSInterface.java
com.jtechapps.FloppyThreeD.IOSLauncher.java
com.jtechapps.FloppyThreeD.NativeInterface.java
com.jtechapps.FloppyThreeD.ScoreManager.java
com.jtechapps.FloppyThreeD.SettingsManager.java
com.jtechapps.FloppyThreeD.Screens.AboutScreen.java
com.jtechapps.FloppyThreeD.Screens.ClassicGameScreen.java
com.jtechapps.FloppyThreeD.Screens.FirstPersonScreen.java
com.jtechapps.FloppyThreeD.Screens.MainMenuScreen.java
com.jtechapps.FloppyThreeD.Screens.SettingsScreen.java
com.jtechapps.FloppyThreeD.android.AndroidInterface.java
com.jtechapps.FloppyThreeD.android.AndroidLauncher.java
com.jtechapps.FloppyThreeD.client.HtmlInterface.java
com.jtechapps.FloppyThreeD.client.HtmlLauncher.java
com.jtechapps.FloppyThreeD.desktop.DesktopAdapter.java
com.jtechapps.FloppyThreeD.desktop.DesktopInterface.java
com.jtechapps.FloppyThreeD.desktop.DesktopLauncher.java