v1.3.2: rankings now shows the daily window if you just ended a daily

This commit is contained in:
Evan Debenham
2022-07-21 16:56:46 -04:00
parent 03848f1fa3
commit 987350c11e
3 changed files with 27 additions and 1 deletions

View File

@@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.scenes;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Rankings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
@@ -161,9 +162,20 @@ public class RankingsScene extends PixelScene {
add(btnDailies);
}
if (Dungeon.daily){
addToFront(new WndDailies());
}
fadeIn();
}
@Override
public void destroy() {
super.destroy();
//so that opening daily records does not trigger WndDailies opening on future visits
Dungeon.daily = false;
}
@Override
protected void onBackPressed() {
ShatteredPixelDungeon.switchNoFade(TitleScene.class);

View File

@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
@@ -145,6 +146,7 @@ public class TitleScene extends PixelScene {
};
btnRankings.icon(Icons.get(Icons.RANKINGS));
add(btnRankings);
Dungeon.daily = false;
StyledButton btnBadges = new StyledButton(GREY_TR, Messages.get(this, "badges")){
@Override

View File

@@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
import com.shatteredpixel.shatteredpixeldungeon.Rankings;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
@@ -218,6 +219,16 @@ public class WelcomeScene extends PixelScene {
ShatteredPixelDungeon.reportException(e);
}
}
if (Rankings.INSTANCE.latestDaily != null){
try {
Rankings.INSTANCE.loadGameData(Rankings.INSTANCE.latestDaily);
Rankings.INSTANCE.saveGameData(Rankings.INSTANCE.latestDaily);
} catch (Exception e) {
//if we encounter a fatal per-record error, then clear that record
Rankings.INSTANCE.latestDaily = null;
ShatteredPixelDungeon.reportException(e);
}
}
Collections.sort(Rankings.INSTANCE.records, Rankings.scoreComparator);
Rankings.INSTANCE.save();
} catch (Exception e) {
@@ -225,6 +236,7 @@ public class WelcomeScene extends PixelScene {
FileUtils.deleteFile( Rankings.RANKINGS_FILE );
ShatteredPixelDungeon.reportException(e);
}
Dungeon.daily = false;
}