From 6386cae19a1a0623bf03dc5bd375b096cd446959 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 28 Jun 2020 11:40:03 -0400 Subject: [PATCH] Launching dialog bugfixes & requirement display --- core/assets/bundles/bundle.properties | 2 + core/src/mindustry/core/Control.java | 4 +- .../ui/dialogs/LaunchLoadoutDialog.java | 37 ++++++++++-- .../mindustry/ui/dialogs/PlanetDialog.java | 56 ++++++++++++------- .../mindustry/world/modules/ItemModule.java | 4 ++ 5 files changed, 76 insertions(+), 27 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 96cf7fcb1b..3ea8a674a7 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -461,7 +461,9 @@ requirement.core = Destroy Enemy Core in {0} requirement.unlock = Unlock {0} resume = Resume Zone:\n[lightgray]{0} bestwave = [lightgray]Best Wave: {0} +#TODO fix/remove this launch = < LAUNCH > +launch.text = Launch launch.title = Launch Successful launch.next = [lightgray]next opportunity at wave {0} launch.unable2 = [scarlet]Unable to LAUNCH.[] diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index c85b6f1e85..e1432fad55 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -249,8 +249,8 @@ public class Control implements ApplicationListener, Loadable{ ent.lifetime(Vars.launchDuration); ent.add(); - //remove launch requirements from core - tile.items.remove(tile.block.requirements); + //remove schematic requirements from core + tile.items.remove(universe.getLastLoadout().requirements()); } public void playSector(Sector sector){ diff --git a/core/src/mindustry/ui/dialogs/LaunchLoadoutDialog.java b/core/src/mindustry/ui/dialogs/LaunchLoadoutDialog.java index 859b8a00ca..8a45169b77 100644 --- a/core/src/mindustry/ui/dialogs/LaunchLoadoutDialog.java +++ b/core/src/mindustry/ui/dialogs/LaunchLoadoutDialog.java @@ -5,6 +5,7 @@ import arc.scene.ui.*; import arc.scene.ui.layout.*; import mindustry.game.*; import mindustry.gen.*; +import mindustry.type.*; import mindustry.ui.*; import mindustry.ui.dialogs.SchematicsDialog.*; import mindustry.world.blocks.storage.*; @@ -14,6 +15,7 @@ import static mindustry.Vars.*; /** Dialog for selecting loadout at sector launch. */ public class LaunchLoadoutDialog extends BaseDialog{ Schematic selected; + boolean valid; public LaunchLoadoutDialog(){ super("$configure"); @@ -24,23 +26,44 @@ public class LaunchLoadoutDialog extends BaseDialog{ buttons.clear(); addCloseButton(); - buttons.button("$ok", () -> { + buttons.button("$launch.text", Icon.ok, () -> { universe.updateLoadout(core, selected); confirm.run(); hide(); - }); + }).disabled(b -> !valid); int cols = Math.max((int)(Core.graphics.getWidth() / Scl.scl(230)), 1); ButtonGroup