use the new errorhandler & bubble notifs
This commit is contained in:
@@ -24,6 +24,7 @@ import itdelatrisu.opsu.audio.MusicController;
|
||||
import itdelatrisu.opsu.beatmap.Beatmap;
|
||||
import itdelatrisu.opsu.downloads.DownloadList;
|
||||
import itdelatrisu.opsu.downloads.Updater;
|
||||
import itdelatrisu.opsu.render.CurveRenderState;
|
||||
import itdelatrisu.opsu.ui.Fonts;
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.openal.AL;
|
||||
@@ -222,6 +223,7 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
|
||||
GameImage.destroyImages();
|
||||
GameData.Grade.destroyImages();
|
||||
Beatmap.destroyBackgroundImageCache();
|
||||
CurveRenderState.shutdown();
|
||||
Display.destroy();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ public class ErrorHandler {
|
||||
private boolean preventContinue;
|
||||
private boolean preventReport;
|
||||
private boolean ignoreAndContinue;
|
||||
private boolean allowTerminate;
|
||||
|
||||
public ErrorHandler(DisplayContainer displayContainer) {
|
||||
this.displayContainer = displayContainer;
|
||||
@@ -95,6 +96,11 @@ public class ErrorHandler {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ErrorHandler allowTerminate() {
|
||||
allowTerminate = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ErrorHandler preventContinue() {
|
||||
preventContinue = true;
|
||||
return this;
|
||||
@@ -127,7 +133,9 @@ public class ErrorHandler {
|
||||
Object[] messageComponents = new Object[] { message, new JScrollPane(textArea), createViewLogButton(), createReportButton() };
|
||||
|
||||
String[] buttons;
|
||||
if (preventContinue) {
|
||||
if (!allowTerminate && !preventContinue) {
|
||||
buttons = new String[] { "Ignore & continue" };
|
||||
} else if (preventContinue) {
|
||||
buttons = new String[] { "Terminate" };
|
||||
} else {
|
||||
buttons = new String[] { "Terminate", "Ignore & continue" };
|
||||
@@ -145,7 +153,7 @@ public class ErrorHandler {
|
||||
null,
|
||||
buttons,
|
||||
buttons[buttons.length - 1]);
|
||||
ignoreAndContinue = result == 1;
|
||||
ignoreAndContinue = !allowTerminate || result == 1;
|
||||
frame.dispose();
|
||||
|
||||
return this;
|
||||
|
||||
@@ -22,10 +22,14 @@ import java.util.*;
|
||||
@SuppressWarnings("unchecked")
|
||||
public class EventBus {
|
||||
|
||||
@Deprecated
|
||||
public static EventBus instance; // TODO get rid of this
|
||||
|
||||
private final List<Subscriber> subscribers;
|
||||
|
||||
public EventBus() {
|
||||
subscribers = new LinkedList<>();
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public <T> void subscribe(Class<T> eventType, EventListener<T> eventListener) {
|
||||
|
||||
Reference in New Issue
Block a user