Wave edit dialog cleanup
This commit is contained in:
@@ -69,41 +69,46 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
|
|
||||||
buttons.button("@waves.edit", () -> {
|
buttons.button("@waves.edit", Icon.pencil, () -> {
|
||||||
BaseDialog dialog = new BaseDialog("@waves.edit");
|
BaseDialog dialog = new BaseDialog("@waves.edit");
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
dialog.setFillParent(false);
|
dialog.setFillParent(false);
|
||||||
dialog.cont.defaults().size(210f, 64f);
|
dialog.cont.table(Tex.button, t -> {
|
||||||
dialog.cont.button("@waves.copy", () -> {
|
var style = Styles.cleart;
|
||||||
ui.showInfoFade("@waves.copied");
|
t.defaults().size(210f, 58f);
|
||||||
Core.app.setClipboardText(maps.writeWaves(groups));
|
|
||||||
dialog.hide();
|
t.button("@waves.copy", Icon.copy, style, () -> {
|
||||||
}).disabled(b -> groups == null);
|
ui.showInfoFade("@waves.copied");
|
||||||
dialog.cont.row();
|
Core.app.setClipboardText(maps.writeWaves(groups));
|
||||||
dialog.cont.button("@waves.load", () -> {
|
dialog.hide();
|
||||||
try{
|
}).disabled(b -> groups == null).marginLeft(12f).row();
|
||||||
groups = maps.readWaves(Core.app.getClipboardText());
|
|
||||||
|
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();
|
buildGroups();
|
||||||
}catch(Exception e){
|
dialog.hide();
|
||||||
e.printStackTrace();
|
})).marginLeft(12f).row();
|
||||||
ui.showErrorMessage("@waves.invalid");
|
|
||||||
}
|
t.button("@clear", Icon.cancel, style, () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> {
|
||||||
dialog.hide();
|
groups.clear();
|
||||||
}).disabled(b -> Core.app.getClipboardText() == null || Core.app.getClipboardText().isEmpty());
|
buildGroups();
|
||||||
dialog.cont.row();
|
dialog.hide();
|
||||||
dialog.cont.button("@settings.reset", () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> {
|
})).marginLeft(12f);
|
||||||
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.show();
|
dialog.show();
|
||||||
}).size(270f, 64f);
|
}).size(250f, 64f);
|
||||||
|
|
||||||
buttons.defaults().width(60f);
|
buttons.defaults().width(60f);
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ public class SpawnGroup implements JsonSerializable, Cloneable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SpawnGroup copy(){
|
public SpawnGroup copy(){
|
||||||
try {
|
try{
|
||||||
return (SpawnGroup)clone();
|
return (SpawnGroup)clone();
|
||||||
}catch(CloneNotSupportedException how){
|
}catch(CloneNotSupportedException how){
|
||||||
throw new RuntimeException("If you see this, what did you even do?", how);
|
throw new RuntimeException("If you see this, what did you even do?", how);
|
||||||
|
|||||||
Reference in New Issue
Block a user