Follow-up to 516e628: Fix resetting game data too soon.

Instead of resetting immediately, set a variable in SongMenu to reset data when entering the state.  Fixes some weird behaviors, and also allows resetting in more scenarios.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-01-16 00:36:05 -05:00
parent 553f091693
commit 90c10d21da
4 changed files with 22 additions and 6 deletions

View File

@@ -138,7 +138,7 @@ public class GamePauseMenu extends BasicGameState {
MusicController.stop();
MusicController.playAt(MusicController.getOsuFile().previewTime, true);
SoundController.playSound(SoundEffect.MENUBACK);
gameState.resetGameData();
((SongMenu) game.getState(Opsu.STATE_SONGMENU)).resetGameDataOnLoad();
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
} else {
SoundController.playSound(SoundEffect.MENUBACK);
@@ -182,7 +182,7 @@ public class GamePauseMenu extends BasicGameState {
MusicController.pause(); // lose state
MusicController.playAt(MusicController.getOsuFile().previewTime, true);
SoundController.playSound(SoundEffect.MENUBACK);
gameState.resetGameData();
((SongMenu) game.getState(Opsu.STATE_SONGMENU)).resetGameDataOnLoad();
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
}
}