Validate audio files before trying to load them. (part of #120)
Also fixed an issue where songMenu.resetGameDataOnLoad() sometimes wasn't being called when it should be (e.g. after playing a beatmap, if you move to a different screen, your score won't appear in the song menu right away). It's now being called more often than necessary, but that should be fine. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -243,11 +243,10 @@ public class GameRanking extends BasicGameState {
|
||||
*/
|
||||
private void returnToSongMenu() {
|
||||
SoundController.playSound(SoundEffect.MENUBACK);
|
||||
if (data.isGameplay()) {
|
||||
SongMenu songMenu = (SongMenu) game.getState(Opsu.STATE_SONGMENU);
|
||||
songMenu.resetGameDataOnLoad();
|
||||
SongMenu songMenu = (SongMenu) game.getState(Opsu.STATE_SONGMENU);
|
||||
if (data.isGameplay())
|
||||
songMenu.resetTrackOnLoad();
|
||||
}
|
||||
songMenu.resetGameDataOnLoad();
|
||||
if (UI.getCursor().isSkinned())
|
||||
UI.getCursor().reset();
|
||||
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
|
||||
|
||||
@@ -1318,8 +1318,12 @@ public class SongMenu extends BasicGameState {
|
||||
return;
|
||||
|
||||
SoundController.playSound(SoundEffect.MENUHIT);
|
||||
MultiClip.destroyExtraClips();
|
||||
Beatmap beatmap = MusicController.getBeatmap();
|
||||
if (focusNode == null || beatmap != focusNode.getBeatmapSet().get(focusNode.beatmapIndex)) {
|
||||
UI.sendBarNotification("Unable to load the beatmap audio.");
|
||||
return;
|
||||
}
|
||||
MultiClip.destroyExtraClips();
|
||||
Game gameState = (Game) game.getState(Opsu.STATE_GAME);
|
||||
gameState.loadBeatmap(beatmap);
|
||||
gameState.setRestart(Game.Restart.NEW);
|
||||
|
||||
Reference in New Issue
Block a user