Renamed key fields and table methods
This commit is contained in:
@@ -66,28 +66,28 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
menu.cont.table(t -> {
|
||||
t.defaults().size(swidth, 60f).padBottom(5).padRight(5).padLeft(5);
|
||||
|
||||
t.addImageTextButton("$editor.savemap", Icon.save, this::save);
|
||||
t.button("$editor.savemap", Icon.save, this::save);
|
||||
|
||||
t.addImageTextButton("$editor.mapinfo", Icon.pencil, () -> {
|
||||
t.button("$editor.mapinfo", Icon.pencil, () -> {
|
||||
infoDialog.show();
|
||||
menu.hide();
|
||||
});
|
||||
|
||||
t.row();
|
||||
|
||||
t.addImageTextButton("$editor.generate", Icon.terrain, () -> {
|
||||
t.button("$editor.generate", Icon.terrain, () -> {
|
||||
generateDialog.show(generateDialog::applyToEditor);
|
||||
menu.hide();
|
||||
});
|
||||
|
||||
t.addImageTextButton("$editor.resize", Icon.resize, () -> {
|
||||
t.button("$editor.resize", Icon.resize, () -> {
|
||||
resizeDialog.show();
|
||||
menu.hide();
|
||||
});
|
||||
|
||||
t.row();
|
||||
|
||||
t.addImageTextButton("$editor.import", Icon.download, () -> createDialog("$editor.import",
|
||||
t.button("$editor.import", Icon.download, () -> createDialog("$editor.import",
|
||||
"$editor.importmap", "$editor.importmap.description", Icon.download, (Runnable)loadDialog::show,
|
||||
"$editor.importfile", "$editor.importfile.description", Icon.file, (Runnable)() ->
|
||||
platform.showFileChooser(true, mapExtension, file -> ui.loadAnd(() -> {
|
||||
@@ -114,7 +114,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
})))
|
||||
);
|
||||
|
||||
t.addImageTextButton("$editor.export", Icon.upload, () -> createDialog("$editor.export",
|
||||
t.button("$editor.export", Icon.upload, () -> createDialog("$editor.export",
|
||||
"$editor.exportfile", "$editor.exportfile.description", Icon.file,
|
||||
(Runnable)() -> platform.export(editor.getTags().get("name", "unknown"), mapExtension, file -> MapIO.writeMap(file, editor.createMap(file))),
|
||||
"$editor.exportimage", "$editor.exportimage.description", Icon.fileImage,
|
||||
@@ -128,7 +128,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
menu.cont.row();
|
||||
|
||||
if(steam){
|
||||
menu.cont.addImageTextButton("$editor.publish.workshop", Icon.link, () -> {
|
||||
menu.cont.button("$editor.publish.workshop", Icon.link, () -> {
|
||||
Map builtin = maps.all().find(m -> m.name().equals(editor.getTags().get("name", "").trim()));
|
||||
|
||||
if(editor.getTags().containsKey("steamid") && builtin != null && !builtin.custom){
|
||||
@@ -161,11 +161,11 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
menu.cont.row();
|
||||
}
|
||||
|
||||
menu.cont.addImageTextButton("$editor.ingame", Icon.right, this::playtest).padTop(!steam ? -3 : 1).size(swidth * 2f + 10, 60f);
|
||||
menu.cont.button("$editor.ingame", Icon.right, this::playtest).padTop(!steam ? -3 : 1).size(swidth * 2f + 10, 60f);
|
||||
|
||||
menu.cont.row();
|
||||
|
||||
menu.cont.addImageTextButton("$quit", Icon.exit, () -> {
|
||||
menu.cont.button("$quit", Icon.exit, () -> {
|
||||
tryExit();
|
||||
menu.hide();
|
||||
}).size(swidth * 2f + 10, 60f);
|
||||
@@ -321,14 +321,14 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
Drawable iconname = (Drawable)arguments[i + 2];
|
||||
Runnable listenable = (Runnable)arguments[i + 3];
|
||||
|
||||
TextButton button = dialog.cont.addButton(name, () -> {
|
||||
TextButton button = dialog.cont.button(name, () -> {
|
||||
listenable.run();
|
||||
dialog.hide();
|
||||
menu.hide();
|
||||
}).left().margin(0).get();
|
||||
|
||||
button.clearChildren();
|
||||
button.addImage(iconname).padLeft(10);
|
||||
button.image(iconname).padLeft(10);
|
||||
button.table(t -> {
|
||||
t.add(name).growX().wrap();
|
||||
t.row();
|
||||
@@ -419,7 +419,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
button.clicked(l -> {
|
||||
if(!mobile){
|
||||
//desktop: rightclick
|
||||
l.setButton(KeyCode.MOUSE_RIGHT);
|
||||
l.setButton(KeyCode.mouseRight);
|
||||
}
|
||||
}, e -> {
|
||||
//need to double tap
|
||||
@@ -438,7 +438,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
int mode = i;
|
||||
String name = tool.altModes[i];
|
||||
|
||||
table.addButton(b -> {
|
||||
table.button(b -> {
|
||||
b.left();
|
||||
b.marginLeft(6);
|
||||
b.setStyle(Styles.clearTogglet);
|
||||
@@ -481,16 +481,16 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
|
||||
tools.defaults().size(size, size);
|
||||
|
||||
tools.addImageButton(Icon.menu, Styles.cleari, menu::show);
|
||||
tools.button(Icon.menu, Styles.cleari, menu::show);
|
||||
|
||||
ImageButton grid = tools.addImageButton(Icon.grid, Styles.clearTogglei, () -> view.setGrid(!view.isGrid())).get();
|
||||
ImageButton grid = tools.button(Icon.grid, Styles.clearTogglei, () -> view.setGrid(!view.isGrid())).get();
|
||||
|
||||
addTool.get(EditorTool.zoom);
|
||||
|
||||
tools.row();
|
||||
|
||||
ImageButton undo = tools.addImageButton(Icon.undo, Styles.cleari, editor::undo).get();
|
||||
ImageButton redo = tools.addImageButton(Icon.redo, Styles.cleari, editor::redo).get();
|
||||
ImageButton undo = tools.button(Icon.undo, Styles.cleari, editor::undo).get();
|
||||
ImageButton redo = tools.button(Icon.redo, Styles.cleari, editor::redo).get();
|
||||
|
||||
addTool.get(EditorTool.pick);
|
||||
|
||||
@@ -512,7 +512,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
addTool.get(EditorTool.fill);
|
||||
addTool.get(EditorTool.spray);
|
||||
|
||||
ImageButton rotate = tools.addImageButton(Icon.right, Styles.cleari, () -> editor.rotation = (editor.rotation + 1) % 4).get();
|
||||
ImageButton rotate = tools.button(Icon.right, Styles.cleari, () -> editor.rotation = (editor.rotation + 1) % 4).get();
|
||||
rotate.getImage().update(() -> {
|
||||
rotate.getImage().setRotation(editor.rotation * 90);
|
||||
rotate.getImage().setOrigin(Align.center);
|
||||
@@ -576,14 +576,14 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
if(Core.input.ctrl()){
|
||||
//alt mode select
|
||||
for(int i = 0; i < view.getTool().altModes.length + 1; i++){
|
||||
if(Core.input.keyTap(KeyCode.valueOf("NUM_" + (i + 1)))){
|
||||
if(Core.input.keyTap(KeyCode.valueOf("num" + (i + 1)))){
|
||||
view.getTool().mode = i - 1;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//tool select
|
||||
for(int i = 0; i < EditorTool.values().length; i++){
|
||||
if(Core.input.keyTap(KeyCode.valueOf("NUM_" + (i + 1)))){
|
||||
if(Core.input.keyTap(KeyCode.valueOf("num" + (i + 1)))){
|
||||
view.setTool(EditorTool.values()[i]);
|
||||
break;
|
||||
}
|
||||
@@ -591,28 +591,28 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
}
|
||||
|
||||
|
||||
if(Core.input.keyTap(KeyCode.ESCAPE)){
|
||||
if(Core.input.keyTap(KeyCode.escape)){
|
||||
if(!menu.isShown()){
|
||||
menu.show();
|
||||
}
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(KeyCode.R)){
|
||||
if(Core.input.keyTap(KeyCode.r)){
|
||||
editor.rotation = Mathf.mod(editor.rotation + 1, 4);
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(KeyCode.E)){
|
||||
if(Core.input.keyTap(KeyCode.e)){
|
||||
editor.rotation = Mathf.mod(editor.rotation - 1, 4);
|
||||
}
|
||||
|
||||
//ctrl keys (undo, redo, save)
|
||||
if(Core.input.ctrl()){
|
||||
if(Core.input.keyTap(KeyCode.Z)){
|
||||
if(Core.input.keyTap(KeyCode.z)){
|
||||
editor.undo();
|
||||
}
|
||||
|
||||
//more undocumented features, fantastic
|
||||
if(Core.input.keyTap(KeyCode.T)){
|
||||
if(Core.input.keyTap(KeyCode.t)){
|
||||
|
||||
//clears all 'decoration' from the map
|
||||
for(int x = 0; x < editor.width(); x++){
|
||||
@@ -633,15 +633,15 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
editor.flushOp();
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(KeyCode.Y)){
|
||||
if(Core.input.keyTap(KeyCode.y)){
|
||||
editor.redo();
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(KeyCode.S)){
|
||||
if(Core.input.keyTap(KeyCode.s)){
|
||||
save();
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(KeyCode.G)){
|
||||
if(Core.input.keyTap(KeyCode.g)){
|
||||
view.setGrid(!view.isGrid());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,27 +66,27 @@ public class MapGenerateDialog extends FloatingDialog{
|
||||
shown(this::setup);
|
||||
addCloseButton();
|
||||
if(applied){
|
||||
buttons.addButton("$editor.apply", () -> {
|
||||
buttons.button("$editor.apply", () -> {
|
||||
ui.loadAnd(() -> {
|
||||
apply();
|
||||
hide();
|
||||
});
|
||||
}).size(160f, 64f);
|
||||
}else{
|
||||
buttons.addButton("$settings.reset", () -> {
|
||||
buttons.button("$settings.reset", () -> {
|
||||
filters.set(maps.readFilters(""));
|
||||
rebuildFilters();
|
||||
update();
|
||||
}).size(160f, 64f);
|
||||
}
|
||||
buttons.addButton("$editor.randomize", () -> {
|
||||
buttons.button("$editor.randomize", () -> {
|
||||
for(GenerateFilter filter : filters){
|
||||
filter.randomize();
|
||||
}
|
||||
update();
|
||||
}).size(160f, 64f);
|
||||
|
||||
buttons.addImageTextButton("$add", Icon.add, this::showAdd).height(64f).width(140f);
|
||||
buttons.button("$add", Icon.add, this::showAdd).height(64f).width(140f);
|
||||
|
||||
if(!applied){
|
||||
hidden(this::apply);
|
||||
@@ -234,24 +234,24 @@ public class MapGenerateDialog extends FloatingDialog{
|
||||
t.table(b -> {
|
||||
ImageButtonStyle style = Styles.cleari;
|
||||
b.defaults().size(50f);
|
||||
b.addImageButton(Icon.refresh, style, () -> {
|
||||
b.button(Icon.refresh, style, () -> {
|
||||
filter.randomize();
|
||||
update();
|
||||
});
|
||||
|
||||
b.addImageButton(Icon.upOpen, style, () -> {
|
||||
b.button(Icon.upOpen, style, () -> {
|
||||
int idx = filters.indexOf(filter);
|
||||
filters.swap(idx, Math.max(0, idx - 1));
|
||||
rebuildFilters();
|
||||
update();
|
||||
});
|
||||
b.addImageButton(Icon.downOpen, style, () -> {
|
||||
b.button(Icon.downOpen, style, () -> {
|
||||
int idx = filters.indexOf(filter);
|
||||
filters.swap(idx, Math.min(filters.size - 1, idx + 1));
|
||||
rebuildFilters();
|
||||
update();
|
||||
});
|
||||
b.addImageButton(Icon.trash, style, () -> {
|
||||
b.button(Icon.trash, style, () -> {
|
||||
filters.remove(filter);
|
||||
rebuildFilters();
|
||||
update();
|
||||
@@ -293,7 +293,7 @@ public class MapGenerateDialog extends FloatingDialog{
|
||||
|
||||
if((!applied && filter.isBuffered()) || (filter.isPost() && applied)) continue;
|
||||
|
||||
selection.cont.addButton(filter.name(), () -> {
|
||||
selection.cont.button(filter.name(), () -> {
|
||||
filters.add(filter);
|
||||
rebuildFilters();
|
||||
update();
|
||||
@@ -302,7 +302,7 @@ public class MapGenerateDialog extends FloatingDialog{
|
||||
if(++i % 2 == 0) selection.cont.row();
|
||||
}
|
||||
|
||||
selection.cont.addButton("$filter.defaultores", () -> {
|
||||
selection.cont.button("$filter.defaultores", () -> {
|
||||
maps.addDefaultOres(filters);
|
||||
rebuildFilters();
|
||||
update();
|
||||
|
||||
@@ -35,7 +35,7 @@ public class MapInfoDialog extends FloatingDialog{
|
||||
t.add("$editor.mapname").padRight(8).left();
|
||||
t.defaults().padTop(15);
|
||||
|
||||
TextField name = t.addField(tags.get("name", ""), text -> {
|
||||
TextField name = t.field(tags.get("name", ""), text -> {
|
||||
tags.put("name", text);
|
||||
}).size(400, 55f).get();
|
||||
name.setMessageText("$unknown");
|
||||
@@ -43,14 +43,14 @@ public class MapInfoDialog extends FloatingDialog{
|
||||
t.row();
|
||||
t.add("$editor.description").padRight(8).left();
|
||||
|
||||
TextArea description = t.addArea(tags.get("description", ""), Styles.areaField, text -> {
|
||||
TextArea description = t.area(tags.get("description", ""), Styles.areaField, text -> {
|
||||
tags.put("description", text);
|
||||
}).size(400f, 140f).get();
|
||||
|
||||
t.row();
|
||||
t.add("$editor.author").padRight(8).left();
|
||||
|
||||
TextField author = t.addField(tags.get("author", Core.settings.getString("mapAuthor", "")), text -> {
|
||||
TextField author = t.field(tags.get("author", Core.settings.getString("mapAuthor", "")), text -> {
|
||||
tags.put("author", text);
|
||||
Core.settings.put("mapAuthor", text);
|
||||
Core.settings.save();
|
||||
@@ -59,21 +59,21 @@ public class MapInfoDialog extends FloatingDialog{
|
||||
|
||||
t.row();
|
||||
t.add("$editor.rules").padRight(8).left();
|
||||
t.addButton("$edit", () -> {
|
||||
t.button("$edit", () -> {
|
||||
ruleInfo.show(Vars.state.rules, () -> Vars.state.rules = new Rules());
|
||||
hide();
|
||||
}).left().width(200f);
|
||||
|
||||
t.row();
|
||||
t.add("$editor.waves").padRight(8).left();
|
||||
t.addButton("$edit", () -> {
|
||||
t.button("$edit", () -> {
|
||||
waveInfo.show();
|
||||
hide();
|
||||
}).left().width(200f);
|
||||
|
||||
t.row();
|
||||
t.add("$editor.generation").padRight(8).left();
|
||||
t.addButton("$edit", () -> {
|
||||
t.button("$edit", () -> {
|
||||
generate.show(Vars.maps.readFilters(editor.getTags().get("genfilters", "")),
|
||||
filters -> editor.getTags().put("genfilters", JsonIO.write(filters)));
|
||||
hide();
|
||||
|
||||
@@ -28,7 +28,7 @@ public class MapLoadDialog extends FloatingDialog{
|
||||
});
|
||||
|
||||
buttons.defaults().size(200f, 50f);
|
||||
buttons.addButton("$cancel", this::hide);
|
||||
buttons.button("$cancel", this::hide);
|
||||
buttons.add(button);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class MapResizeDialog extends FloatingDialog{
|
||||
for(boolean w : Mathf.booleans){
|
||||
table.add(w ? "$width" : "$height").padRight(8f);
|
||||
table.defaults().height(60f).padTop(8);
|
||||
table.addButton("<", () -> {
|
||||
table.button("<", () -> {
|
||||
if(w)
|
||||
width = move(width, -1);
|
||||
else
|
||||
@@ -31,7 +31,7 @@ public class MapResizeDialog extends FloatingDialog{
|
||||
|
||||
table.table(Tex.button, t -> t.label(() -> (w ? width : height) + "")).width(200);
|
||||
|
||||
table.addButton(">", () -> {
|
||||
table.button(">", () -> {
|
||||
if(w)
|
||||
width = move(width, 1);
|
||||
else
|
||||
@@ -45,8 +45,8 @@ public class MapResizeDialog extends FloatingDialog{
|
||||
});
|
||||
|
||||
buttons.defaults().size(200f, 50f);
|
||||
buttons.addButton("$cancel", this::hide);
|
||||
buttons.addButton("$ok", () -> {
|
||||
buttons.button("$cancel", this::hide);
|
||||
buttons.button("$ok", () -> {
|
||||
cons.get(width, height);
|
||||
hide();
|
||||
});
|
||||
|
||||
@@ -38,7 +38,7 @@ public class MapSaveDialog extends FloatingDialog{
|
||||
});
|
||||
|
||||
buttons.defaults().size(200f, 50f).pad(2f);
|
||||
buttons.addButton("$cancel", this::hide);
|
||||
buttons.button("$cancel", this::hide);
|
||||
|
||||
TextButton button = new TextButton("$save");
|
||||
button.clicked(() -> {
|
||||
|
||||
@@ -72,11 +72,11 @@ public class MapView extends Element implements GestureListener{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!mobile && button != KeyCode.MOUSE_LEFT && button != KeyCode.MOUSE_MIDDLE){
|
||||
if(!mobile && button != KeyCode.mouseLeft && button != KeyCode.mouseMiddle){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(button == KeyCode.MOUSE_MIDDLE){
|
||||
if(button == KeyCode.mouseMiddle){
|
||||
lastTool = tool;
|
||||
tool = EditorTool.zoom;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class MapView extends Element implements GestureListener{
|
||||
|
||||
@Override
|
||||
public void touchUp(InputEvent event, float x, float y, int pointer, KeyCode button){
|
||||
if(!mobile && button != KeyCode.MOUSE_LEFT && button != KeyCode.MOUSE_MIDDLE){
|
||||
if(!mobile && button != KeyCode.mouseLeft && button != KeyCode.mouseMiddle){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class MapView extends Element implements GestureListener{
|
||||
|
||||
editor.flushOp();
|
||||
|
||||
if(button == KeyCode.MOUSE_MIDDLE && lastTool != null){
|
||||
if(button == KeyCode.mouseMiddle && lastTool != null){
|
||||
tool = lastTool;
|
||||
lastTool = null;
|
||||
}
|
||||
@@ -172,26 +172,26 @@ public class MapView extends Element implements GestureListener{
|
||||
public void act(float delta){
|
||||
super.act(delta);
|
||||
|
||||
if(Core.scene.getKeyboardFocus() == null || !(Core.scene.getKeyboardFocus() instanceof TextField) && !Core.input.keyDown(KeyCode.CONTROL_LEFT)){
|
||||
if(Core.scene.getKeyboardFocus() == null || !(Core.scene.getKeyboardFocus() instanceof TextField) && !Core.input.keyDown(KeyCode.controlLeft)){
|
||||
float ax = Core.input.axis(Binding.move_x);
|
||||
float ay = Core.input.axis(Binding.move_y);
|
||||
offsetx -= ax * 15f / zoom;
|
||||
offsety -= ay * 15f / zoom;
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(KeyCode.SHIFT_LEFT)){
|
||||
if(Core.input.keyTap(KeyCode.shiftLeft)){
|
||||
lastTool = tool;
|
||||
tool = EditorTool.pick;
|
||||
}
|
||||
|
||||
if(Core.input.keyRelease(KeyCode.SHIFT_LEFT) && lastTool != null){
|
||||
if(Core.input.keyRelease(KeyCode.shiftLeft) && lastTool != null){
|
||||
tool = lastTool;
|
||||
lastTool = null;
|
||||
}
|
||||
|
||||
if(Core.scene.getScrollFocus() != this) return;
|
||||
|
||||
zoom += Core.input.axis(KeyCode.SCROLL) / 10f * zoom;
|
||||
zoom += Core.input.axis(KeyCode.scroll) / 10f * zoom;
|
||||
clampZoom();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,24 +42,24 @@ public class WaveInfoDialog extends FloatingDialog{
|
||||
});
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK){
|
||||
if(key == KeyCode.escape || key == KeyCode.back){
|
||||
Core.app.post(this::hide);
|
||||
}
|
||||
});
|
||||
|
||||
addCloseButton();
|
||||
buttons.addButton("$waves.edit", () -> {
|
||||
buttons.button("$waves.edit", () -> {
|
||||
FloatingDialog dialog = new FloatingDialog("$waves.edit");
|
||||
dialog.addCloseButton();
|
||||
dialog.setFillParent(false);
|
||||
dialog.cont.defaults().size(210f, 64f);
|
||||
dialog.cont.addButton("$waves.copy", () -> {
|
||||
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.addButton("$waves.load", () -> {
|
||||
dialog.cont.button("$waves.load", () -> {
|
||||
try{
|
||||
groups = maps.readWaves(Core.app.getClipboardText());
|
||||
buildGroups();
|
||||
@@ -70,7 +70,7 @@ public class WaveInfoDialog extends FloatingDialog{
|
||||
dialog.hide();
|
||||
}).disabled(b -> Core.app.getClipboardText() == null || Core.app.getClipboardText().isEmpty());
|
||||
dialog.cont.row();
|
||||
dialog.cont.addButton("$settings.reset", () -> ui.showConfirm("$confirm", "$settings.clear.confirm", () -> {
|
||||
dialog.cont.button("$settings.reset", () -> ui.showConfirm("$confirm", "$settings.clear.confirm", () -> {
|
||||
groups = JsonIO.copy(defaultWaves.get());
|
||||
buildGroups();
|
||||
dialog.hide();
|
||||
@@ -86,7 +86,7 @@ public class WaveInfoDialog extends FloatingDialog{
|
||||
cont.stack(new Table(Tex.clear, main -> {
|
||||
main.pane(t -> table = t).growX().growY().padRight(8f).get().setScrollingDisabled(true, false);
|
||||
main.row();
|
||||
main.addButton("$add", () -> {
|
||||
main.button("$add", () -> {
|
||||
if(groups == null) groups = new Array<>();
|
||||
groups.add(new SpawnGroup(lastType));
|
||||
buildGroups();
|
||||
@@ -101,7 +101,7 @@ public class WaveInfoDialog extends FloatingDialog{
|
||||
cont.table(Tex.clear, m -> {
|
||||
m.add("$waves.preview").color(Color.lightGray).growX().center().get().setAlignment(Align.center, Align.center);
|
||||
m.row();
|
||||
m.addButton("-", () -> {
|
||||
m.button("-", () -> {
|
||||
}).update(t -> {
|
||||
if(t.getClickListener().isPressed()){
|
||||
updateTimer += Time.delta();
|
||||
@@ -115,7 +115,7 @@ public class WaveInfoDialog extends FloatingDialog{
|
||||
m.row();
|
||||
m.pane(t -> preview = t).grow().get().setScrollingDisabled(true, true);
|
||||
m.row();
|
||||
m.addButton("+", () -> {
|
||||
m.button("+", () -> {
|
||||
}).update(t -> {
|
||||
if(t.getClickListener().isPressed()){
|
||||
updateTimer += Time.delta();
|
||||
@@ -140,22 +140,22 @@ public class WaveInfoDialog extends FloatingDialog{
|
||||
for(SpawnGroup group : groups){
|
||||
table.table(Tex.button, t -> {
|
||||
t.margin(0).defaults().pad(3).padLeft(5f).growX().left();
|
||||
t.addButton(b -> {
|
||||
t.button(b -> {
|
||||
b.left();
|
||||
b.addImage(group.type.icon(mindustry.ui.Cicon.medium)).size(32f).padRight(3);
|
||||
b.image(group.type.icon(mindustry.ui.Cicon.medium)).size(32f).padRight(3);
|
||||
b.add(group.type.localizedName).color(Pal.accent);
|
||||
}, () -> showUpdate(group)).pad(-6f).padBottom(0f);
|
||||
|
||||
t.row();
|
||||
t.table(spawns -> {
|
||||
spawns.addField("" + (group.begin + 1), TextFieldFilter.digitsOnly, text -> {
|
||||
spawns.field("" + (group.begin + 1), TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePostiveInt(text)){
|
||||
group.begin = Strings.parseInt(text) - 1;
|
||||
updateWaves();
|
||||
}
|
||||
}).width(100f);
|
||||
spawns.add("$waves.to").padLeft(4).padRight(4);
|
||||
spawns.addField(group.end == never ? "" : (group.end + 1) + "", TextFieldFilter.digitsOnly, text -> {
|
||||
spawns.field(group.end == never ? "" : (group.end + 1) + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePostiveInt(text)){
|
||||
group.end = Strings.parseInt(text) - 1;
|
||||
updateWaves();
|
||||
@@ -168,7 +168,7 @@ public class WaveInfoDialog extends FloatingDialog{
|
||||
t.row();
|
||||
t.table(p -> {
|
||||
p.add("$waves.every").padRight(4);
|
||||
p.addField(group.spacing + "", TextFieldFilter.digitsOnly, text -> {
|
||||
p.field(group.spacing + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePostiveInt(text) && Strings.parseInt(text) > 0){
|
||||
group.spacing = Strings.parseInt(text);
|
||||
updateWaves();
|
||||
@@ -179,7 +179,7 @@ public class WaveInfoDialog extends FloatingDialog{
|
||||
|
||||
t.row();
|
||||
t.table(a -> {
|
||||
a.addField(group.unitAmount + "", TextFieldFilter.digitsOnly, text -> {
|
||||
a.field(group.unitAmount + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePostiveInt(text)){
|
||||
group.unitAmount = Strings.parseInt(text);
|
||||
updateWaves();
|
||||
@@ -187,7 +187,7 @@ public class WaveInfoDialog extends FloatingDialog{
|
||||
}).width(80f);
|
||||
|
||||
a.add(" + ");
|
||||
a.addField(Strings.fixed(Math.max((Mathf.zero(group.unitScaling) ? 0 : 1f / group.unitScaling), 0), 2), TextFieldFilter.floatsOnly, text -> {
|
||||
a.field(Strings.fixed(Math.max((Mathf.zero(group.unitScaling) ? 0 : 1f / group.unitScaling), 0), 2), TextFieldFilter.floatsOnly, text -> {
|
||||
if(Strings.canParsePositiveFloat(text)){
|
||||
group.unitScaling = 1f / Strings.parseFloat(text);
|
||||
updateWaves();
|
||||
@@ -197,10 +197,10 @@ public class WaveInfoDialog extends FloatingDialog{
|
||||
});
|
||||
|
||||
t.row();
|
||||
t.addCheck("$waves.boss", b -> group.effect = (b ? StatusEffects.boss : null)).padTop(4).update(b -> b.setChecked(group.effect == StatusEffects.boss));
|
||||
t.check("$waves.boss", b -> group.effect = (b ? StatusEffects.boss : null)).padTop(4).update(b -> b.setChecked(group.effect == StatusEffects.boss));
|
||||
|
||||
t.row();
|
||||
t.addButton("$waves.remove", () -> {
|
||||
t.button("$waves.remove", () -> {
|
||||
groups.remove(group);
|
||||
table.getCell(t).pad(0f);
|
||||
t.remove();
|
||||
@@ -222,9 +222,9 @@ public class WaveInfoDialog extends FloatingDialog{
|
||||
dialog.cont.pane(p -> {
|
||||
int i = 0;
|
||||
for(UnitType type : content.units()){
|
||||
p.addButton(t -> {
|
||||
p.button(t -> {
|
||||
t.left();
|
||||
t.addImage(type.icon(mindustry.ui.Cicon.medium)).size(40f).padRight(2f);
|
||||
t.image(type.icon(mindustry.ui.Cicon.medium)).size(40f).padRight(2f);
|
||||
t.add(type.localizedName);
|
||||
}, () -> {
|
||||
lastType = type;
|
||||
@@ -257,7 +257,7 @@ public class WaveInfoDialog extends FloatingDialog{
|
||||
for(int j = 0; j < spawned.length; j++){
|
||||
if(spawned[j] > 0){
|
||||
UnitType type = content.getByID(ContentType.unit, j);
|
||||
table.addImage(type.icon(Cicon.medium)).size(8f * 4f).padRight(4);
|
||||
table.image(type.icon(Cicon.medium)).size(8f * 4f).padRight(4);
|
||||
table.add(spawned[j] + "x").color(Color.lightGray).padRight(6);
|
||||
table.row();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user