replace all calls to old bar notif with new method
This commit is contained in:
parent
02ef422003
commit
36aaccda29
|
@ -27,7 +27,6 @@ import itdelatrisu.opsu.skins.Skin;
|
|||
import itdelatrisu.opsu.skins.SkinLoader;
|
||||
import itdelatrisu.opsu.states.Game;
|
||||
import itdelatrisu.opsu.ui.Fonts;
|
||||
import itdelatrisu.opsu.ui.UI;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
|
@ -62,6 +61,7 @@ import yugecin.opsudance.*;
|
|||
import yugecin.opsudance.core.DisplayContainer;
|
||||
import yugecin.opsudance.core.errorhandling.ErrorHandler;
|
||||
import yugecin.opsudance.core.events.EventBus;
|
||||
import yugecin.opsudance.events.BarNotificationEvent;
|
||||
import yugecin.opsudance.events.BubbleNotificationEvent;
|
||||
import yugecin.opsudance.events.ResolutionOrSkinChangedEvent;
|
||||
import yugecin.opsudance.movers.factories.ExgonMoverFactory;
|
||||
|
@ -660,7 +660,7 @@ public class Options {
|
|||
public void clickListItem(int index) {
|
||||
if (Game.isInGame && Dancer.moverFactories[index] instanceof PolyMoverFactory) {
|
||||
// TODO remove this when #79 is fixed
|
||||
UI.sendBarNotification("This mover is disabled in the storyboard right now");
|
||||
EventBus.instance.post(new BarNotificationEvent("This mover is disabled in the storyboard right now"));
|
||||
return;
|
||||
}
|
||||
Dancer.instance.setMoverFactoryIndex(index);
|
||||
|
@ -1282,7 +1282,7 @@ public class Options {
|
|||
public static void setNextFPS(DisplayContainer displayContainer) {
|
||||
GameOption.displayContainer = displayContainer; // TODO dirty shit
|
||||
GameOption.TARGET_FPS.clickListItem((targetFPSindex + 1) % targetFPS.length);
|
||||
UI.sendBarNotification(String.format("Frame limiter: %s", GameOption.TARGET_FPS.getValueString()));
|
||||
EventBus.instance.post(new BarNotificationEvent(String.format("Frame limiter: %s", GameOption.TARGET_FPS.getValueString())));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1695,8 +1695,8 @@ public class Options {
|
|||
*/
|
||||
public static void toggleMouseDisabled() {
|
||||
GameOption.DISABLE_MOUSE_BUTTONS.click();
|
||||
UI.sendBarNotification((GameOption.DISABLE_MOUSE_BUTTONS.getBooleanValue()) ?
|
||||
"Mouse buttons are disabled." : "Mouse buttons are enabled.");
|
||||
EventBus.instance.post(new BarNotificationEvent((GameOption.DISABLE_MOUSE_BUTTONS.getBooleanValue()) ?
|
||||
"Mouse buttons are disabled." : "Mouse buttons are enabled."));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,7 +23,6 @@ import itdelatrisu.opsu.beatmap.Beatmap;
|
|||
import itdelatrisu.opsu.beatmap.BeatmapParser;
|
||||
import itdelatrisu.opsu.beatmap.TimingPoint;
|
||||
import itdelatrisu.opsu.states.Game;
|
||||
import itdelatrisu.opsu.ui.UI;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -48,6 +47,7 @@ import org.newdawn.slick.util.ResourceLoader;
|
|||
import org.tritonus.share.sampled.file.TAudioFileFormat;
|
||||
import yugecin.opsudance.core.errorhandling.ErrorHandler;
|
||||
import yugecin.opsudance.core.events.EventBus;
|
||||
import yugecin.opsudance.events.BarNotificationEvent;
|
||||
import yugecin.opsudance.events.BubbleNotificationEvent;
|
||||
|
||||
/**
|
||||
|
@ -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())) {
|
||||
UI.sendBarNotification(String.format("Could not find track '%s'.", audioFile.getName()));
|
||||
EventBus.instance.post(new BarNotificationEvent(String.format("Could not find track '%s'.", audioFile.getName())));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.newdawn.slick.SlickException;
|
|||
import org.newdawn.slick.util.ResourceLoader;
|
||||
import yugecin.opsudance.core.errorhandling.ErrorHandler;
|
||||
import yugecin.opsudance.core.events.EventBus;
|
||||
import yugecin.opsudance.events.BarNotificationEvent;
|
||||
import yugecin.opsudance.events.BubbleNotificationEvent;
|
||||
|
||||
/**
|
||||
|
@ -391,7 +392,7 @@ public class SoundController {
|
|||
|
||||
@Override
|
||||
public void error() {
|
||||
UI.sendBarNotification("Failed to download track preview.");
|
||||
EventBus.instance.post(new BarNotificationEvent("Failed to download track preview."));
|
||||
}
|
||||
});
|
||||
try {
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.newdawn.slick.Color;
|
|||
import org.newdawn.slick.Graphics;
|
||||
import org.newdawn.slick.Image;
|
||||
import yugecin.opsudance.core.events.EventBus;
|
||||
import yugecin.opsudance.events.BarNotificationEvent;
|
||||
import yugecin.opsudance.events.BubbleNotificationEvent;
|
||||
|
||||
/**
|
||||
|
@ -277,12 +278,12 @@ public class DownloadNode {
|
|||
download.setListener(new DownloadListener() {
|
||||
@Override
|
||||
public void completed() {
|
||||
UI.sendBarNotification(String.format("Download complete: %s", getTitle()));
|
||||
EventBus.instance.post(new BarNotificationEvent(String.format("Download complete: %s", getTitle())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error() {
|
||||
UI.sendBarNotification("Download failed due to a connection error.");
|
||||
EventBus.instance.post(new BarNotificationEvent("Download failed due to a connection error."));
|
||||
}
|
||||
});
|
||||
this.download = download;
|
||||
|
|
|
@ -38,6 +38,8 @@ import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
|||
import org.newdawn.slick.util.Log;
|
||||
import org.newdawn.slick.util.ResourceLoader;
|
||||
import yugecin.opsudance.core.errorhandling.ErrorHandler;
|
||||
import yugecin.opsudance.core.events.EventBus;
|
||||
import yugecin.opsudance.events.BarNotificationEvent;
|
||||
|
||||
/**
|
||||
* Handles automatic program updates.
|
||||
|
@ -249,13 +251,13 @@ public class Updater {
|
|||
@Override
|
||||
public void completed() {
|
||||
status = Status.UPDATE_DOWNLOADED;
|
||||
UI.sendBarNotification("Update has finished downloading.");
|
||||
EventBus.instance.post(new BarNotificationEvent("Update has finished downloading"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error() {
|
||||
status = Status.CONNECTION_ERROR;
|
||||
UI.sendBarNotification("Update failed due to a connection error.");
|
||||
EventBus.instance.post(new BarNotificationEvent("Update failed due to a connection error."));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ package itdelatrisu.opsu.states;
|
|||
|
||||
import itdelatrisu.opsu.GameImage;
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import itdelatrisu.opsu.audio.MusicController;
|
||||
import itdelatrisu.opsu.audio.SoundController;
|
||||
import itdelatrisu.opsu.audio.SoundEffect;
|
||||
|
@ -57,8 +56,10 @@ import org.newdawn.slick.SlickException;
|
|||
import org.newdawn.slick.gui.TextField;
|
||||
import org.newdawn.slick.util.Log;
|
||||
import yugecin.opsudance.core.DisplayContainer;
|
||||
import yugecin.opsudance.core.events.EventBus;
|
||||
import yugecin.opsudance.core.inject.InstanceContainer;
|
||||
import yugecin.opsudance.core.state.ComplexOpsuState;
|
||||
import yugecin.opsudance.events.BarNotificationEvent;
|
||||
|
||||
/**
|
||||
* Downloads menu.
|
||||
|
@ -279,8 +280,8 @@ public class DownloadsMenu extends ComplexOpsuState {
|
|||
this.importedNode = BeatmapParser.parseDirectories(dirs);
|
||||
if (importedNode != null) {
|
||||
// send notification
|
||||
UI.sendBarNotification((dirs.length == 1) ? "Imported 1 new song." :
|
||||
String.format("Imported %d new songs.", dirs.length));
|
||||
EventBus.instance.post(new BarNotificationEvent((dirs.length == 1) ? "Imported 1 new song." :
|
||||
String.format("Imported %d new songs.", dirs.length)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -686,7 +687,7 @@ public class DownloadsMenu extends ComplexOpsuState {
|
|||
if (playing)
|
||||
previewID = node.getID();
|
||||
} catch (SlickException e) {
|
||||
UI.sendBarNotification("Failed to load track preview. See log for details.");
|
||||
EventBus.instance.post(new BarNotificationEvent("Failed to load track preview. See log for details."));
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
|
@ -708,9 +709,9 @@ public class DownloadsMenu extends ComplexOpsuState {
|
|||
// start download
|
||||
if (!DownloadList.get().contains(node.getID())) {
|
||||
node.createDownload(serverMenu.getSelectedItem());
|
||||
if (node.getDownload() == null)
|
||||
UI.sendBarNotification("The download could not be started.");
|
||||
else {
|
||||
if (node.getDownload() == null) {
|
||||
EventBus.instance.post(new BarNotificationEvent("The download could not be started"));
|
||||
} else {
|
||||
DownloadList.get().addNode(node);
|
||||
node.getDownload().start();
|
||||
}
|
||||
|
@ -953,7 +954,7 @@ public class DownloadsMenu extends ComplexOpsuState {
|
|||
pageDir = Page.RESET;
|
||||
previewID = -1;
|
||||
if (barNotificationOnLoad != null) {
|
||||
UI.sendBarNotification(barNotificationOnLoad);
|
||||
EventBus.instance.post(new BarNotificationEvent(barNotificationOnLoad));
|
||||
barNotificationOnLoad = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,10 +64,12 @@ import org.newdawn.slick.SlickException;
|
|||
import org.newdawn.slick.util.Log;
|
||||
import yugecin.opsudance.*;
|
||||
import yugecin.opsudance.core.DisplayContainer;
|
||||
import yugecin.opsudance.core.events.EventBus;
|
||||
import yugecin.opsudance.core.inject.InstanceContainer;
|
||||
import yugecin.opsudance.core.state.ComplexOpsuState;
|
||||
import yugecin.opsudance.core.state.transitions.FadeInTransitionState;
|
||||
import yugecin.opsudance.core.state.transitions.FadeOutTransitionState;
|
||||
import yugecin.opsudance.events.BarNotificationEvent;
|
||||
import yugecin.opsudance.events.BubbleNotificationEvent;
|
||||
import yugecin.opsudance.objects.curves.FakeCombinedCurve;
|
||||
import yugecin.opsudance.sbv2.MoveStoryboard;
|
||||
|
@ -1186,7 +1188,7 @@ public class Game extends ComplexOpsuState {
|
|||
int position = (pauseTime > -1) ? pauseTime : trackPosition;
|
||||
if (Options.setCheckpoint(position / 1000)) {
|
||||
SoundController.playSound(SoundEffect.MENUCLICK);
|
||||
UI.sendBarNotification("Checkpoint saved.");
|
||||
EventBus.instance.post(new BarNotificationEvent("Checkpoint saved."));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1198,7 +1200,7 @@ public class Game extends ComplexOpsuState {
|
|||
break; // invalid checkpoint
|
||||
loadCheckpoint(checkpoint);
|
||||
SoundController.playSound(SoundEffect.MENUHIT);
|
||||
UI.sendBarNotification("Checkpoint loaded.");
|
||||
EventBus.instance.post(new BarNotificationEvent("Checkpoint loaded."));
|
||||
}
|
||||
break;
|
||||
case Input.KEY_F:
|
||||
|
@ -1243,12 +1245,12 @@ public class Game extends ComplexOpsuState {
|
|||
break;
|
||||
case Input.KEY_MINUS:
|
||||
currentMapMusicOffset += 5;
|
||||
UI.sendBarNotification("Current map offset: " + currentMapMusicOffset);
|
||||
EventBus.instance.post(new BarNotificationEvent("Current map offset: " + currentMapMusicOffset));
|
||||
break;
|
||||
}
|
||||
if (key == Input.KEY_ADD || c == '+') {
|
||||
currentMapMusicOffset -= 5;
|
||||
UI.sendBarNotification("Current map offset: " + currentMapMusicOffset);
|
||||
EventBus.instance.post(new BarNotificationEvent("Current map offset: " + currentMapMusicOffset));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -37,8 +37,10 @@ import org.newdawn.slick.Image;
|
|||
import org.newdawn.slick.Input;
|
||||
import org.newdawn.slick.util.Log;
|
||||
import yugecin.opsudance.core.DisplayContainer;
|
||||
import yugecin.opsudance.core.events.EventBus;
|
||||
import yugecin.opsudance.core.inject.InstanceContainer;
|
||||
import yugecin.opsudance.core.state.BaseOpsuState;
|
||||
import yugecin.opsudance.events.BarNotificationEvent;
|
||||
|
||||
/**
|
||||
* "Game Ranking" (score card) state.
|
||||
|
@ -167,13 +169,13 @@ public class GameRanking extends BaseOpsuState {
|
|||
gameState.setRestart((data.isGameplay()) ? Game.Restart.REPLAY : Game.Restart.NEW);
|
||||
returnToGame = true;
|
||||
} catch (FileNotFoundException e) {
|
||||
UI.sendBarNotification("Replay file not found.");
|
||||
EventBus.instance.post(new BarNotificationEvent("Replay file not found."));
|
||||
} catch (IOException e) {
|
||||
Log.error("Failed to load replay data.", e);
|
||||
UI.sendBarNotification("Failed to load replay data. See log for details.");
|
||||
EventBus.instance.post(new BarNotificationEvent("Failed to load replay data. See log for details."));
|
||||
}
|
||||
} else
|
||||
UI.sendBarNotification("Replay file not found.");
|
||||
EventBus.instance.post(new BarNotificationEvent("Replay file not found."));
|
||||
}
|
||||
|
||||
// retry
|
||||
|
|
|
@ -51,6 +51,7 @@ import yugecin.opsudance.core.events.EventBus;
|
|||
import yugecin.opsudance.core.inject.InstanceContainer;
|
||||
import yugecin.opsudance.core.state.BaseOpsuState;
|
||||
import yugecin.opsudance.core.state.OpsuState;
|
||||
import yugecin.opsudance.events.BarNotificationEvent;
|
||||
import yugecin.opsudance.events.BubbleNotificationEvent;
|
||||
|
||||
/**
|
||||
|
@ -470,10 +471,10 @@ public class MainMenu extends BaseOpsuState {
|
|||
UI.enter();
|
||||
if (!enterNotification) {
|
||||
if (Updater.get().getStatus() == Updater.Status.UPDATE_AVAILABLE) {
|
||||
UI.sendBarNotification("An opsu! update is available.");
|
||||
EventBus.instance.post(new BarNotificationEvent("An opsu! update is available."));
|
||||
enterNotification = true;
|
||||
} else if (Updater.get().justUpdated()) {
|
||||
UI.sendBarNotification("opsu! is now up to date!");
|
||||
EventBus.instance.post(new BarNotificationEvent("opsu! is now up to date!"));
|
||||
enterNotification = true;
|
||||
}
|
||||
}
|
||||
|
@ -536,15 +537,15 @@ public class MainMenu extends BaseOpsuState {
|
|||
if (musicPlay.contains(x, y)) {
|
||||
if (MusicController.isPlaying()) {
|
||||
MusicController.pause();
|
||||
UI.sendBarNotification("Pause");
|
||||
EventBus.instance.post(new BarNotificationEvent("Pause"));
|
||||
} else if (!MusicController.isTrackLoading()) {
|
||||
MusicController.resume();
|
||||
UI.sendBarNotification("Play");
|
||||
EventBus.instance.post(new BarNotificationEvent("Play"));
|
||||
}
|
||||
return true;
|
||||
} else if (musicNext.contains(x, y)) {
|
||||
nextTrack(true);
|
||||
UI.sendBarNotification(">> Next");
|
||||
EventBus.instance.post(new BarNotificationEvent(">> Next"));
|
||||
return true;
|
||||
} else if (musicPrevious.contains(x, y)) {
|
||||
lastMeasureProgress = 0f;
|
||||
|
@ -554,7 +555,7 @@ public class MainMenu extends BaseOpsuState {
|
|||
bgAlpha.setTime(0);
|
||||
} else
|
||||
MusicController.setPosition(0);
|
||||
UI.sendBarNotification("<< Previous");
|
||||
EventBus.instance.post(new BarNotificationEvent("<< Previous"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -570,7 +571,7 @@ public class MainMenu extends BaseOpsuState {
|
|||
try {
|
||||
Desktop.getDesktop().browse(Options.REPOSITORY_URI);
|
||||
} catch (UnsupportedOperationException e) {
|
||||
UI.sendBarNotification("The repository web page could not be opened.");
|
||||
EventBus.instance.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));
|
||||
|
@ -582,7 +583,7 @@ public class MainMenu extends BaseOpsuState {
|
|||
try {
|
||||
Desktop.getDesktop().browse(Options.DANCE_REPOSITORY_URI);
|
||||
} catch (UnsupportedOperationException e) {
|
||||
UI.sendBarNotification("The repository web page could not be opened.");
|
||||
EventBus.instance.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));
|
||||
|
|
|
@ -69,8 +69,10 @@ import org.newdawn.slick.Input;
|
|||
import org.newdawn.slick.SpriteSheet;
|
||||
import org.newdawn.slick.gui.TextField;
|
||||
import yugecin.opsudance.core.DisplayContainer;
|
||||
import yugecin.opsudance.core.events.EventBus;
|
||||
import yugecin.opsudance.core.inject.InstanceContainer;
|
||||
import yugecin.opsudance.core.state.ComplexOpsuState;
|
||||
import yugecin.opsudance.events.BarNotificationEvent;
|
||||
import yugecin.opsudance.ui.OptionsOverlay;
|
||||
|
||||
/**
|
||||
|
@ -453,7 +455,7 @@ public class SongMenu extends ComplexOpsuState {
|
|||
if (!songFolderChanged && kind != StandardWatchEventKinds.ENTRY_MODIFY) {
|
||||
songFolderChanged = true;
|
||||
if (displayContainer.isInState(SongMenu.class)) {
|
||||
UI.sendBarNotification("Changes in Songs folder detected. Hit F5 to refresh.");
|
||||
EventBus.instance.post(new BarNotificationEvent("Changed is Songs folder detected. Hit F5 to refresh."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -958,8 +960,9 @@ public class SongMenu extends ComplexOpsuState {
|
|||
BeatmapSetList.get().init();
|
||||
setFocus(BeatmapSetList.get().getRandomNode(), -1, true, true);
|
||||
|
||||
if (BeatmapSetList.get().size() < 1 && group.getEmptyMessage() != null)
|
||||
UI.sendBarNotification(group.getEmptyMessage());
|
||||
if (BeatmapSetList.get().size() < 1 && group.getEmptyMessage() != null) {
|
||||
EventBus.instance.post(new BarNotificationEvent(group.getEmptyMessage()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1775,7 +1778,7 @@ public class SongMenu extends ComplexOpsuState {
|
|||
|
||||
Beatmap beatmap = MusicController.getBeatmap();
|
||||
if (focusNode == null || beatmap != focusNode.getSelectedBeatmap()) {
|
||||
UI.sendBarNotification("Unable to load the beatmap audio.");
|
||||
EventBus.instance.post(new BarNotificationEvent("Unable to load the beatmap audio."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,13 +20,13 @@ package yugecin.opsudance.sbv2;
|
|||
import itdelatrisu.opsu.objects.GameObject;
|
||||
import itdelatrisu.opsu.ui.Colors;
|
||||
import itdelatrisu.opsu.ui.Fonts;
|
||||
import itdelatrisu.opsu.ui.UI;
|
||||
import itdelatrisu.opsu.ui.animations.AnimationEquation;
|
||||
import org.newdawn.slick.Color;
|
||||
import org.newdawn.slick.GameContainer;
|
||||
import org.newdawn.slick.Graphics;
|
||||
import yugecin.opsudance.core.DisplayContainer;
|
||||
import yugecin.opsudance.core.events.EventBus;
|
||||
import yugecin.opsudance.core.state.OverlayOpsuState;
|
||||
import yugecin.opsudance.events.BarNotificationEvent;
|
||||
import yugecin.opsudance.sbv2.movers.CubicStoryboardMover;
|
||||
import yugecin.opsudance.sbv2.movers.LinearStoryboardMover;
|
||||
import yugecin.opsudance.sbv2.movers.QuadraticStoryboardMover;
|
||||
|
@ -186,7 +186,7 @@ public class MoveStoryboard extends OverlayOpsuState{
|
|||
|
||||
private StoryboardMove getCurrentMoveOrCreateNew() {
|
||||
if (gameObjects[objectIndex].isSlider() && trackPosition > gameObjects[objectIndex].getTime() && trackPosition < gameObjects[objectIndex].getEndTime()) {
|
||||
UI.sendBarNotification("wait until the slider ended");
|
||||
EventBus.instance.post(new BarNotificationEvent("Wait until the slider ended"));
|
||||
return dummyMove;
|
||||
}
|
||||
if (moves[objectIndex] == null) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user