v0.6.3b: fixed rankings not retaining challenges

This commit is contained in:
Evan Debenham 2018-02-28 23:14:59 -05:00
parent 65c90e222a
commit 49b6296e3b
2 changed files with 10 additions and 5 deletions

View File

@ -110,6 +110,7 @@ public enum Rankings {
public static final String STATS = "stats"; public static final String STATS = "stats";
public static final String BADGES = "badges"; public static final String BADGES = "badges";
public static final String HANDLERS = "handlers"; public static final String HANDLERS = "handlers";
public static final String CHALLENGES = "challenges";
public void saveGameData(Record rec){ public void saveGameData(Record rec){
rec.gameData = new Bundle(); rec.gameData = new Bundle();
@ -152,6 +153,9 @@ public enum Rankings {
//restore items now that we're done saving //restore items now that we're done saving
belongings.backpack.items = allItems; belongings.backpack.items = allItems;
//save challenges
rec.gameData.put( CHALLENGES, Dungeon.challenges );
} }
public void loadGameData(Record rec){ public void loadGameData(Record rec){
@ -175,7 +179,7 @@ public enum Rankings {
Statistics.restoreFromBundle(data.getBundle(STATS)); Statistics.restoreFromBundle(data.getBundle(STATS));
Dungeon.challenges = 0; Dungeon.challenges = data.getInt(CHALLENGES);
} }

View File

@ -158,16 +158,17 @@ public class WndRanking extends WndTabbed {
float pos = title.bottom(); float pos = title.bottom();
if (Dungeon.challenges > 0) { if (Dungeon.challenges > 0) {
RedButton btnCatalogus = new RedButton( Messages.get(this, "challenges") ) { RedButton btnChallenges = new RedButton( Messages.get(this, "challenges") ) {
@Override @Override
protected void onClick() { protected void onClick() {
Game.scene().add( new WndChallenges( Dungeon.challenges, false ) ); Game.scene().add( new WndChallenges( Dungeon.challenges, false ) );
} }
}; };
btnCatalogus.setRect( 0, pos, btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2 ); float btnW = btnChallenges.reqWidth() + 2;
add( btnCatalogus ); btnChallenges.setRect( (WIDTH - btnW)/2, pos, btnW , btnChallenges.reqHeight() + 2 );
add( btnChallenges );
pos = btnCatalogus.bottom(); pos = btnChallenges.bottom();
} }
pos += GAP + GAP; pos += GAP + GAP;