From 7a7bc9833293dc7b404fbfe3b4cea860a3038bb9 Mon Sep 17 00:00:00 2001 From: MEEP of Faith Date: Wed, 2 Mar 2022 00:05:29 -0800 Subject: [PATCH 1/5] Read the damn disclaimer --- main/src/unity/Unity.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/main/src/unity/Unity.java b/main/src/unity/Unity.java index 4aeccdcf..0404007b 100644 --- a/main/src/unity/Unity.java +++ b/main/src/unity/Unity.java @@ -1,12 +1,16 @@ package unity; import arc.*; +import arc.scene.actions.*; +import arc.scene.ui.*; +import arc.scene.ui.layout.*; import arc.struct.*; import arc.util.*; import mindustry.*; import mindustry.ctype.*; import mindustry.game.EventType.*; import mindustry.mod.*; +import mindustry.ui.dialogs.*; import mindustry.world.blocks.environment.*; import unity.annotations.Annotations.*; import unity.content.*; @@ -64,7 +68,22 @@ public Unity(boolean tools){ // Disclaimer, because apparently we're stupid enough to need this Events.on(ClientLoadEvent.class, e -> { UnitySettings.init(); - Vars.ui.showOkText("@mod.disclaimer.title", "@mod.disclaimer.text", () -> {}); + //Vars.ui.showOkText("@mod.disclaimer.title", "@mod.disclaimer.text", () -> {}); + BaseDialog dialog = new BaseDialog("@mod.disclaimer.title"); + dialog.cont.add("@mod.disclaimer.text").width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center); + dialog.buttons.defaults().size(200f, 54f).pad(2f); + dialog.setFillParent(false); + TextButton b = dialog.buttons.button("@ok", dialog::hide).get(); + //Add a delay to when the ok button can be pressed. Read the damn disclaimer and don't ignore it like you do with every terms and conditions list you see. + b.setDisabled(() -> b.color.a < 1); + b.actions( + Actions.alpha(0), + Actions.delay(5), + Actions.fadeIn(3) + ); + b.getStyle().disabledFontColor = b.getStyle().fontColor; + b.getStyle().disabled = b.getStyle().up; + dialog.show(); //bc they are not a contentType ModularPartType.loadStatic(); From 5d719ad1b10d3b4e4b785a9cf17e34ca0f22d2b1 Mon Sep 17 00:00:00 2001 From: "Matthew, Maya, or MEEP" <54301439+MEEPofFaith@users.noreply.github.com> Date: Wed, 2 Mar 2022 00:16:47 -0800 Subject: [PATCH 2/5] "Make it 10 seconds" -Thirsty --- main/src/unity/Unity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/src/unity/Unity.java b/main/src/unity/Unity.java index 0404007b..46a715db 100644 --- a/main/src/unity/Unity.java +++ b/main/src/unity/Unity.java @@ -78,8 +78,8 @@ public Unity(boolean tools){ b.setDisabled(() -> b.color.a < 1); b.actions( Actions.alpha(0), - Actions.delay(5), - Actions.fadeIn(3) + Actions.delay(10), + Actions.fadeIn(2) ); b.getStyle().disabledFontColor = b.getStyle().fontColor; b.getStyle().disabled = b.getStyle().up; From 0cbefcf3e9b7ef7b428915a76db72adf626ca187 Mon Sep 17 00:00:00 2001 From: MEEP of Faith Date: Wed, 2 Mar 2022 09:39:41 -0800 Subject: [PATCH 3/5] Skipping --- main/assets/bundles/bundle.properties | 3 +- main/src/unity/Unity.java | 17 +--------- main/src/unity/ui/DisclaimerDialog.java | 42 +++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 main/src/unity/ui/DisclaimerDialog.java diff --git a/main/assets/bundles/bundle.properties b/main/assets/bundles/bundle.properties index 5855f8dd..faff0ac2 100644 --- a/main/assets/bundles/bundle.properties +++ b/main/assets/bundles/bundle.properties @@ -11,6 +11,7 @@ mod.tester = Testers mod.disclaimer.title = [scarlet]Disclaimer[] mod.disclaimer.text = This public [accent]Project Unity[] release is unfinished with lots of content yet to be published and/or balanced, its purpose is to help with development by collecting public feedback regarding technical, artistic or balancing matters.\n[scarlet]this mod is not to meant to be played[]. +mod.disclaimer.skip = OK (Don't delay again) link.avant-discord.title = Discord link.avant-discord.description = The official Avant team Discord server @@ -263,4 +264,4 @@ exp.pregrade = Requires [#84ff00]level {0}[] {1} exp.upgradefrom = Upgrades from [accent]level {0}[] {1} exp.reduction = Damage Reduction {0} ui.graph.label = [lightgray][accent]{1}[] at level [white]{0}[][] -ui.graph.hover = [lightgray]Hover over the graph...[] \ No newline at end of file +ui.graph.hover = [lightgray]Hover over the graph...[] diff --git a/main/src/unity/Unity.java b/main/src/unity/Unity.java index 46a715db..87dd0a43 100644 --- a/main/src/unity/Unity.java +++ b/main/src/unity/Unity.java @@ -68,22 +68,7 @@ public Unity(boolean tools){ // Disclaimer, because apparently we're stupid enough to need this Events.on(ClientLoadEvent.class, e -> { UnitySettings.init(); - //Vars.ui.showOkText("@mod.disclaimer.title", "@mod.disclaimer.text", () -> {}); - BaseDialog dialog = new BaseDialog("@mod.disclaimer.title"); - dialog.cont.add("@mod.disclaimer.text").width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center); - dialog.buttons.defaults().size(200f, 54f).pad(2f); - dialog.setFillParent(false); - TextButton b = dialog.buttons.button("@ok", dialog::hide).get(); - //Add a delay to when the ok button can be pressed. Read the damn disclaimer and don't ignore it like you do with every terms and conditions list you see. - b.setDisabled(() -> b.color.a < 1); - b.actions( - Actions.alpha(0), - Actions.delay(10), - Actions.fadeIn(2) - ); - b.getStyle().disabledFontColor = b.getStyle().fontColor; - b.getStyle().disabled = b.getStyle().up; - dialog.show(); + new DisclaimerDialog().show(); //bc they are not a contentType ModularPartType.loadStatic(); diff --git a/main/src/unity/ui/DisclaimerDialog.java b/main/src/unity/ui/DisclaimerDialog.java new file mode 100644 index 00000000..91560889 --- /dev/null +++ b/main/src/unity/ui/DisclaimerDialog.java @@ -0,0 +1,42 @@ +package unity.ui; + +import arc.scene.actions.*; +import arc.scene.ui.*; +import arc.util.*; +import mindustry.ui.dialogs.*; +import unity.*; + +import static arc.Core.*; + +public class DisclaimerDialog extends BaseDialog{ + public DisclaimerDialog(){ + super("@mod.disclaimer.title"); + cont.add("@mod.disclaimer.text").width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center); + buttons.defaults().size(200f, 54f).pad(2f); + setFillParent(false); + delayButton("@ok", this::hide, 8, 5); + if(shouldSkip()) return; + delayButton("@mod.disclaimer.skip", () -> { + hide(); + settings.put("mod.disclaimer.skip", true); + }, 17, 5); + } + + void delayButton(String text, Runnable listener, float delay, float fadeTime){ + TextButton b = buttons.button(text, listener).get(); + if(shouldSkip()) return; + //Add a delay to when the ok button can be pressed. Read the damn disclaimer and don't ignore it like you do with every terms and conditions list you see. + b.setDisabled(() -> b.color.a < 1); + b.actions( + Actions.alpha(0), + Actions.delay(delay), + Actions.fadeIn(fadeTime) + ); + b.getStyle().disabledFontColor = b.getStyle().fontColor; + b.getStyle().disabled = b.getStyle().up; + } + + boolean shouldSkip(){ + return settings.getBool("mod.disclaimer.skip", false) || Unity.dev.isDev(); + } +} From 2052fee2c7b3ee68ca1755827f75296d9cc74a53 Mon Sep 17 00:00:00 2001 From: MEEP of Faith Date: Thu, 3 Mar 2022 19:19:58 -0800 Subject: [PATCH 4/5] Sliiiide to the left Take it back now yall --- main/src/unity/ui/DisclaimerDialog.java | 37 ++++++++++++++++--------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/main/src/unity/ui/DisclaimerDialog.java b/main/src/unity/ui/DisclaimerDialog.java index 91560889..3e655ccd 100644 --- a/main/src/unity/ui/DisclaimerDialog.java +++ b/main/src/unity/ui/DisclaimerDialog.java @@ -1,7 +1,9 @@ package unity.ui; +import arc.math.*; import arc.scene.actions.*; import arc.scene.ui.*; +import arc.scene.ui.layout.*; import arc.util.*; import mindustry.ui.dialogs.*; import unity.*; @@ -14,26 +16,35 @@ public DisclaimerDialog(){ cont.add("@mod.disclaimer.text").width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center); buttons.defaults().size(200f, 54f).pad(2f); setFillParent(false); - delayButton("@ok", this::hide, 8, 5); - if(shouldSkip()) return; - delayButton("@mod.disclaimer.skip", () -> { - hide(); - settings.put("mod.disclaimer.skip", true); - }, 17, 5); - } - void delayButton(String text, Runnable listener, float delay, float fadeTime){ - TextButton b = buttons.button(text, listener).get(); + TextButton b = buttons.button("@ok", this::hide).get(); + if(shouldSkip()) return; - //Add a delay to when the ok button can be pressed. Read the damn disclaimer and don't ignore it like you do with every terms and conditions list you see. + b.setDisabled(() -> b.color.a < 1); + float moveDst = Scl.scl(101f); //Half button width + Half pad b.actions( - Actions.alpha(0), - Actions.delay(delay), - Actions.fadeIn(fadeTime) + Actions.alpha(0), Actions.moveBy(moveDst, 0f), + Actions.delay(8f), + Actions.fadeIn(5f), + Actions.delay(4f), + Actions.moveBy(-moveDst, 0f, 5f, Interp.smoother) ); b.getStyle().disabledFontColor = b.getStyle().fontColor; b.getStyle().disabled = b.getStyle().up; + + TextButton s = buttons.button("@mod.disclaimer.skip", () -> { + hide(); + settings.put("mod.disclaimer.skip", true); + }).get(); + s.setDisabled(() -> s.color.a < 1); + s.actions( + Actions.alpha(0), + Actions.delay(17f), + Actions.fadeIn(5f) + ); + s.getStyle().disabledFontColor = s.getStyle().fontColor; + s.getStyle().disabled = s.getStyle().up; } boolean shouldSkip(){ From 7b5523589a30e7cccd09df3050c78c737778563e Mon Sep 17 00:00:00 2001 From: MEEP of Faith Date: Thu, 3 Mar 2022 19:26:27 -0800 Subject: [PATCH 5/5] greeeammrrr [mild annoyance noises] --- main/assets/bundles/bundle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/assets/bundles/bundle.properties b/main/assets/bundles/bundle.properties index faff0ac2..27441567 100644 --- a/main/assets/bundles/bundle.properties +++ b/main/assets/bundles/bundle.properties @@ -10,7 +10,7 @@ mod.translator = Translators mod.tester = Testers mod.disclaimer.title = [scarlet]Disclaimer[] -mod.disclaimer.text = This public [accent]Project Unity[] release is unfinished with lots of content yet to be published and/or balanced, its purpose is to help with development by collecting public feedback regarding technical, artistic or balancing matters.\n[scarlet]this mod is not to meant to be played[]. +mod.disclaimer.text = This public [accent]Project Unity[] release is unfinished with lots of content yet to be published and/or balanced, its purpose is to help with development by collecting public feedback regarding technical, artistic or balancing matters.\n[scarlet]This mod is not to meant to be played[]. mod.disclaimer.skip = OK (Don't delay again) link.avant-discord.title = Discord