diff options
author | syeyoung <cyoung06@naver.com> | 2023-02-05 02:18:35 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2023-02-05 02:18:35 +0900 |
commit | f0a3834c92cc3d3da92998a6610d607f4034a44b (patch) | |
tree | 19cfaf47f90cab5b3585375675933b74efdac7d3 /loader/src/main/java/kr/syeyoung/dungeonsguide | |
parent | eaf7078a48ea04680e3743a1563c581c043fc3c5 (diff) | |
download | Skyblock-Dungeons-Guide-f0a3834c92cc3d3da92998a6610d607f4034a44b.tar.gz Skyblock-Dungeons-Guide-f0a3834c92cc3d3da92998a6610d607f4034a44b.tar.bz2 Skyblock-Dungeons-Guide-f0a3834c92cc3d3da92998a6610d607f4034a44b.zip |
- auto closing tooltip
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'loader/src/main/java/kr/syeyoung/dungeonsguide')
7 files changed, 6 insertions, 27 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java index 42d5244d..e4adbf94 100755 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java @@ -104,7 +104,6 @@ public class Main .onClick(() -> { GuiDisplayer.INSTANCE.displayGui(new GuiChooseVersion(new RuntimeException("just unloaded"))); }) - .unremovable(true) .build())); try { @@ -169,7 +168,6 @@ public class Main .onClick(() -> { GuiDisplayer.INSTANCE.displayGui(new GuiChooseVersion(new RuntimeException("just unloaded"))); }) - .unremovable(true) .build())); if (currentLoader != null) { currentLoader.unloadDungeonsGuide(); diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java index 6c8fa7bc..9a491b08 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java @@ -144,7 +144,6 @@ public class AuthManager { .title("Privacy Policy") .description("Please accept Dungeons Guide\nPrivacy Policy to enjoy server based\nfeatures of Dungeons Guide\n\n(Including Auto-Update/Remote-Jar)") .titleColor(0xFFFF0000) - .unremovable(true) .onClick(() -> { GuiDisplayer.INSTANCE.displayGui(new GuiPrivacyPolicy()); }) @@ -155,7 +154,6 @@ public class AuthManager { .title("Auth Error") .description("Authentication Error Occurred\n"+e.getMessage()) .titleColor(0xFFFF0000) - .unremovable(true) .onClick(() -> { GuiDisplayer.INSTANCE.displayGui(new GuiLoadingError(e)); }) @@ -189,7 +187,6 @@ public class AuthManager { .title("Privacy Policy") .description("Please accept the Dungeons Guide\nPrivacy Policy to enjoy server based\nfeatures of Dungeons Guide\n\n(Including Auto-Update/Remote-Jar)") .titleColor(0xFFFF0000) - .unremovable(true) .onClick(() -> { GuiDisplayer.INSTANCE.displayGui(new GuiPrivacyPolicy()); }) @@ -200,7 +197,6 @@ public class AuthManager { .title("Auth Error") .description("Authentication Error Occurred\n"+e.getMessage()) .titleColor(0xFFFF0000) - .unremovable(true) .onClick(() -> { GuiDisplayer.INSTANCE.displayGui(new GuiLoadingError(e)); }) diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiChooseVersion.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiChooseVersion.java index 27954eca..e42e45dc 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiChooseVersion.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiChooseVersion.java @@ -26,6 +26,7 @@ import kr.syeyoung.dungeonsguide.launcher.branch.UpdateRetrieverUtil; import kr.syeyoung.dungeonsguide.launcher.gui.tooltip.Notification; import kr.syeyoung.dungeonsguide.launcher.gui.tooltip.NotificationManager; import kr.syeyoung.dungeonsguide.launcher.gui.tooltip.WidgetNotification; +import kr.syeyoung.dungeonsguide.launcher.gui.tooltip.WidgetNotificationAutoClose; import kr.syeyoung.dungeonsguide.launcher.loader.JarLoader; import kr.syeyoung.dungeonsguide.launcher.loader.LocalLoader; import kr.syeyoung.dungeonsguide.launcher.loader.RemoteLoader; @@ -161,11 +162,11 @@ public class GuiChooseVersion extends SpecialGuiScreen { UUID random = UUID.randomUUID(); NotificationManager.getInstance().updateNotification(random, - new WidgetNotification(random, Notification.builder() + new WidgetNotificationAutoClose(random, Notification.builder() .title("Successfully Copied!") .description("") .titleColor(0xFF00FF00) - .build())); + .build(), 5000L)); } else if (button.id == 0) { dismiss(); Main.getMain().tryReloadingWithSplash(new LocalLoader()); diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiLoadingError.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiLoadingError.java index d3622464..9b8390bd 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiLoadingError.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/GuiLoadingError.java @@ -21,6 +21,7 @@ package kr.syeyoung.dungeonsguide.launcher.gui.screen; import kr.syeyoung.dungeonsguide.launcher.gui.tooltip.Notification; import kr.syeyoung.dungeonsguide.launcher.gui.tooltip.NotificationManager; import kr.syeyoung.dungeonsguide.launcher.gui.tooltip.WidgetNotification; +import kr.syeyoung.dungeonsguide.launcher.gui.tooltip.WidgetNotificationAutoClose; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -71,11 +72,11 @@ public class GuiLoadingError extends SpecialGuiScreen { ); UUID uuid = UUID.randomUUID(); - NotificationManager.getInstance().updateNotification(uuid, new WidgetNotification(uuid, Notification.builder() + NotificationManager.getInstance().updateNotification(uuid, new WidgetNotificationAutoClose(uuid, Notification.builder() .title("Successfully Copied!") .description("") .titleColor(0xFF00FF00) - .build())); + .build(), 5000L)); } } diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/Notification.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/Notification.java index c46e8a68..11cd66ec 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/Notification.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/Notification.java @@ -30,7 +30,6 @@ public class Notification { private String description; private Runnable onClick; - private boolean unremovable; private Rectangle boundRect; diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/WidgetNotification.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/WidgetNotification.java index 8683b4fd..b61aa701 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/WidgetNotification.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/WidgetNotification.java @@ -36,8 +36,6 @@ public class WidgetNotification extends AnnotatedImportOnlyWidget { public final BindableAttribute<String> description = new BindableAttribute<>(String.class); @Bind(variableName = "color") public final BindableAttribute<Integer> color = new BindableAttribute<>(Integer.class); - @Bind(variableName = "closeVisibility") - public final BindableAttribute<String> closeVisibility = new BindableAttribute<>(String.class); private UUID uuid; public WidgetNotification(UUID uuid, Notification notification) { @@ -46,16 +44,9 @@ public class WidgetNotification extends AnnotatedImportOnlyWidget { title.setValue(notification.getTitle()); color.setValue(notification.getTitleColor()); description.setValue(notification.getDescription()); - closeVisibility.setValue(notification.isUnremovable() ? "hide" : "show"); this.uuid = uuid; } - @On(functionName = "close") - public void close() { - if (!notification.isUnremovable()) - NotificationManager.getInstance().removeNotification(uuid); - } - @Override public boolean mouseClicked(int absMouseX, int absMouseY, double relMouseX, double relMouseY, int mouseButton) { if (notification.getOnClick() != null) notification.getOnClick().run(); diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/WidgetNotificationAutoClose.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/WidgetNotificationAutoClose.java index 90e2359b..31a18ef4 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/WidgetNotificationAutoClose.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/WidgetNotificationAutoClose.java @@ -57,18 +57,11 @@ public class WidgetNotificationAutoClose extends AnnotatedImportOnlyWidget imple title.setValue(notification.getTitle()); color.setValue(notification.getTitleColor()); description.setValue(notification.getDescription()); - closeVisibility.setValue(notification.isUnremovable() ? "hide" : "show"); this.uuid = uuid; this.delay = delay; } - @On(functionName = "close") - public void close() { - if (!notification.isUnremovable()) - NotificationManager.getInstance().removeNotification(uuid); - } - @Override public boolean mouseClicked(int absMouseX, int absMouseY, double relMouseX, double relMouseY, int mouseButton) { if (notification.getOnClick() != null) notification.getOnClick().run(); |