From 72b132cecfd0ace07ac6495df6ac9d501ddb861b Mon Sep 17 00:00:00 2001 From: Tegas Aziz <49786146+WilloIzCitron@users.noreply.github.com> Date: Tue, 31 Dec 2024 11:46:06 +0700 Subject: [PATCH] tweak --- .../dialogs/ArchivDLive2DSelectionDialog.java | 29 ++++++++--- .../ui/overrides/ArchivDLoadingFragment.java | 49 ++++++++++--------- 2 files changed, 49 insertions(+), 29 deletions(-) diff --git a/src/bluearchive/ui/dialogs/ArchivDLive2DSelectionDialog.java b/src/bluearchive/ui/dialogs/ArchivDLive2DSelectionDialog.java index dc06953..eec3fdc 100644 --- a/src/bluearchive/ui/dialogs/ArchivDLive2DSelectionDialog.java +++ b/src/bluearchive/ui/dialogs/ArchivDLive2DSelectionDialog.java @@ -1,8 +1,8 @@ package bluearchive.ui.dialogs; import arc.Core; +import arc.scene.actions.Actions; import arc.scene.ui.*; -import arc.scene.ui.layout.*; import bluearchive.ui.ArchivDBackground; import mindustry.gen.*; import mindustry.graphics.*; @@ -10,17 +10,34 @@ public class ArchivDLive2DSelectionDialog extends Dialog { + private static TextButton a,b,c; public ArchivDLive2DSelectionDialog() { super(); row(); add(Core.bundle.get("ba-caution")).color(Pal.techBlue).style(Styles.techLabel).fontScale(2f).row(); image(Tex.whiteui, Pal.techBlue).width(450f).height(3f).pad(4f).center().row(); add(Core.bundle.get("ba-caution-text")).style(Styles.defaultLabel).row(); - TextButton a = button(Core.bundle.get("ba-l2dInstallLocally"), Icon.download, () -> { this.hide(); Core.settings.put("live2dinstalled", true);}).padLeft(8f).growX().padTop(3f).get(); - row(); - TextButton b = button(Core.bundle.get("ba-l2dInstallRepo"), Icon.download, ArchivDBackground::downloadLive2D).padLeft(8f).growX().padTop(3f).get(); - row(); - TextButton c = button(Core.bundle.get("cancel"), Icon.left, this::hide).padLeft(8f).padTop(3f).width(250f).get(); + table(t -> { + a = t.button(Core.bundle.get("ba-l2dInstallLocally"), Icon.download, () -> { this.hide(); Core.settings.put("live2dinstalled", true);}).padLeft(8f).padTop(3f).width(250f).get(); + b = t.button(Core.bundle.get("ba-l2dInstallRepo"), Icon.download, ArchivDBackground::downloadLive2D).padLeft(8f).padTop(3f).width(250f).get(); + c = t.button(Core.bundle.get("cancel"), Icon.left, this::hide).padLeft(8f).padTop(3f).width(250f).get(); + }).center(); show(); } + + @Override + public Dialog show() { + a.actions(Actions.fadeIn(1f), Actions.visible(true)); + b.actions(Actions.fadeIn(2f), Actions.visible(true)); + c.actions(Actions.fadeIn(3f), Actions.visible(true)); + return super.show(); + } + + @Override + public void hide() { + a.clearActions(); + b.clearActions(); + c.clearActions(); + super.hide(); + } } diff --git a/src/bluearchive/ui/overrides/ArchivDLoadingFragment.java b/src/bluearchive/ui/overrides/ArchivDLoadingFragment.java index 4a32adc..ac4ff47 100644 --- a/src/bluearchive/ui/overrides/ArchivDLoadingFragment.java +++ b/src/bluearchive/ui/overrides/ArchivDLoadingFragment.java @@ -10,7 +10,7 @@ import arc.scene.ui.*; import arc.scene.ui.layout.*; import arc.util.Nullable; -import mindustry.Vars; +import mindustry.gen.*; import mindustry.graphics.*; import mindustry.ui.*; import mindustry.ui.fragments.*; @@ -20,26 +20,30 @@ public class ArchivDLoadingFragment extends LoadingFragment { private Table table; - private TextButton button; + private static TextButton button; private Bar bar; - private Label nameLabel; + private static Label nameLabel; private float progValue; private Label tooltipTitle; private Label tooltipInfo; - private static float scale; public static boolean loadFragShow; + private static Table tabl; public static void init() { ui.loadfrag = new ArchivDLoadingFragment(); ui.loadfrag.build(Core.scene.root); - if(!mobile){ - scale = 45f; - } else { - scale = 60f; - } } public void build(Group parent){ + if(tabl == null) { + tabl = new Table(table -> { + nameLabel = table.add("@loading").color(Pal.techBlue).pad(10f).style(Styles.techLabel).left().get(); + table.image(Tex.clear).growX(); + button = table.button("@cancel", () -> { + }).size(250f, 50f).visible(false).right().get(); + updateLabel(false, "@loading"); + }); + } parent.fill(t -> { //rect must fill screen completely. t.rect((x, y, w, h) -> { @@ -48,23 +52,21 @@ public void build(Group parent){ }); t.visible = false; t.touchable = Touchable.enabled; - t.add().height((Core.graphics.getHeight())/ 2f).row(); - t.row(); - tooltipTitle = t.add("Lorem Ipsum").color(Pal.techBlue).fontScale(1.5f).style(Styles.techLabel).pad(10).left().get(); - t.row(); - tooltipInfo = t.add("Line1\nline2\nline3\n").pad(10).left().get(); - t.row(); - t.add().height((Core.graphics.getHeight() - scale)/2f).row(); - t.row(); - nameLabel = t.add("@loading").color(Pal.techBlue).pad(10f).style(Styles.techLabel).left().get(); + t.add().growY(); t.row(); - t.add(new WarningBar()).color(Pal.techBlue).growX().height(24f); + t.table(a -> { + tooltipTitle = a.add("Lorem Ipsum").color(Pal.techBlue).fontScale(1.5f).style(Styles.techLabel).pad(10).left().get(); + a.row(); + tooltipInfo = a.add("Line1\nline2\nline3\n").pad(10).left().get(); + }).left().row(); + t.add().growY(); t.row(); - updateLabel(false,"@loading"); - bar = t.add(new Bar()).pad(3).padTop(6).height(40f).growX().visible(false).get(); + if(tabl != null) t.add(tabl).growX(); t.row(); - button = t.button("@cancel", () -> { - }).size(250f, 50f).visible(false).get(); + t.table(a -> { + a.add(new WarningBar()).color(Pal.techBlue).growX().height(24f).row(); + bar = a.add(new Bar()).pad(3).padTop(6).height(40f).growX().visible(false).get(); + }).bottom().growX().row(); table = t; }); } @@ -127,6 +129,7 @@ public void hide(){ table.toFront(); table.touchable = Touchable.disabled; table.actions(Actions.fadeOut(0.5f), Actions.visible(false)); + tabl = null; loadFragShow = false; }