move bubble notification colors to Colors file

This commit is contained in:
yugecin
2017-05-26 21:44:23 +02:00
parent 1df25520e4
commit 42bc11ef75
20 changed files with 54 additions and 56 deletions

View File

@@ -26,6 +26,7 @@ import itdelatrisu.opsu.downloads.DownloadNode;
import itdelatrisu.opsu.downloads.Updater;
import itdelatrisu.opsu.render.CurveRenderState;
import itdelatrisu.opsu.replay.PlaybackSpeed;
import itdelatrisu.opsu.ui.Colors;
import itdelatrisu.opsu.ui.Cursor;
import itdelatrisu.opsu.ui.Fonts;
import itdelatrisu.opsu.ui.UI;
@@ -340,15 +341,13 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
return true;
}
if (DownloadList.get().hasActiveDownloads()) {
BubNotifListener.EVENT.make().onBubNotif(DownloadList.EXIT_CONFIRMATION,
BubNotifListener.COMMONCOLOR_RED);
BubNotifListener.EVENT.make().onBubNotif(DownloadList.EXIT_CONFIRMATION, Colors.BUB_RED);
exitRequested = false;
exitconfirmation = System.currentTimeMillis();
return false;
}
if (updater.getStatus() == Updater.Status.UPDATE_DOWNLOADING) {
BubNotifListener.EVENT.make().onBubNotif(Updater.EXIT_CONFIRMATION,
BubNotifListener.COMMONCOLOR_PURPLE);
BubNotifListener.EVENT.make().onBubNotif(Updater.EXIT_CONFIRMATION, Colors.BUB_PURPLE);
exitRequested = false;
exitconfirmation = System.currentTimeMillis();
return false;
@@ -387,8 +386,7 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
try {
setDisplayMode(width, height, OPTION_FULLSCREEN.state);
} catch (Exception e) {
BubNotifListener.EVENT.make().onBubNotif("Failed to change resolution",
BubNotifListener.COMMONCOLOR_RED);
BubNotifListener.EVENT.make().onBubNotif("Failed to change resolution", Colors.BUB_RED);
Log.error("Failed to set display mode.", e);
}
}
@@ -410,7 +408,7 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
fullscreen = false;
String msg = String.format("Fullscreen mode is not supported for %sx%s", width, height);
Log.warn(msg);
BubNotifListener.EVENT.make().onBubNotif(msg, BubNotifListener.COLOR_ORANGE);
BubNotifListener.EVENT.make().onBubNotif(msg, Colors.BUB_ORANGE);
}
}

View File

@@ -25,12 +25,6 @@ public interface BubNotifListener {
Event<BubNotifListener> EVENT = new Event<>(BubNotifListener.class);
public static final Color COMMONCOLOR_GREEN = new Color(98, 131, 59);
public static final Color COMMONCOLOR_WHITE = new Color(220, 220, 220);
public static final Color COMMONCOLOR_PURPLE = new Color(94, 46, 149);
public static final Color COMMONCOLOR_RED = new Color(141, 49, 16);
public static final Color COLOR_ORANGE = new Color(138, 72, 51);
void onBubNotif(String message, Color borderColor);
}

View File

@@ -24,6 +24,7 @@ import itdelatrisu.opsu.audio.SoundController;
import itdelatrisu.opsu.audio.SoundEffect;
import itdelatrisu.opsu.beatmap.Beatmap;
import itdelatrisu.opsu.beatmap.TimingPoint;
import itdelatrisu.opsu.ui.Colors;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
@@ -153,7 +154,7 @@ public class Configuration {
}
if (!defaultDir.isDirectory() && !defaultDir.mkdir()) {
String msg = String.format("Failed to create %s directory at '%s'.", kind, defaultDir.getAbsolutePath());
BubNotifListener.EVENT.make().onBubNotif(msg, BubNotifListener.COMMONCOLOR_RED);
BubNotifListener.EVENT.make().onBubNotif(msg, Colors.BUB_RED);
}
return defaultDir;
}
@@ -214,8 +215,7 @@ public class Configuration {
if (!screenshotDir.isDirectory() && !screenshotDir.mkdir()) {
BubNotifListener.EVENT.make().onBubNotif(
String.format( "Failed to create screenshot directory at '%s'.",
screenshotDir.getAbsolutePath()),
BubNotifListener.COMMONCOLOR_RED);
screenshotDir.getAbsolutePath()), Colors.BUB_RED);
return;
}
@@ -250,7 +250,7 @@ public class Configuration {
}
ImageIO.write(image, OPTION_SCREENSHOT_FORMAT.getValueString().toLowerCase(), file);
BubNotifListener.EVENT.make().onBubNotif("Created " + fileName,
BubNotifListener.COMMONCOLOR_PURPLE);
Colors.BUB_PURPLE);
} catch (Exception e) {
ErrorHandler.error("Failed to take a screenshot.", e).show();
}

View File

@@ -18,6 +18,7 @@
package yugecin.opsudance.options;
import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.ui.Colors;
import yugecin.opsudance.events.BubNotifListener;
public class NumericOption extends Option {
@@ -53,7 +54,7 @@ public class NumericOption extends Option {
val = Utils.clamp(Integer.parseInt(s), min, max);
} catch (Exception ignored) {
BubNotifListener.EVENT.make().onBubNotif("Failed to parse " + configurationName + " option",
BubNotifListener.COMMONCOLOR_RED);
Colors.BUB_RED);
}
}

View File

@@ -17,6 +17,7 @@
*/
package yugecin.opsudance.options;
import itdelatrisu.opsu.ui.Colors;
import org.newdawn.slick.util.Log;
import yugecin.opsudance.events.BubNotifListener;
@@ -79,7 +80,7 @@ public class OptionsService {
} catch (IOException e) {
String err = String.format("Failed to read option file '%s'.", config.OPTIONS_FILE.getAbsolutePath());
Log.error(err, e);
BubNotifListener.EVENT.make().onBubNotif(err, BubNotifListener.COMMONCOLOR_RED);
BubNotifListener.EVENT.make().onBubNotif(err, Colors.BUB_RED);
}
config.loadDirectories();
}
@@ -108,7 +109,7 @@ public class OptionsService {
} catch (IOException e) {
String err = String.format("Failed to write to file '%s'.", config.OPTIONS_FILE.getAbsolutePath());
Log.error(err, e);
BubNotifListener.EVENT.make().onBubNotif(err, BubNotifListener.COMMONCOLOR_RED);
BubNotifListener.EVENT.make().onBubNotif(err, Colors.BUB_RED);
}
}