Beispiel #1
0
 public LevelScore getScores(final Difficulty dclty, final int levelNo) {
   if (levelNo - 1 < scores[dclty.ordinal()].size()) {
     return scores[dclty.ordinal()].get(levelNo - 1);
   } else {
     return new LevelScore();
   }
 }
Beispiel #2
0
 @SuppressWarnings("unchecked")
 public UserScore() {
   maxPlayedLevel = new int[Difficulty.length()];
   scores = new ArrayList[Difficulty.length()];
   for (int i = 0; i < maxPlayedLevel.length; i++) {
     maxPlayedLevel[i] = 1;
     scores[i] = new ArrayList<LevelScore>();
     scores[i].add(new LevelScore(1, 0, 0, 0, Medals.None));
   }
 }
Beispiel #3
0
 public void updateScores(final Difficulty dclty, final LevelScore score) {
   final LevelScore existingScore = scores[dclty.ordinal()].get(score.getLevelNo() - 1);
   if (score.getMedalWon().ordinal() >= existingScore.getMedalWon().ordinal()) {
     scores[dclty.ordinal()].set(score.getLevelNo() - 1, score);
   }
 }
Beispiel #4
0
 public void addScores(final Difficulty dclty, final LevelScore score) {
   scores[dclty.ordinal()].add(score);
 }
Beispiel #5
0
 public void setMaxPlayedLevel(final Difficulty dclty, final int maxPlayedLevel) {
   this.maxPlayedLevel[dclty.ordinal()] = maxPlayedLevel;
 }
Beispiel #6
0
 public int getMaxPlayedLevel(final Difficulty dclty) {
   return maxPlayedLevel[dclty.ordinal()];
 }