overhaul event system

This commit is contained in:
yugecin
2017-05-26 21:32:55 +02:00
parent b8dd507dc5
commit 1df25520e4
36 changed files with 354 additions and 324 deletions

View File

@@ -36,9 +36,8 @@ import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.util.Log;
import yugecin.opsudance.core.events.EventBus;
import yugecin.opsudance.core.state.BaseOpsuState;
import yugecin.opsudance.events.BarNotificationEvent;
import yugecin.opsudance.events.BarNotifListener;
import static yugecin.opsudance.core.InstanceContainer.*;
@@ -157,13 +156,14 @@ public class GameRanking extends BaseOpsuState {
gameState.setRestart((data.isGameplay()) ? Game.Restart.REPLAY : Game.Restart.NEW);
returnToGame = true;
} catch (FileNotFoundException e) {
EventBus.post(new BarNotificationEvent("Replay file not found."));
BarNotifListener.EVENT.make().onBarNotif("Replay file not found.");
} catch (IOException e) {
Log.error("Failed to load replay data.", e);
EventBus.post(new BarNotificationEvent("Failed to load replay data. See log for details."));
BarNotifListener.EVENT.make().onBarNotif(
"Failed to load replay data. See log for details.");
}
} else
EventBus.post(new BarNotificationEvent("Replay file not found."));
BarNotifListener.EVENT.make().onBarNotif("Replay file not found.");
}
// retry