diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java index 1bacf5c20..ae605947c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java @@ -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); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java index 487fe1b52..27c076c12 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java @@ -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 diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java index de879ab95..728238cae 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java @@ -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; }