make the eventbus static
This commit is contained in:
@@ -729,7 +729,7 @@ public enum GameImage {
|
||||
|
||||
String err = String.format("Could not find default image '%s'.", filename);
|
||||
Log.warn(err);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -788,7 +788,7 @@ public enum GameImage {
|
||||
img = img.getScaledCopy(0.5f);
|
||||
list.add(img);
|
||||
} catch (SlickException e) {
|
||||
EventBus.instance.post(new BubbleNotificationEvent(String.format("Failed to set image '%s'.", name), BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(String.format("Failed to set image '%s'.", name), BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -814,7 +814,7 @@ public enum GameImage {
|
||||
img = img.getScaledCopy(0.5f);
|
||||
return img;
|
||||
} catch (SlickException e) {
|
||||
EventBus.instance.post(new BubbleNotificationEvent(String.format("Failed to set image '%s'.", filename), BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(String.format("Failed to set image '%s'.", filename), BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -689,7 +689,7 @@ public class Options {
|
||||
public void clickListItem(int index) {
|
||||
if (Game.isInGame && Dancer.moverFactories[index] instanceof PolyMoverFactory) {
|
||||
// TODO remove this when #79 is fixed
|
||||
EventBus.instance.post(new BarNotificationEvent("This mover is disabled in the storyboard right now"));
|
||||
EventBus.post(new BarNotificationEvent("This mover is disabled in the storyboard right now"));
|
||||
return;
|
||||
}
|
||||
Dancer.instance.setMoverFactoryIndex(index);
|
||||
@@ -1343,7 +1343,7 @@ public class Options {
|
||||
public static void setNextFPS(DisplayContainer displayContainer) {
|
||||
GameOption.displayContainer = displayContainer; // TODO dirty shit
|
||||
GameOption.TARGET_FPS.clickListItem((targetFPSindex + 1) % targetFPS.length);
|
||||
EventBus.instance.post(new BarNotificationEvent(String.format("Frame limiter: %s", GameOption.TARGET_FPS.getValueString())));
|
||||
EventBus.post(new BarNotificationEvent(String.format("Frame limiter: %s", GameOption.TARGET_FPS.getValueString())));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1430,7 +1430,7 @@ public class Options {
|
||||
try {
|
||||
container.setDisplayMode(width, height, isFullscreen());
|
||||
} catch (Exception e) {
|
||||
container.eventBus.post(new BubbleNotificationEvent("Failed to change resolution", BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent("Failed to change resolution", BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
Log.error("Failed to set display mode.", e);
|
||||
}
|
||||
|
||||
@@ -1755,7 +1755,7 @@ public class Options {
|
||||
*/
|
||||
public static void toggleMouseDisabled() {
|
||||
GameOption.DISABLE_MOUSE_BUTTONS.click();
|
||||
EventBus.instance.post(new BarNotificationEvent((GameOption.DISABLE_MOUSE_BUTTONS.getBooleanValue()) ?
|
||||
EventBus.post(new BarNotificationEvent((GameOption.DISABLE_MOUSE_BUTTONS.getBooleanValue()) ?
|
||||
"Mouse buttons are disabled." : "Mouse buttons are enabled."));
|
||||
}
|
||||
|
||||
@@ -1845,7 +1845,7 @@ public class Options {
|
||||
// use default directory
|
||||
beatmapDir = BEATMAP_DIR;
|
||||
if (!beatmapDir.isDirectory() && !beatmapDir.mkdir())
|
||||
EventBus.instance.post(new BubbleNotificationEvent(String.format("Failed to create beatmap directory at '%s'.", beatmapDir.getAbsolutePath()), BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(String.format("Failed to create beatmap directory at '%s'.", beatmapDir.getAbsolutePath()), BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
return beatmapDir;
|
||||
}
|
||||
|
||||
@@ -1860,7 +1860,7 @@ public class Options {
|
||||
|
||||
oszDir = new File(DATA_DIR, "SongPacks/");
|
||||
if (!oszDir.isDirectory() && !oszDir.mkdir())
|
||||
EventBus.instance.post(new BubbleNotificationEvent(String.format("Failed to create song packs directory at '%s'.", oszDir.getAbsolutePath()), BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(String.format("Failed to create song packs directory at '%s'.", oszDir.getAbsolutePath()), BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
return oszDir;
|
||||
}
|
||||
|
||||
@@ -1875,7 +1875,7 @@ public class Options {
|
||||
|
||||
replayImportDir = new File(DATA_DIR, "ReplayImport/");
|
||||
if (!replayImportDir.isDirectory() && !replayImportDir.mkdir())
|
||||
EventBus.instance.post(new BubbleNotificationEvent(String.format("Failed to create replay import directory at '%s'.", replayImportDir.getAbsolutePath()), BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(String.format("Failed to create replay import directory at '%s'.", replayImportDir.getAbsolutePath()), BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
return replayImportDir;
|
||||
}
|
||||
|
||||
@@ -1925,14 +1925,14 @@ public class Options {
|
||||
// use default directory
|
||||
skinRootDir = SKIN_ROOT_DIR;
|
||||
if (!skinRootDir.isDirectory() && !skinRootDir.mkdir())
|
||||
EventBus.instance.post(new BubbleNotificationEvent(String.format("Failed to create skins directory at '%s'.", skinRootDir.getAbsolutePath()), BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(String.format("Failed to create skins directory at '%s'.", skinRootDir.getAbsolutePath()), BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
return skinRootDir;
|
||||
}
|
||||
|
||||
public static void reloadSkin() {
|
||||
loadSkin();
|
||||
SoundController.init();
|
||||
EventBus.instance.post(new ResolutionOrSkinChangedEvent());
|
||||
EventBus.post(new ResolutionOrSkinChangedEvent());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2065,7 +2065,7 @@ public class Options {
|
||||
} catch (IOException e) {
|
||||
String err = String.format("Failed to read file '%s'.", OPTIONS_FILE.getAbsolutePath());
|
||||
Log.error(err, e);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2096,7 +2096,7 @@ public class Options {
|
||||
} catch (IOException e) {
|
||||
String err = String.format("Failed to write to file '%s'.", OPTIONS_FILE.getAbsolutePath());
|
||||
Log.error(err, e);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public class Utils {
|
||||
// create the screenshot directory
|
||||
File dir = Options.getScreenshotDir();
|
||||
if (!dir.isDirectory() && !dir.mkdir()) {
|
||||
EventBus.instance.post(new BubbleNotificationEvent(String.format("Failed to create screenshot directory at '%s'.", dir.getAbsolutePath()), BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(String.format("Failed to create screenshot directory at '%s'.", dir.getAbsolutePath()), BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
ImageIO.write(image, Options.getScreenshotFormat(), file);
|
||||
EventBus.instance.post(new BubbleNotificationEvent("Created " + fileName, BubbleNotificationEvent.COMMONCOLOR_PURPLE));
|
||||
EventBus.post(new BubbleNotificationEvent("Created " + fileName, BubbleNotificationEvent.COMMONCOLOR_PURPLE));
|
||||
} catch (Exception e) {
|
||||
ErrorHandler.error("Failed to take a screenshot.", e).show();
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class MusicController {
|
||||
if (lastBeatmap == null || !beatmap.audioFilename.equals(lastBeatmap.audioFilename)) {
|
||||
final File audioFile = beatmap.audioFilename;
|
||||
if (!audioFile.isFile() && !ResourceLoader.resourceExists(audioFile.getPath())) {
|
||||
EventBus.instance.post(new BarNotificationEvent(String.format("Could not find track '%s'.", audioFile.getName())));
|
||||
EventBus.post(new BarNotificationEvent(String.format("Could not find track '%s'.", audioFile.getName())));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public class MusicController {
|
||||
} catch (Exception e) {
|
||||
String err = String.format("Could not play track '%s'.", file.getName());
|
||||
Log.error(err, e);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ public class SoundController {
|
||||
// menu and game sounds
|
||||
for (SoundEffect s : SoundEffect.values()) {
|
||||
if ((currentFileName = getSoundFileName(s.getFileName())) == null) {
|
||||
EventBus.instance.post(new BubbleNotificationEvent("Could not find sound file " + s.getFileName(), BubbleNotificationEvent.COLOR_ORANGE));
|
||||
EventBus.post(new BubbleNotificationEvent("Could not find sound file " + s.getFileName(), BubbleNotificationEvent.COLOR_ORANGE));
|
||||
continue;
|
||||
}
|
||||
MultiClip newClip = loadClip(currentFileName, currentFileName.endsWith(".mp3"));
|
||||
@@ -236,7 +236,7 @@ public class SoundController {
|
||||
for (HitSound s : HitSound.values()) {
|
||||
String filename = String.format("%s-%s", ss.getName(), s.getFileName());
|
||||
if ((currentFileName = getSoundFileName(filename)) == null) {
|
||||
EventBus.instance.post(new BubbleNotificationEvent("Could not find hit sound file " + filename, BubbleNotificationEvent.COLOR_ORANGE));
|
||||
EventBus.post(new BubbleNotificationEvent("Could not find hit sound file " + filename, BubbleNotificationEvent.COLOR_ORANGE));
|
||||
continue;
|
||||
}
|
||||
MultiClip newClip = loadClip(currentFileName, false);
|
||||
@@ -392,7 +392,7 @@ public class SoundController {
|
||||
|
||||
@Override
|
||||
public void error() {
|
||||
EventBus.instance.post(new BarNotificationEvent("Failed to download track preview."));
|
||||
EventBus.post(new BarNotificationEvent("Failed to download track preview."));
|
||||
}
|
||||
});
|
||||
try {
|
||||
|
||||
@@ -160,7 +160,7 @@ public class BeatmapParser {
|
||||
beatmap = parseFile(file, dir, beatmaps, false);
|
||||
} catch(Exception e) {
|
||||
Log.error("could not parse beatmap " + file.getName() + ": " + e.getMessage());
|
||||
EventBus.instance.post(new BubbleNotificationEvent("Could not parse beatmap " + file.getName(), BubbleNotificationEvent.COLOR_ORANGE));
|
||||
EventBus.post(new BubbleNotificationEvent("Could not parse beatmap " + file.getName(), BubbleNotificationEvent.COLOR_ORANGE));
|
||||
}
|
||||
|
||||
// add to parsed beatmap list
|
||||
@@ -249,7 +249,7 @@ public class BeatmapParser {
|
||||
} catch (IOException e) {
|
||||
String err = String.format("Failed to read file '%s'.", map.getFile().getAbsolutePath());
|
||||
Log.error(err, e);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
ErrorHandler.error("Failed to get MD5 hash stream.", e).show();
|
||||
|
||||
@@ -654,7 +654,7 @@ public class BeatmapParser {
|
||||
} catch (IOException e) {
|
||||
String err = String.format("Failed to read file '%s'.", file.getAbsolutePath());
|
||||
Log.error(err, e);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
ErrorHandler.error("Failed to get MD5 hash stream.", e).show();
|
||||
|
||||
@@ -737,7 +737,7 @@ public class BeatmapParser {
|
||||
} catch (IOException e) {
|
||||
String err = String.format("Failed to read file '%s'.", beatmap.getFile().getAbsolutePath());
|
||||
Log.error(err, e);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -817,7 +817,7 @@ public class BeatmapParser {
|
||||
} catch (IOException e) {
|
||||
String err = String.format("Failed to read file '%s'.", beatmap.getFile().getAbsolutePath());
|
||||
Log.error(err, e);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ public class BeatmapSetList {
|
||||
try {
|
||||
Utils.deleteToTrash(dir);
|
||||
} catch (IOException e) {
|
||||
EventBus.instance.post(new BubbleNotificationEvent("Could not delete song group", BubbleNotificationEvent.COLOR_ORANGE));
|
||||
EventBus.post(new BubbleNotificationEvent("Could not delete song group", BubbleNotificationEvent.COLOR_ORANGE));
|
||||
}
|
||||
if (ws != null)
|
||||
ws.resume();
|
||||
@@ -271,7 +271,7 @@ public class BeatmapSetList {
|
||||
try {
|
||||
Utils.deleteToTrash(file);
|
||||
} catch (IOException e) {
|
||||
EventBus.instance.post(new BubbleNotificationEvent("Could not delete song", BubbleNotificationEvent.COLOR_ORANGE));
|
||||
EventBus.post(new BubbleNotificationEvent("Could not delete song", BubbleNotificationEvent.COLOR_ORANGE));
|
||||
}
|
||||
if (ws != null)
|
||||
ws.resume();
|
||||
|
||||
@@ -98,7 +98,7 @@ public class BeatmapWatchService {
|
||||
ws.register(Options.getBeatmapDir().toPath());
|
||||
} catch (IOException e) {
|
||||
Log.error("Could not create watch service", e);
|
||||
EventBus.instance.post(new BubbleNotificationEvent("Could not create watch service", BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent("Could not create watch service", BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class BeatmapWatchService {
|
||||
ws = null;
|
||||
} catch (IOException e) {
|
||||
Log.error("An I/O exception occurred while closing the previous watch service.", e);
|
||||
EventBus.instance.post(new BubbleNotificationEvent("An I/O exception occurred while closing the previous watch service.", BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent("An I/O exception occurred while closing the previous watch service.", BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
ws = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class OszUnpacker {
|
||||
} catch (ZipException e) {
|
||||
String err = String.format("Failed to unzip file %s to dest %s.", file.getAbsolutePath(), dest.getAbsolutePath());
|
||||
Log.error(err, e);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ public class Download {
|
||||
else if (redirectCount > MAX_REDIRECTS)
|
||||
error = String.format("Download for URL '%s' is attempting too many redirects (over %d).", base.toString(), MAX_REDIRECTS);
|
||||
if (error != null) {
|
||||
EventBus.instance.post(new BubbleNotificationEvent(error, BubbleNotificationEvent.COLOR_ORANGE));
|
||||
EventBus.post(new BubbleNotificationEvent(error, BubbleNotificationEvent.COLOR_ORANGE));
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
|
||||
@@ -278,12 +278,12 @@ public class DownloadNode {
|
||||
download.setListener(new DownloadListener() {
|
||||
@Override
|
||||
public void completed() {
|
||||
EventBus.instance.post(new BarNotificationEvent(String.format("Download complete: %s", getTitle())));
|
||||
EventBus.post(new BarNotificationEvent(String.format("Download complete: %s", getTitle())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error() {
|
||||
EventBus.instance.post(new BarNotificationEvent("Download failed due to a connection error."));
|
||||
EventBus.post(new BarNotificationEvent("Download failed due to a connection error."));
|
||||
}
|
||||
});
|
||||
this.download = download;
|
||||
@@ -404,7 +404,7 @@ public class DownloadNode {
|
||||
public void drawDownload(Graphics g, float position, int id, boolean hover) {
|
||||
Download download = this.download; // in case clearDownload() is called asynchronously
|
||||
if (download == null) {
|
||||
EventBus.instance.post(new BubbleNotificationEvent("Trying to draw download information for button without Download object", BubbleNotificationEvent.COLOR_ORANGE));
|
||||
EventBus.post(new BubbleNotificationEvent("Trying to draw download information for button without Download object", BubbleNotificationEvent.COLOR_ORANGE));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -251,13 +251,13 @@ public class Updater {
|
||||
@Override
|
||||
public void completed() {
|
||||
status = Status.UPDATE_DOWNLOADED;
|
||||
EventBus.instance.post(new BarNotificationEvent("Update has finished downloading"));
|
||||
EventBus.post(new BarNotificationEvent("Update has finished downloading"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error() {
|
||||
status = Status.CONNECTION_ERROR;
|
||||
EventBus.instance.post(new BarNotificationEvent("Update failed due to a connection error."));
|
||||
EventBus.post(new BarNotificationEvent("Update failed due to a connection error."));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ public class Replay {
|
||||
File dir = Options.getReplayDir();
|
||||
if (!dir.isDirectory()) {
|
||||
if (!dir.mkdir()) {
|
||||
EventBus.instance.post(new BubbleNotificationEvent("Failed to create replay directory.", BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent("Failed to create replay directory.", BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ReplayImporter {
|
||||
if (!replayDir.mkdir()) {
|
||||
String err = String.format("Failed to create replay directory '%s'.", replayDir.getAbsolutePath());
|
||||
Log.error(err);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class ReplayImporter {
|
||||
moveToFailedDirectory(file);
|
||||
String err = String.format("Failed to import replay '%s'. The replay file could not be parsed.", file.getName());
|
||||
Log.error(err, e);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
continue;
|
||||
}
|
||||
Beatmap beatmap = BeatmapSetList.get().getBeatmapFromHash(r.beatmapHash);
|
||||
@@ -107,7 +107,7 @@ public class ReplayImporter {
|
||||
moveToFailedDirectory(file);
|
||||
String err = String.format("Failed to import replay '%s'. The associated beatmap could not be found.", file.getName());
|
||||
Log.error(err);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ public class SkinLoader {
|
||||
} catch (IOException e) {
|
||||
String err = String.format("Failed to read file '%s'.", skinFile.getAbsolutePath());
|
||||
Log.error(err, e);
|
||||
EventBus.instance.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(err, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
}
|
||||
|
||||
return skin;
|
||||
|
||||
@@ -280,7 +280,7 @@ public class DownloadsMenu extends ComplexOpsuState {
|
||||
this.importedNode = BeatmapParser.parseDirectories(dirs);
|
||||
if (importedNode != null) {
|
||||
// send notification
|
||||
EventBus.instance.post(new BarNotificationEvent((dirs.length == 1) ? "Imported 1 new song." :
|
||||
EventBus.post(new BarNotificationEvent((dirs.length == 1) ? "Imported 1 new song." :
|
||||
String.format("Imported %d new songs.", dirs.length)));
|
||||
}
|
||||
}
|
||||
@@ -687,7 +687,7 @@ public class DownloadsMenu extends ComplexOpsuState {
|
||||
if (playing)
|
||||
previewID = node.getID();
|
||||
} catch (SlickException e) {
|
||||
EventBus.instance.post(new BarNotificationEvent("Failed to load track preview. See log for details."));
|
||||
EventBus.post(new BarNotificationEvent("Failed to load track preview. See log for details."));
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
@@ -710,7 +710,7 @@ public class DownloadsMenu extends ComplexOpsuState {
|
||||
if (!DownloadList.get().contains(node.getID())) {
|
||||
node.createDownload(serverMenu.getSelectedItem());
|
||||
if (node.getDownload() == null) {
|
||||
EventBus.instance.post(new BarNotificationEvent("The download could not be started"));
|
||||
EventBus.post(new BarNotificationEvent("The download could not be started"));
|
||||
} else {
|
||||
DownloadList.get().addNode(node);
|
||||
node.getDownload().start();
|
||||
@@ -952,7 +952,7 @@ public class DownloadsMenu extends ComplexOpsuState {
|
||||
pageDir = Page.RESET;
|
||||
previewID = -1;
|
||||
if (barNotificationOnLoad != null) {
|
||||
EventBus.instance.post(new BarNotificationEvent(barNotificationOnLoad));
|
||||
EventBus.post(new BarNotificationEvent(barNotificationOnLoad));
|
||||
barNotificationOnLoad = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ public class Game extends ComplexOpsuState {
|
||||
gOffscreen.setBackground(Color.black);
|
||||
} catch (SlickException e) {
|
||||
Log.error("could not create offscreen graphics", e);
|
||||
displayContainer.eventBus.post(new BubbleNotificationEvent("Exception while creating offscreen graphics. See logfile for details.", BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent("Exception while creating offscreen graphics. See logfile for details.", BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
}
|
||||
|
||||
// initialize music position bar location
|
||||
@@ -1184,7 +1184,7 @@ public class Game extends ComplexOpsuState {
|
||||
int position = (pauseTime > -1) ? pauseTime : trackPosition;
|
||||
if (Options.setCheckpoint(position / 1000)) {
|
||||
SoundController.playSound(SoundEffect.MENUCLICK);
|
||||
EventBus.instance.post(new BarNotificationEvent("Checkpoint saved."));
|
||||
EventBus.post(new BarNotificationEvent("Checkpoint saved."));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1196,7 +1196,7 @@ public class Game extends ComplexOpsuState {
|
||||
break; // invalid checkpoint
|
||||
loadCheckpoint(checkpoint);
|
||||
SoundController.playSound(SoundEffect.MENUHIT);
|
||||
EventBus.instance.post(new BarNotificationEvent("Checkpoint loaded."));
|
||||
EventBus.post(new BarNotificationEvent("Checkpoint loaded."));
|
||||
}
|
||||
break;
|
||||
case Input.KEY_F:
|
||||
@@ -1241,12 +1241,12 @@ public class Game extends ComplexOpsuState {
|
||||
break;
|
||||
case Input.KEY_MINUS:
|
||||
currentMapMusicOffset += 5;
|
||||
EventBus.instance.post(new BarNotificationEvent("Current map offset: " + currentMapMusicOffset));
|
||||
EventBus.post(new BarNotificationEvent("Current map offset: " + currentMapMusicOffset));
|
||||
break;
|
||||
}
|
||||
if (key == Input.KEY_ADD || c == '+') {
|
||||
currentMapMusicOffset -= 5;
|
||||
EventBus.instance.post(new BarNotificationEvent("Current map offset: " + currentMapMusicOffset));
|
||||
EventBus.post(new BarNotificationEvent("Current map offset: " + currentMapMusicOffset));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1466,7 +1466,7 @@ public class Game extends ComplexOpsuState {
|
||||
}
|
||||
|
||||
if (beatmap == null || beatmap.objects == null) {
|
||||
displayContainer.eventBus.post(new BubbleNotificationEvent("Game was running without a beatmap", BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent("Game was running without a beatmap", BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
displayContainer.switchStateInstantly(SongMenu.class);
|
||||
}
|
||||
|
||||
@@ -1568,7 +1568,7 @@ public class Game extends ComplexOpsuState {
|
||||
} catch (Exception e) {
|
||||
String message = String.format("Failed to create %s at index %d:\n%s", hitObject.getTypeName(), i, hitObject.toString());
|
||||
Log.error(message, e);
|
||||
displayContainer.eventBus.post(new BubbleNotificationEvent(message, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
EventBus.post(new BubbleNotificationEvent(message, BubbleNotificationEvent.COMMONCOLOR_RED));
|
||||
gameObjects[i] = new DummyObject(hitObject);
|
||||
}
|
||||
}
|
||||
@@ -2154,7 +2154,7 @@ public class Game extends ComplexOpsuState {
|
||||
this.replay = null;
|
||||
} else {
|
||||
if (replay.frames == null) {
|
||||
displayContainer.eventBus.post(new BubbleNotificationEvent("Attempting to set a replay with no frames.", BubbleNotificationEvent.COLOR_ORANGE));
|
||||
EventBus.post(new BubbleNotificationEvent("Attempting to set a replay with no frames.", BubbleNotificationEvent.COLOR_ORANGE));
|
||||
return;
|
||||
}
|
||||
this.isReplay = true;
|
||||
|
||||
@@ -166,13 +166,13 @@ public class GameRanking extends BaseOpsuState {
|
||||
gameState.setRestart((data.isGameplay()) ? Game.Restart.REPLAY : Game.Restart.NEW);
|
||||
returnToGame = true;
|
||||
} catch (FileNotFoundException e) {
|
||||
EventBus.instance.post(new BarNotificationEvent("Replay file not found."));
|
||||
EventBus.post(new BarNotificationEvent("Replay file not found."));
|
||||
} catch (IOException e) {
|
||||
Log.error("Failed to load replay data.", e);
|
||||
EventBus.instance.post(new BarNotificationEvent("Failed to load replay data. See log for details."));
|
||||
EventBus.post(new BarNotificationEvent("Failed to load replay data. See log for details."));
|
||||
}
|
||||
} else
|
||||
EventBus.instance.post(new BarNotificationEvent("Replay file not found."));
|
||||
EventBus.post(new BarNotificationEvent("Replay file not found."));
|
||||
}
|
||||
|
||||
// retry
|
||||
|
||||
@@ -471,10 +471,10 @@ public class MainMenu extends BaseOpsuState {
|
||||
UI.enter();
|
||||
if (!enterNotification) {
|
||||
if (Updater.get().getStatus() == Updater.Status.UPDATE_AVAILABLE) {
|
||||
EventBus.instance.post(new BarNotificationEvent("An opsu! update is available."));
|
||||
EventBus.post(new BarNotificationEvent("An opsu! update is available."));
|
||||
enterNotification = true;
|
||||
} else if (Updater.get().justUpdated()) {
|
||||
EventBus.instance.post(new BarNotificationEvent("opsu! is now up to date!"));
|
||||
EventBus.post(new BarNotificationEvent("opsu! is now up to date!"));
|
||||
enterNotification = true;
|
||||
}
|
||||
}
|
||||
@@ -537,15 +537,15 @@ public class MainMenu extends BaseOpsuState {
|
||||
if (musicPlay.contains(x, y)) {
|
||||
if (MusicController.isPlaying()) {
|
||||
MusicController.pause();
|
||||
EventBus.instance.post(new BarNotificationEvent("Pause"));
|
||||
EventBus.post(new BarNotificationEvent("Pause"));
|
||||
} else if (!MusicController.isTrackLoading()) {
|
||||
MusicController.resume();
|
||||
EventBus.instance.post(new BarNotificationEvent("Play"));
|
||||
EventBus.post(new BarNotificationEvent("Play"));
|
||||
}
|
||||
return true;
|
||||
} else if (musicNext.contains(x, y)) {
|
||||
nextTrack(true);
|
||||
EventBus.instance.post(new BarNotificationEvent(">> Next"));
|
||||
EventBus.post(new BarNotificationEvent(">> Next"));
|
||||
return true;
|
||||
} else if (musicPrevious.contains(x, y)) {
|
||||
lastMeasureProgress = 0f;
|
||||
@@ -555,7 +555,7 @@ public class MainMenu extends BaseOpsuState {
|
||||
bgAlpha.setTime(0);
|
||||
} else
|
||||
MusicController.setPosition(0);
|
||||
EventBus.instance.post(new BarNotificationEvent("<< Previous"));
|
||||
EventBus.post(new BarNotificationEvent("<< Previous"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -571,10 +571,10 @@ public class MainMenu extends BaseOpsuState {
|
||||
try {
|
||||
Desktop.getDesktop().browse(Options.REPOSITORY_URI);
|
||||
} catch (UnsupportedOperationException e) {
|
||||
EventBus.instance.post(new BarNotificationEvent("The repository web page could not be opened."));
|
||||
EventBus.post(new BarNotificationEvent("The repository web page could not be opened."));
|
||||
} catch (IOException e) {
|
||||
Log.error("could not browse to repo", e);
|
||||
displayContainer.eventBus.post(new BubbleNotificationEvent("Could not browse to repo", BubbleNotificationEvent.COLOR_ORANGE));
|
||||
EventBus.post(new BubbleNotificationEvent("Could not browse to repo", BubbleNotificationEvent.COLOR_ORANGE));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -583,10 +583,10 @@ public class MainMenu extends BaseOpsuState {
|
||||
try {
|
||||
Desktop.getDesktop().browse(Options.DANCE_REPOSITORY_URI);
|
||||
} catch (UnsupportedOperationException e) {
|
||||
EventBus.instance.post(new BarNotificationEvent("The repository web page could not be opened."));
|
||||
EventBus.post(new BarNotificationEvent("The repository web page could not be opened."));
|
||||
} catch (IOException e) {
|
||||
Log.error("could not browse to repo", e);
|
||||
displayContainer.eventBus.post(new BubbleNotificationEvent("Could not browse to repo", BubbleNotificationEvent.COLOR_ORANGE));
|
||||
EventBus.post(new BubbleNotificationEvent("Could not browse to repo", BubbleNotificationEvent.COLOR_ORANGE));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ public class SongMenu extends ComplexOpsuState {
|
||||
if (!songFolderChanged && kind != StandardWatchEventKinds.ENTRY_MODIFY) {
|
||||
songFolderChanged = true;
|
||||
if (displayContainer.isInState(SongMenu.class)) {
|
||||
EventBus.instance.post(new BarNotificationEvent("Changed is Songs folder detected. Hit F5 to refresh."));
|
||||
EventBus.post(new BarNotificationEvent("Changed is Songs folder detected. Hit F5 to refresh."));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -961,7 +961,7 @@ public class SongMenu extends ComplexOpsuState {
|
||||
setFocus(BeatmapSetList.get().getRandomNode(), -1, true, true);
|
||||
|
||||
if (BeatmapSetList.get().size() < 1 && group.getEmptyMessage() != null) {
|
||||
EventBus.instance.post(new BarNotificationEvent(group.getEmptyMessage()));
|
||||
EventBus.post(new BarNotificationEvent(group.getEmptyMessage()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -1773,7 +1773,7 @@ public class SongMenu extends ComplexOpsuState {
|
||||
|
||||
Beatmap beatmap = MusicController.getBeatmap();
|
||||
if (focusNode == null || beatmap != focusNode.getSelectedBeatmap()) {
|
||||
EventBus.instance.post(new BarNotificationEvent("Unable to load the beatmap audio."));
|
||||
EventBus.post(new BarNotificationEvent("Unable to load the beatmap audio."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user