From ae0a70703b05ac27b7f03307f4082063c689de59 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 9 Sep 2021 22:25:08 -0400 Subject: [PATCH] Wave edit dialog cleanup --- core/src/mindustry/editor/WaveInfoDialog.java | 65 ++++++++++--------- core/src/mindustry/game/SpawnGroup.java | 2 +- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/core/src/mindustry/editor/WaveInfoDialog.java b/core/src/mindustry/editor/WaveInfoDialog.java index 9f3dc474aa..d6588b3279 100644 --- a/core/src/mindustry/editor/WaveInfoDialog.java +++ b/core/src/mindustry/editor/WaveInfoDialog.java @@ -69,41 +69,46 @@ public class WaveInfoDialog extends BaseDialog{ addCloseButton(); - buttons.button("@waves.edit", () -> { + buttons.button("@waves.edit", Icon.pencil, () -> { BaseDialog dialog = new BaseDialog("@waves.edit"); dialog.addCloseButton(); dialog.setFillParent(false); - dialog.cont.defaults().size(210f, 64f); - dialog.cont.button("@waves.copy", () -> { - ui.showInfoFade("@waves.copied"); - Core.app.setClipboardText(maps.writeWaves(groups)); - dialog.hide(); - }).disabled(b -> groups == null); - dialog.cont.row(); - dialog.cont.button("@waves.load", () -> { - try{ - groups = maps.readWaves(Core.app.getClipboardText()); + dialog.cont.table(Tex.button, t -> { + var style = Styles.cleart; + t.defaults().size(210f, 58f); + + t.button("@waves.copy", Icon.copy, style, () -> { + ui.showInfoFade("@waves.copied"); + Core.app.setClipboardText(maps.writeWaves(groups)); + dialog.hide(); + }).disabled(b -> groups == null).marginLeft(12f).row(); + + t.button("@waves.load", Icon.download, style, () -> { + try{ + groups = maps.readWaves(Core.app.getClipboardText()); + buildGroups(); + }catch(Exception e){ + e.printStackTrace(); + ui.showErrorMessage("@waves.invalid"); + } + dialog.hide(); + }).marginLeft(12f).disabled(b -> Core.app.getClipboardText() == null || Core.app.getClipboardText().isEmpty()).row(); + + t.button("@settings.reset", Icon.upload, style, () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> { + groups = JsonIO.copy(waves.get()); buildGroups(); - }catch(Exception e){ - e.printStackTrace(); - ui.showErrorMessage("@waves.invalid"); - } - dialog.hide(); - }).disabled(b -> Core.app.getClipboardText() == null || Core.app.getClipboardText().isEmpty()); - dialog.cont.row(); - dialog.cont.button("@settings.reset", () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> { - groups = JsonIO.copy(waves.get()); - buildGroups(); - dialog.hide(); - })); - dialog.cont.row(); - dialog.cont.button("@clear", () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> { - groups.clear(); - buildGroups(); - dialog.hide(); - })); + dialog.hide(); + })).marginLeft(12f).row(); + + t.button("@clear", Icon.cancel, style, () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> { + groups.clear(); + buildGroups(); + dialog.hide(); + })).marginLeft(12f); + }); + dialog.show(); - }).size(270f, 64f); + }).size(250f, 64f); buttons.defaults().width(60f); diff --git a/core/src/mindustry/game/SpawnGroup.java b/core/src/mindustry/game/SpawnGroup.java index 0c93a71820..c814f0a925 100644 --- a/core/src/mindustry/game/SpawnGroup.java +++ b/core/src/mindustry/game/SpawnGroup.java @@ -158,7 +158,7 @@ public class SpawnGroup implements JsonSerializable, Cloneable{ } public SpawnGroup copy(){ - try { + try{ return (SpawnGroup)clone(); }catch(CloneNotSupportedException how){ throw new RuntimeException("If you see this, what did you even do?", how);