From c84ec75c53b6af68dd90fdceb6b185added7a68a Mon Sep 17 00:00:00 2001 From: JniTrRny <85090668+JniTrRny@users.noreply.github.com> Date: Fri, 2 Jun 2023 22:37:15 +0700 Subject: [PATCH] Improvements to the Schematics UI (#8605) * schematics UI improvements * better edit tags UI * visual tweaks * cleanup inline obsession cleanup again... another little bit of cleanup a little bit of cleanup minor cleanup --- core/assets/bundles/bundle.properties | 8 +- .../src/mindustry/editor/MapEditorDialog.java | 2 +- core/src/mindustry/editor/MapLoadDialog.java | 51 ++- core/src/mindustry/editor/WaveInfoDialog.java | 58 ++-- .../mindustry/maps/filters/FilterOption.java | 4 +- .../ui/dialogs/SchematicsDialog.java | 312 ++++++++++-------- .../mindustry/world/blocks/ItemSelection.java | 6 +- 7 files changed, 234 insertions(+), 207 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index c7f7921ae2..0ab09b4ec9 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -57,6 +57,7 @@ mods.browser.sortstars = Sort by stars schematic = Schematic schematic.add = Save Schematic... schematics = Schematics +schematic.search = Search schematics... schematic.replace = A schematic by that name already exists. Replace it? schematic.exists = A schematic by that name already exists. schematic.import = Import Schematic... @@ -69,7 +70,7 @@ schematic.shareworkshop = Share on Workshop schematic.flip = [accent][[{0}][]/[accent][[{1}][]: Flip Schematic schematic.saved = Schematic saved. schematic.delete.confirm = This schematic will be utterly eradicated. -schematic.rename = Rename Schematic +schematic.edit = Edit Schematic schematic.info = {0}x{1}, {2} blocks schematic.disabled = [scarlet]Schematics disabled[]\nYou are not allowed to use schematics on this [accent]map[] or [accent]server. schematic.tags = Tags: @@ -78,6 +79,7 @@ schematic.addtag = Add Tag schematic.texttag = Text Tag schematic.icontag = Icon Tag schematic.renametag = Rename Tag +schematic.tagged = {0} tagged schematic.tagdelconfirm = Delete this tag completely? schematic.tagexists = That tag already exists. @@ -463,7 +465,7 @@ waves.sort.begin = Begin waves.sort.health = Health waves.sort.type = Type waves.search = Search waves... -waves.filter.unit = Unit Filter +waves.filter = Unit Filter waves.units.hide = Hide All waves.units.show = Show All @@ -1791,7 +1793,7 @@ hint.launch = Once enough resources are collected, you can [accent]Launch[] by s hint.launch.mobile = Once enough resources are collected, you can [accent]Launch[] by selecting nearby sectors from the \uE827 [accent]Map[] in the \uE88C [accent]Menu[]. hint.schematicSelect = Hold [accent][[F][] and drag to select blocks to copy and paste.\n\n[accent][[Middle Click][] to copy a single block type. hint.rebuildSelect = Hold [accent][[B][] and drag to select destroyed block plans.\nThis will rebuild them automatically. -hint.rebuildSelect.mobile = Select the \ue874 copy button, then tap the \ue80f rebuild button and drag to select destroyed block plans.\nThis will rebuild them automatically. +hint.rebuildSelect.mobile = Select the \uE874 copy button, then tap the \uE80F rebuild button and drag to select destroyed block plans.\nThis will rebuild them automatically. hint.conveyorPathfind = Hold [accent][[L-Ctrl][] while dragging conveyors to automatically generate a path. hint.conveyorPathfind.mobile = Enable \uE844 [accent]diagonal mode[] and drag conveyors to automatically generate a path. hint.boost = Hold [accent][[L-Shift][] to fly over obstacles with your current unit.\n\nOnly a few ground units have boosters. diff --git a/core/src/mindustry/editor/MapEditorDialog.java b/core/src/mindustry/editor/MapEditorDialog.java index 1d30d18d82..0010346f9a 100644 --- a/core/src/mindustry/editor/MapEditorDialog.java +++ b/core/src/mindustry/editor/MapEditorDialog.java @@ -803,7 +803,7 @@ public class MapEditorDialog extends Dialog implements Disposable{ } if(i == 0){ - blockSelection.add("@none.found").color(Color.lightGray).padLeft(54f).padTop(10f); + blockSelection.add("@none.found").padLeft(54f).padTop(10f); } } } diff --git a/core/src/mindustry/editor/MapLoadDialog.java b/core/src/mindustry/editor/MapLoadDialog.java index 1217c87020..46b98e037d 100644 --- a/core/src/mindustry/editor/MapLoadDialog.java +++ b/core/src/mindustry/editor/MapLoadDialog.java @@ -1,9 +1,11 @@ package mindustry.editor; +import arc.*; import arc.func.*; import arc.scene.ui.*; import arc.scene.ui.layout.*; import arc.util.*; +import mindustry.gen.*; import mindustry.maps.*; import mindustry.ui.*; import mindustry.ui.dialogs.*; @@ -11,65 +13,60 @@ import mindustry.ui.dialogs.*; import static mindustry.Vars.*; public class MapLoadDialog extends BaseDialog{ - private Map selected = null; + private @Nullable Map selected = null; public MapLoadDialog(Cons loader){ super("@editor.loadmap"); shown(this::rebuild); + hidden(() -> selected = null); + onResize(this::rebuild); - TextButton button = new TextButton("@load"); - button.setDisabled(() -> selected == null); - button.clicked(() -> { + buttons.defaults().size(210f, 64f); + buttons.button("@cancel", Icon.cancel, this::hide); + buttons.button("@load", Icon.ok, () -> { if(selected != null){ loader.get(selected); hide(); } - }); - - buttons.defaults().size(200f, 50f); - buttons.button("@cancel", this::hide); - buttons.add(button); + }).disabled(b -> selected == null); addCloseListener(); + makeButtonOverlay(); } public void rebuild(){ cont.clear(); - if(maps.all().size > 0){ - selected = maps.all().first(); - } - - ButtonGroup group = new ButtonGroup<>(); - - int maxcol = 3; + ButtonGroup