diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java index a797a82f0..7d5545f25 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java @@ -110,6 +110,7 @@ public enum Rankings { public static final String STATS = "stats"; public static final String BADGES = "badges"; public static final String HANDLERS = "handlers"; + public static final String CHALLENGES = "challenges"; public void saveGameData(Record rec){ rec.gameData = new Bundle(); @@ -152,6 +153,9 @@ public enum Rankings { //restore items now that we're done saving belongings.backpack.items = allItems; + + //save challenges + rec.gameData.put( CHALLENGES, Dungeon.challenges ); } public void loadGameData(Record rec){ @@ -175,7 +179,7 @@ public enum Rankings { Statistics.restoreFromBundle(data.getBundle(STATS)); - Dungeon.challenges = 0; + Dungeon.challenges = data.getInt(CHALLENGES); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndRanking.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndRanking.java index 61bb4e483..2fa52e436 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndRanking.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndRanking.java @@ -158,16 +158,17 @@ public class WndRanking extends WndTabbed { float pos = title.bottom(); if (Dungeon.challenges > 0) { - RedButton btnCatalogus = new RedButton( Messages.get(this, "challenges") ) { + RedButton btnChallenges = new RedButton( Messages.get(this, "challenges") ) { @Override protected void onClick() { Game.scene().add( new WndChallenges( Dungeon.challenges, false ) ); } }; - btnCatalogus.setRect( 0, pos, btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2 ); - add( btnCatalogus ); + float btnW = btnChallenges.reqWidth() + 2; + btnChallenges.setRect( (WIDTH - btnW)/2, pos, btnW , btnChallenges.reqHeight() + 2 ); + add( btnChallenges ); - pos = btnCatalogus.bottom(); + pos = btnChallenges.bottom(); } pos += GAP + GAP;