diff options
author | syeyoung <cyoung06@naver.com> | 2023-01-22 19:27:14 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2023-01-22 19:27:14 +0900 |
commit | a53885c974be3189c34806c85f684d450275c23a (patch) | |
tree | d85e865c84c1dfcaa5aa2364c381e128a35d3f53 /mod | |
parent | bab77894b18c80461fd1db2565d783aa0a9f7f49 (diff) | |
download | Skyblock-Dungeons-Guide-a53885c974be3189c34806c85f684d450275c23a.tar.gz Skyblock-Dungeons-Guide-a53885c974be3189c34806c85f684d450275c23a.tar.bz2 Skyblock-Dungeons-Guide-a53885c974be3189c34806c85f684d450275c23a.zip |
unmount handling
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod')
7 files changed, 37 insertions, 16 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/PlayerModelRenderer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/PlayerModelRenderer.java index e4e1e97c..123435ce 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/PlayerModelRenderer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/PlayerModelRenderer.java @@ -174,5 +174,6 @@ public class PlayerModelRenderer extends AnnotatedExportOnlyWidget implements La .closePopup(this.tooltip, null); this.tooltip = null; } + super.onUnmount(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetDataRendererWrapper.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetDataRendererWrapper.java index dc98feb5..04d16318 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetDataRendererWrapper.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetDataRendererWrapper.java @@ -108,5 +108,6 @@ public class WidgetDataRendererWrapper extends Widget implements Layouter, Rende .closePopup(this.tooltip, null); this.tooltip = null; } + super.onUnmount(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetPlayerInventory.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetPlayerInventory.java index 87d5077b..c29be21d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetPlayerInventory.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetPlayerInventory.java @@ -144,5 +144,6 @@ public class WidgetPlayerInventory extends Widget implements Renderer, Layouter .closePopup(this.tooltip, null); this.tooltip = null; } + super.onUnmount(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetProfileViewerData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetProfileViewerData.java index e1cf6ab7..d84e0c11 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetProfileViewerData.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetProfileViewerData.java @@ -114,20 +114,25 @@ public class WidgetProfileViewerData extends AnnotatedWidget { double x = abs.getX() + abs.getWidth(); double y = abs.getY(); - PopupMgr popupMgr = PopupMgr.getPopupMgr(getDomElement()); - Scaler scaler = new Scaler(); - scaler.scale.setValue((double) new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor()); - scaler.child.setValue(new WidgetPlayerInventory( - playerSkyblockData.getPlayerProfiles()[idx] - )); - popupMgr.openPopup(popup = new LocationedPopup(x, y, scaler), null); + if (popup == null) { + PopupMgr popupMgr = PopupMgr.getPopupMgr(getDomElement()); + Scaler scaler = new Scaler(); + scaler.scale.setValue((double) new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor()); + scaler.child.setValue(new WidgetPlayerInventory( + playerSkyblockData.getPlayerProfiles()[idx] + )); + popupMgr.openPopup(popup = new LocationedPopup(x, y, scaler), null); + } } @Override public void onUnmount() { PopupMgr popupMgr = PopupMgr.getPopupMgr(getDomElement()); - if (popup != null) + if (popup != null) { popupMgr.closePopup(popup, null); + popup = null; + } + super.onUnmount(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/WidgetSecret.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/WidgetSecret.java index 6e742703..899f07f9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/WidgetSecret.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/WidgetSecret.java @@ -67,18 +67,23 @@ public class WidgetSecret extends AnnotatedWidget { onSelect.accept(id); - PopupMgr popupMgr = PopupMgr.getPopupMgr(getDomElement()); - popupMgr.openPopup(popup = new LocationedPopup(x, y, new WidgetStateTooltip(room, mechanic, id)), (val) -> { - if (val == null) - onSelect.accept(null); - popup = null; - }); + if (popup == null) { + PopupMgr popupMgr = PopupMgr.getPopupMgr(getDomElement()); + popupMgr.openPopup(popup = new LocationedPopup(x, y, new WidgetStateTooltip(room, mechanic, id)), (val) -> { + if (val == null) + onSelect.accept(null); + popup = null; + }); + } } @Override public void onUnmount() { PopupMgr popupMgr = PopupMgr.getPopupMgr(getDomElement()); - if (popup != null) + if (popup != null) { popupMgr.closePopup(popup, "a"); + popup = null; + } + super.onUnmount(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/SelectiveContainer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/SelectiveContainer.java index 893865cb..da2cdb61 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/SelectiveContainer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/SelectiveContainer.java @@ -61,4 +61,12 @@ public class SelectiveContainer extends AnnotatedExportOnlyWidget { } return bindableAttribute; } + + @Override + public void onUnmount() { + for (BindableAttribute<Widget> value : widgetMap.values()) { + value.unexportAll(); + } + super.onUnmount(); + } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/AnnotatedExportOnlyWidget.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/AnnotatedExportOnlyWidget.java index 3b1d5bdf..70fd79a9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/AnnotatedExportOnlyWidget.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/AnnotatedExportOnlyWidget.java @@ -81,7 +81,7 @@ public abstract class AnnotatedExportOnlyWidget extends Widget implements Export } public void onUnmount() { - for (BindableAttribute value : exportedAttributes.values()) { + for (BindableAttribute value : getExportedAttributes().values()) { value.unexportAll(); } } |