Skip to content

Commit

Permalink
fixed leaderboard issue (pushing of scores)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieKalloe committed Aug 15, 2016
1 parent 55321f7 commit 83c415a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "net.kalloe.jumpy"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
versionCode 2
versionName "1.1"
}

sourceSets {
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/net/kalloe/jumpy/scene/GameScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,14 @@ protected void onManagedUpdate(float pSecondsElapsed) {
endGameText.setVisible(true);

//Saves the score of the player, if a new high score is achieved.
if((player.getScore() + player.getBonusPoints()) > activity.getHighScore()) {
if ((player.getScore() + player.getBonusPoints()) > activity.getHighScore()) {
activity.setHighScore((player.getScore() + player.getBonusPoints()));
res.activity.playSound(res.soundHighscore);
player.setScore(0);
player.setBonusPoints(0);
}

//updates the Google Play Games Leaderboard and Achievements (in a different thread).
this.updateGooglePlayGames(ResourceManager.getInstance(), player);
this.updateGooglePlayGames(ResourceManager.getInstance(), (player.getScore() + player.getBonusPoints()));


if(this.updated != 0) {
this.updateOnDeath = false;
Expand Down Expand Up @@ -663,7 +662,7 @@ public void run() {
});
}

public void updateGooglePlayGames(final ResourceManager manager, final Player player) {
public void updateGooglePlayGames(final ResourceManager manager, final int score) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Expand All @@ -672,7 +671,8 @@ public void run() {
Achievements.track(manager, player);
Games.Leaderboards.submitScore(activity.getGoogleApiClient(),
activity.getString(R.string.leaderboard_highscores),
(player.getScore() + player.getBonusPoints()));
(score));
Debug.i("leaderboard", String.valueOf(score));
showToast("Updated leaderboard", 100);
}
}
Expand Down

0 comments on commit 83c415a

Please sign in to comment.