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:
@@ -151,6 +151,7 @@ public class GameRanking extends BasicGameState {
|
||||
MusicController.pause();
|
||||
MusicController.playAt(MusicController.getOsuFile().previewTime, true);
|
||||
SoundController.playSound(SoundEffect.MENUBACK);
|
||||
((SongMenu) game.getState(Opsu.STATE_SONGMENU)).resetGameDataOnLoad();
|
||||
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
|
||||
break;
|
||||
case Input.KEY_F12:
|
||||
@@ -174,13 +175,13 @@ public class GameRanking extends BasicGameState {
|
||||
} else if (exitButton.contains(x, y)) {
|
||||
SoundController.playSound(SoundEffect.MENUBACK);
|
||||
((MainMenu) game.getState(Opsu.STATE_MAINMENU)).reset();
|
||||
((Game) game.getState(Opsu.STATE_GAME)).resetGameData();
|
||||
((SongMenu) game.getState(Opsu.STATE_SONGMENU)).resetGameDataOnLoad();
|
||||
game.enterState(Opsu.STATE_MAINMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
|
||||
} else if (Utils.getBackButton().contains(x, y)) {
|
||||
MusicController.pause();
|
||||
MusicController.playAt(MusicController.getOsuFile().previewTime, true);
|
||||
SoundController.playSound(SoundEffect.MENUBACK);
|
||||
((Game) game.getState(Opsu.STATE_GAME)).resetGameData();
|
||||
((SongMenu) game.getState(Opsu.STATE_SONGMENU)).resetGameDataOnLoad();
|
||||
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user