Renamed key fields and table methods
This commit is contained in:
@@ -193,7 +193,7 @@ public class Control implements ApplicationListener, Loadable{
|
||||
public void loadAsync(){
|
||||
Draw.scl = 1f / Core.atlas.find("scale_marker").getWidth();
|
||||
|
||||
Core.input.setCatch(KeyCode.BACK, true);
|
||||
Core.input.setCatch(KeyCode.back, true);
|
||||
|
||||
data.load();
|
||||
|
||||
@@ -400,9 +400,9 @@ public class Control implements ApplicationListener, Loadable{
|
||||
}).pad(10f).expand().center();
|
||||
|
||||
dialog.buttons.defaults().size(200f, 60f);
|
||||
dialog.buttons.addButton("$uiscale.cancel", exit);
|
||||
dialog.buttons.button("$uiscale.cancel", exit);
|
||||
|
||||
dialog.buttons.addButton("$ok", () -> {
|
||||
dialog.buttons.button("$ok", () -> {
|
||||
Core.settings.put("uiscalechanged", false);
|
||||
settings.save();
|
||||
dialog.hide();
|
||||
@@ -494,7 +494,7 @@ public class Control implements ApplicationListener, Loadable{
|
||||
Time.update();
|
||||
}
|
||||
|
||||
if(!scene.hasDialog() && !scene.root.getChildren().isEmpty() && !(scene.root.getChildren().peek() instanceof Dialog) && Core.input.keyTap(KeyCode.BACK)){
|
||||
if(!scene.hasDialog() && !scene.root.getChildren().isEmpty() && !(scene.root.getChildren().peek() instanceof Dialog) && Core.input.keyTap(KeyCode.back)){
|
||||
platform.hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class UI implements ApplicationListener, Loadable{
|
||||
Core.scene.act();
|
||||
Core.scene.draw();
|
||||
|
||||
if(Core.input.keyTap(KeyCode.MOUSE_LEFT) && Core.scene.getKeyboardFocus() instanceof TextField){
|
||||
if(Core.input.keyTap(KeyCode.mouseLeft) && Core.scene.getKeyboardFocus() instanceof TextField){
|
||||
Element e = Core.scene.hit(Core.input.mouseX(), Core.input.mouseY(), true);
|
||||
if(!(e instanceof TextField)){
|
||||
Core.scene.setKeyboardFocus(null);
|
||||
@@ -249,23 +249,23 @@ public class UI implements ApplicationListener, Loadable{
|
||||
new Dialog(titleText){{
|
||||
cont.margin(30).add(dtext).padRight(6f);
|
||||
TextFieldFilter filter = inumeric ? TextFieldFilter.digitsOnly : (f, c) -> true;
|
||||
TextField field = cont.addField(def, t -> {}).size(330f, 50f).get();
|
||||
TextField field = cont.field(def, t -> {}).size(330f, 50f).get();
|
||||
field.setFilter((f, c) -> field.getText().length() < textLength && filter.acceptChar(f, c));
|
||||
buttons.defaults().size(120, 54).pad(4);
|
||||
buttons.addButton("$ok", () -> {
|
||||
buttons.button("$ok", () -> {
|
||||
confirmed.get(field.getText());
|
||||
hide();
|
||||
}).disabled(b -> field.getText().isEmpty());
|
||||
buttons.addButton("$cancel", this::hide);
|
||||
keyDown(KeyCode.ENTER, () -> {
|
||||
buttons.button("$cancel", this::hide);
|
||||
keyDown(KeyCode.enter, () -> {
|
||||
String text = field.getText();
|
||||
if(!text.isEmpty()){
|
||||
confirmed.get(text);
|
||||
hide();
|
||||
}
|
||||
});
|
||||
keyDown(KeyCode.ESCAPE, this::hide);
|
||||
keyDown(KeyCode.BACK, this::hide);
|
||||
keyDown(KeyCode.escape, this::hide);
|
||||
keyDown(KeyCode.back, this::hide);
|
||||
show();
|
||||
Core.scene.setKeyboardFocus(field);
|
||||
field.setCursorPosition(def.length());
|
||||
@@ -328,6 +328,7 @@ public class UI implements ApplicationListener, Loadable{
|
||||
Vec2 v = Core.camera.project(worldx, worldy);
|
||||
t.setPosition(v.x, v.y, Align.center);
|
||||
});
|
||||
table.act(0f);
|
||||
//make sure it's at the back
|
||||
Core.scene.root.addChildAt(0, table);
|
||||
}
|
||||
@@ -336,7 +337,7 @@ public class UI implements ApplicationListener, Loadable{
|
||||
new Dialog(""){{
|
||||
getCell(cont).growX();
|
||||
cont.margin(15).add(info).width(400f).wrap().get().setAlignment(Align.center, Align.center);
|
||||
buttons.addButton("$ok", this::hide).size(110, 50).pad(4);
|
||||
buttons.button("$ok", this::hide).size(110, 50).pad(4);
|
||||
}}.show();
|
||||
}
|
||||
|
||||
@@ -346,11 +347,11 @@ public class UI implements ApplicationListener, Loadable{
|
||||
cont.margin(15f);
|
||||
cont.add("$error.title");
|
||||
cont.row();
|
||||
cont.addImage().width(300f).pad(2).height(4f).color(Color.scarlet);
|
||||
cont.image().width(300f).pad(2).height(4f).color(Color.scarlet);
|
||||
cont.row();
|
||||
cont.add(text).pad(2f).growX().wrap().get().setAlignment(Align.center);
|
||||
cont.row();
|
||||
cont.addButton("$ok", this::hide).size(120, 50).pad(4);
|
||||
cont.button("$ok", this::hide).size(120, 50).pad(4);
|
||||
}}.show();
|
||||
}
|
||||
|
||||
@@ -367,15 +368,15 @@ public class UI implements ApplicationListener, Loadable{
|
||||
cont.margin(15);
|
||||
cont.add("$error.title").colspan(2);
|
||||
cont.row();
|
||||
cont.addImage().width(300f).pad(2).colspan(2).height(4f).color(Color.scarlet);
|
||||
cont.image().width(300f).pad(2).colspan(2).height(4f).color(Color.scarlet);
|
||||
cont.row();
|
||||
cont.add((text.startsWith("$") ? Core.bundle.get(text.substring(1)) : text) + (message == null ? "" : "\n[lightgray](" + message + ")")).colspan(2).wrap().growX().center().get().setAlignment(Align.center);
|
||||
cont.row();
|
||||
|
||||
Collapser col = new Collapser(base -> base.pane(t -> t.margin(14f).add(Strings.parseException(exc, true)).color(Color.lightGray).left()), true);
|
||||
|
||||
cont.addButton("$details", Styles.togglet, col::toggle).size(180f, 50f).checked(b -> !col.isCollapsed()).fillX().right();
|
||||
cont.addButton("$ok", this::hide).size(110, 50).fillX().left();
|
||||
cont.button("$details", Styles.togglet, col::toggle).size(180f, 50f).checked(b -> !col.isCollapsed()).fillX().right();
|
||||
cont.button("$ok", this::hide).size(110, 50).fillX().left();
|
||||
cont.row();
|
||||
cont.add(col).colspan(2).pad(2);
|
||||
}}.show();
|
||||
@@ -389,7 +390,7 @@ public class UI implements ApplicationListener, Loadable{
|
||||
cont.margin(15);
|
||||
cont.add("$error.title").colspan(2);
|
||||
cont.row();
|
||||
cont.addImage().width(300f).pad(2).colspan(2).height(4f).color(Color.scarlet);
|
||||
cont.image().width(300f).pad(2).colspan(2).height(4f).color(Color.scarlet);
|
||||
cont.row();
|
||||
cont.add(text).colspan(2).wrap().growX().center().get().setAlignment(Align.center);
|
||||
cont.row();
|
||||
@@ -401,14 +402,14 @@ public class UI implements ApplicationListener, Loadable{
|
||||
Collapser col = new Collapser(base -> base.pane(t -> t.margin(14f).add(details).color(Color.lightGray).left()), true);
|
||||
|
||||
cont.add(btext).right();
|
||||
cont.addButton("$details", Styles.togglet, col::toggle).size(180f, 50f).checked(b -> !col.isCollapsed()).fillX().left();
|
||||
cont.button("$details", Styles.togglet, col::toggle).size(180f, 50f).checked(b -> !col.isCollapsed()).fillX().left();
|
||||
cont.row();
|
||||
cont.add(col).colspan(2).pad(2);
|
||||
cont.row();
|
||||
}
|
||||
//}).colspan(2);
|
||||
|
||||
cont.addButton("$ok", this::hide).size(300, 50).fillX().colspan(2);
|
||||
cont.button("$ok", this::hide).size(300, 50).fillX().colspan(2);
|
||||
}}.show();
|
||||
}
|
||||
|
||||
@@ -419,18 +420,18 @@ public class UI implements ApplicationListener, Loadable{
|
||||
public void showText(String titleText, String text, int align){
|
||||
new Dialog(titleText){{
|
||||
cont.row();
|
||||
cont.addImage().width(400f).pad(2).colspan(2).height(4f).color(Pal.accent);
|
||||
cont.image().width(400f).pad(2).colspan(2).height(4f).color(Pal.accent);
|
||||
cont.row();
|
||||
cont.add(text).width(400f).wrap().get().setAlignment(align, align);
|
||||
cont.row();
|
||||
buttons.addButton("$ok", this::hide).size(110, 50).pad(4);
|
||||
buttons.button("$ok", this::hide).size(110, 50).pad(4);
|
||||
}}.show();
|
||||
}
|
||||
|
||||
public void showInfoText(String titleText, String text){
|
||||
new Dialog(titleText){{
|
||||
cont.margin(15).add(text).width(400f).wrap().left().get().setAlignment(Align.left, Align.left);
|
||||
buttons.addButton("$ok", this::hide).size(110, 50).pad(4);
|
||||
buttons.button("$ok", this::hide).size(110, 50).pad(4);
|
||||
}}.show();
|
||||
}
|
||||
|
||||
@@ -438,8 +439,8 @@ public class UI implements ApplicationListener, Loadable{
|
||||
new Dialog(titleText){{
|
||||
cont.margin(10).add(text);
|
||||
titleTable.row();
|
||||
titleTable.addImage().color(Pal.accent).height(3f).growX().pad(2f);
|
||||
buttons.addButton("$ok", this::hide).size(110, 50).pad(4);
|
||||
titleTable.image().color(Pal.accent).height(3f).growX().pad(2f);
|
||||
buttons.button("$ok", this::hide).size(110, 50).pad(4);
|
||||
}}.show();
|
||||
}
|
||||
|
||||
@@ -452,8 +453,8 @@ public class UI implements ApplicationListener, Loadable{
|
||||
dialog.cont.add(text).width(mobile ? 400f : 500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
||||
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
||||
dialog.setFillParent(false);
|
||||
dialog.buttons.addButton("$cancel", dialog::hide);
|
||||
dialog.buttons.addButton("$ok", () -> {
|
||||
dialog.buttons.button("$cancel", dialog::hide);
|
||||
dialog.buttons.button("$ok", () -> {
|
||||
dialog.hide();
|
||||
confirmed.run();
|
||||
});
|
||||
@@ -464,8 +465,8 @@ public class UI implements ApplicationListener, Loadable{
|
||||
}
|
||||
});
|
||||
}
|
||||
dialog.keyDown(KeyCode.ESCAPE, dialog::hide);
|
||||
dialog.keyDown(KeyCode.BACK, dialog::hide);
|
||||
dialog.keyDown(KeyCode.escape, dialog::hide);
|
||||
dialog.keyDown(KeyCode.back, dialog::hide);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@@ -474,16 +475,16 @@ public class UI implements ApplicationListener, Loadable{
|
||||
dialog.cont.add(text).width(mobile ? 400f : 500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
||||
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
||||
dialog.setFillParent(false);
|
||||
dialog.buttons.addButton(no, () -> {
|
||||
dialog.buttons.button(no, () -> {
|
||||
dialog.hide();
|
||||
denied.run();
|
||||
});
|
||||
dialog.buttons.addButton(yes, () -> {
|
||||
dialog.buttons.button(yes, () -> {
|
||||
dialog.hide();
|
||||
confirmed.run();
|
||||
});
|
||||
dialog.keyDown(KeyCode.ESCAPE, dialog::hide);
|
||||
dialog.keyDown(KeyCode.BACK, dialog::hide);
|
||||
dialog.keyDown(KeyCode.escape, dialog::hide);
|
||||
dialog.keyDown(KeyCode.back, dialog::hide);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@@ -492,7 +493,7 @@ public class UI implements ApplicationListener, Loadable{
|
||||
dialog.cont.add(text).width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
||||
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
||||
dialog.setFillParent(false);
|
||||
dialog.buttons.addButton("$ok", () -> {
|
||||
dialog.buttons.button("$ok", () -> {
|
||||
dialog.hide();
|
||||
confirmed.run();
|
||||
});
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -824,7 +824,7 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
||||
l.clearChildren();
|
||||
for(Item item : content.items()){
|
||||
if(items.flownBits() != null && items.flownBits().get(item.id)){
|
||||
l.addImage(item.icon(Cicon.small)).padRight(3f);
|
||||
l.image(item.icon(Cicon.small)).padRight(3f);
|
||||
l.label(() -> items.getFlowRate(item) < 0 ? "..." : Strings.fixed(items.getFlowRate(item), 1) + ps).color(Color.lightGray);
|
||||
l.row();
|
||||
}
|
||||
@@ -845,7 +845,7 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
||||
table.row();
|
||||
table.table(l -> {
|
||||
l.left();
|
||||
l.addImage(() -> liquids.current().icon(Cicon.small)).padRight(3f);
|
||||
l.image(() -> liquids.current().icon(Cicon.small)).padRight(3f);
|
||||
l.label(() -> liquids.getFlowRate() < 0 ? "..." : Strings.fixed(liquids.getFlowRate(), 2) + ps).color(Color.lightGray);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,55 +7,55 @@ import arc.input.InputDevice.DeviceType;
|
||||
import arc.input.KeyCode;
|
||||
|
||||
public enum Binding implements KeyBind{
|
||||
move_x(new Axis(KeyCode.A, KeyCode.D), "general"),
|
||||
move_y(new Axis(KeyCode.S, KeyCode.W)),
|
||||
mouse_move(KeyCode.MOUSE_BACK),
|
||||
dash(KeyCode.SHIFT_LEFT),
|
||||
control(KeyCode.SHIFT_LEFT),
|
||||
select(KeyCode.MOUSE_LEFT),
|
||||
deselect(KeyCode.MOUSE_RIGHT),
|
||||
break_block(KeyCode.MOUSE_RIGHT),
|
||||
clear_building(KeyCode.Q),
|
||||
pause_building(KeyCode.E),
|
||||
rotate(new Axis(KeyCode.SCROLL)),
|
||||
rotateplaced(KeyCode.R),
|
||||
diagonal_placement(KeyCode.CONTROL_LEFT),
|
||||
pick(KeyCode.MOUSE_MIDDLE),
|
||||
schematic_select(KeyCode.F),
|
||||
schematic_flip_x(KeyCode.Z),
|
||||
schematic_flip_y(KeyCode.X),
|
||||
schematic_menu(KeyCode.T),
|
||||
category_prev(KeyCode.COMMA),
|
||||
category_next(KeyCode.PERIOD),
|
||||
block_select_left(KeyCode.LEFT),
|
||||
block_select_right(KeyCode.RIGHT),
|
||||
block_select_up(KeyCode.UP),
|
||||
block_select_down(KeyCode.DOWN),
|
||||
block_select_01(KeyCode.NUM_1),
|
||||
block_select_02(KeyCode.NUM_2),
|
||||
block_select_03(KeyCode.NUM_3),
|
||||
block_select_04(KeyCode.NUM_4),
|
||||
block_select_05(KeyCode.NUM_5),
|
||||
block_select_06(KeyCode.NUM_6),
|
||||
block_select_07(KeyCode.NUM_7),
|
||||
block_select_08(KeyCode.NUM_8),
|
||||
block_select_09(KeyCode.NUM_9),
|
||||
block_select_10(KeyCode.NUM_0),
|
||||
zoom(new Axis(KeyCode.SCROLL), "view"),
|
||||
menu(Core.app.getType() == ApplicationType.Android ? KeyCode.BACK : KeyCode.ESCAPE),
|
||||
fullscreen(KeyCode.F11),
|
||||
pause(KeyCode.SPACE),
|
||||
minimap(KeyCode.M),
|
||||
toggle_menus(KeyCode.C),
|
||||
screenshot(KeyCode.P),
|
||||
toggle_power_lines(KeyCode.F5),
|
||||
toggle_block_status(KeyCode.F6),
|
||||
player_list(KeyCode.TAB, "multiplayer"),
|
||||
chat(KeyCode.ENTER),
|
||||
chat_history_prev(KeyCode.UP),
|
||||
chat_history_next(KeyCode.DOWN),
|
||||
chat_scroll(new Axis(KeyCode.SCROLL)),
|
||||
console(KeyCode.F8),
|
||||
move_x(new Axis(KeyCode.a, KeyCode.d), "general"),
|
||||
move_y(new Axis(KeyCode.s, KeyCode.w)),
|
||||
mouse_move(KeyCode.mouseBack),
|
||||
dash(KeyCode.shiftLeft),
|
||||
control(KeyCode.shiftLeft),
|
||||
select(KeyCode.mouseLeft),
|
||||
deselect(KeyCode.mouseRight),
|
||||
break_block(KeyCode.mouseRight),
|
||||
clear_building(KeyCode.q),
|
||||
pause_building(KeyCode.e),
|
||||
rotate(new Axis(KeyCode.scroll)),
|
||||
rotateplaced(KeyCode.r),
|
||||
diagonal_placement(KeyCode.controlLeft),
|
||||
pick(KeyCode.mouseMiddle),
|
||||
schematic_select(KeyCode.f),
|
||||
schematic_flip_x(KeyCode.z),
|
||||
schematic_flip_y(KeyCode.x),
|
||||
schematic_menu(KeyCode.t),
|
||||
category_prev(KeyCode.comma),
|
||||
category_next(KeyCode.period),
|
||||
block_select_left(KeyCode.left),
|
||||
block_select_right(KeyCode.right),
|
||||
block_select_up(KeyCode.up),
|
||||
block_select_down(KeyCode.down),
|
||||
block_select_01(KeyCode.num1),
|
||||
block_select_02(KeyCode.num2),
|
||||
block_select_03(KeyCode.num3),
|
||||
block_select_04(KeyCode.num4),
|
||||
block_select_05(KeyCode.num5),
|
||||
block_select_06(KeyCode.num6),
|
||||
block_select_07(KeyCode.num7),
|
||||
block_select_08(KeyCode.num8),
|
||||
block_select_09(KeyCode.num9),
|
||||
block_select_10(KeyCode.num0),
|
||||
zoom(new Axis(KeyCode.scroll), "view"),
|
||||
menu(Core.app.getType() == ApplicationType.Android ? KeyCode.back : KeyCode.escape),
|
||||
fullscreen(KeyCode.f11),
|
||||
pause(KeyCode.space),
|
||||
minimap(KeyCode.m),
|
||||
toggle_menus(KeyCode.c),
|
||||
screenshot(KeyCode.p),
|
||||
toggle_power_lines(KeyCode.f5),
|
||||
toggle_block_status(KeyCode.f6),
|
||||
player_list(KeyCode.tab, "multiplayer"),
|
||||
chat(KeyCode.enter),
|
||||
chat_history_prev(KeyCode.up),
|
||||
chat_history_next(KeyCode.down),
|
||||
chat_scroll(new Axis(KeyCode.scroll)),
|
||||
console(KeyCode.f8),
|
||||
;
|
||||
|
||||
private final KeybindValue defaultValue;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class DesktopInput extends InputHandler{
|
||||
Core.keybinds.get(Binding.schematic_flip_y).key.toString())).style(Styles.outlineLabel);
|
||||
b.row();
|
||||
b.table(a -> {
|
||||
a.addImageTextButton("$schematic.add", Icon.save, this::showSchematicSave).colspan(2).size(250f, 50f).disabled(f -> lastSchematic == null || lastSchematic.file != null);
|
||||
a.button("$schematic.add", Icon.save, this::showSchematicSave).colspan(2).size(250f, 50f).disabled(f -> lastSchematic == null || lastSchematic.file != null);
|
||||
});
|
||||
}).margin(6f);
|
||||
});
|
||||
@@ -182,7 +182,7 @@ public class DesktopInput extends InputHandler{
|
||||
}
|
||||
|
||||
//TODO this is for debugging, remove later
|
||||
if(Core.input.keyTap(KeyCode.Q) && !player.dead()){
|
||||
if(Core.input.keyTap(KeyCode.q) && !player.dead()){
|
||||
Fx.commandSend.at(player);
|
||||
Units.nearby(player.team(), player.x(), player.y(), 200f, u -> {
|
||||
if(u.isAI()){
|
||||
@@ -302,11 +302,11 @@ public class DesktopInput extends InputHandler{
|
||||
|
||||
@Override
|
||||
public void buildPlacementUI(Table table){
|
||||
table.addImage().color(Pal.gray).height(4f).colspan(4).growX();
|
||||
table.image().color(Pal.gray).height(4f).colspan(4).growX();
|
||||
table.row();
|
||||
table.left().margin(0f).defaults().size(48f).left();
|
||||
|
||||
table.addImageButton(Icon.paste, Styles.clearPartiali, () -> {
|
||||
table.button(Icon.paste, Styles.clearPartiali, () -> {
|
||||
ui.schematics.show();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import arc.scene.ui.layout.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.core.GameState.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.entities.units.*;
|
||||
@@ -175,23 +174,23 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
@Override
|
||||
public void buildPlacementUI(Table table){
|
||||
table.addImage().color(Pal.gray).height(4f).colspan(4).growX();
|
||||
table.image().color(Pal.gray).height(4f).colspan(4).growX();
|
||||
table.row();
|
||||
table.left().margin(0f).defaults().size(48f);
|
||||
|
||||
table.addImageButton(Icon.hammer, Styles.clearTogglePartiali, () -> {
|
||||
table.button(Icon.hammer, Styles.clearTogglePartiali, () -> {
|
||||
mode = mode == breaking ? block == null ? none : placing : breaking;
|
||||
lastBlock = block;
|
||||
}).update(l -> l.setChecked(mode == breaking)).name("breakmode");
|
||||
|
||||
//diagonal swap button
|
||||
table.addImageButton(Icon.diagonal, Styles.clearTogglePartiali, () -> {
|
||||
table.button(Icon.diagonal, Styles.clearTogglePartiali, () -> {
|
||||
Core.settings.put("swapdiagonal", !Core.settings.getBool("swapdiagonal"));
|
||||
Core.settings.save();
|
||||
}).update(l -> l.setChecked(Core.settings.getBool("swapdiagonal")));
|
||||
|
||||
//rotate button
|
||||
table.addImageButton(Icon.right, Styles.clearTogglePartiali, () -> {
|
||||
table.button(Icon.right, Styles.clearTogglePartiali, () -> {
|
||||
if(block != null && block.rotate){
|
||||
rotation = Mathf.mod(rotation + 1, 4);
|
||||
}else{
|
||||
@@ -210,7 +209,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
});
|
||||
|
||||
//confirm button
|
||||
table.addImageButton(Icon.ok, Styles.clearPartiali, () -> {
|
||||
table.button(Icon.ok, Styles.clearPartiali, () -> {
|
||||
for(BuildRequest request : selectRequests){
|
||||
Tile tile = request.tile();
|
||||
|
||||
@@ -249,7 +248,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
group.fill(t -> {
|
||||
t.bottom().left().visible(() -> (player.builder().isBuilding() || block != null || mode == breaking || !selectRequests.isEmpty()) && !schem.get());
|
||||
t.addImageTextButton("$cancel", Icon.cancel, () -> {
|
||||
t.button("$cancel", Icon.cancel, () -> {
|
||||
player.builder().clearBuilding();
|
||||
selectRequests.clear();
|
||||
mode = none;
|
||||
@@ -265,15 +264,15 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
ImageButtonStyle style = Styles.clearPartiali;
|
||||
|
||||
b.addImageButton(Icon.save, style, this::showSchematicSave).disabled(f -> lastSchematic == null || lastSchematic.file != null);
|
||||
b.addImageButton(Icon.cancel, style, () -> {
|
||||
b.button(Icon.save, style, this::showSchematicSave).disabled(f -> lastSchematic == null || lastSchematic.file != null);
|
||||
b.button(Icon.cancel, style, () -> {
|
||||
selectRequests.clear();
|
||||
});
|
||||
b.row();
|
||||
b.addImageButton(Icon.flipX, style, () -> flipRequests(selectRequests, true));
|
||||
b.addImageButton(Icon.flipY, style, () -> flipRequests(selectRequests, false));
|
||||
b.button(Icon.flipX, style, () -> flipRequests(selectRequests, true));
|
||||
b.button(Icon.flipY, style, () -> flipRequests(selectRequests, false));
|
||||
b.row();
|
||||
b.addImageButton(Icon.rotate, style, () -> rotateRequests(selectRequests, 1));
|
||||
b.button(Icon.rotate, style, () -> rotateRequests(selectRequests, 1));
|
||||
|
||||
}).margin(4f);
|
||||
});
|
||||
|
||||
@@ -63,7 +63,7 @@ public abstract class FilterOption{
|
||||
table.label(() -> Core.bundle.get("filter.option." + name) + ": " + (int)getter.get());
|
||||
}
|
||||
table.row();
|
||||
Slider slider = table.addSlider(min, max, step, setter).growX().get();
|
||||
Slider slider = table.slider(min, max, step, setter).growX().get();
|
||||
slider.setValue(getter.get());
|
||||
if(updateEditorOnChange){
|
||||
slider.changed(changed);
|
||||
@@ -88,7 +88,7 @@ public abstract class FilterOption{
|
||||
|
||||
@Override
|
||||
public void build(Table table){
|
||||
table.addButton(b -> b.addImage(supplier.get().icon(Cicon.small)).update(i -> ((TextureRegionDrawable)i.getDrawable())
|
||||
table.button(b -> b.image(supplier.get().icon(Cicon.small)).update(i -> ((TextureRegionDrawable)i.getDrawable())
|
||||
.setRegion(supplier.get() == Blocks.air ? Icon.block.getRegion() : supplier.get().icon(Cicon.small))).size(8 * 3), () -> {
|
||||
FloatingDialog dialog = new FloatingDialog("");
|
||||
dialog.setFillParent(false);
|
||||
@@ -96,7 +96,7 @@ public abstract class FilterOption{
|
||||
for(Block block : Vars.content.blocks()){
|
||||
if(!filter.get(block)) continue;
|
||||
|
||||
dialog.cont.addImage(block == Blocks.air ? Icon.block.getRegion() : block.icon(Cicon.medium)).size(8 * 4).pad(3).get().clicked(() -> {
|
||||
dialog.cont.image(block == Blocks.air ? Icon.block.getRegion() : block.icon(Cicon.medium)).size(8 * 4).pad(3).get().clicked(() -> {
|
||||
consumer.get(block);
|
||||
dialog.hide();
|
||||
changed.run();
|
||||
|
||||
@@ -386,7 +386,7 @@ public class Mods implements Loadable{
|
||||
cont.margin(15);
|
||||
cont.add("$error.title");
|
||||
cont.row();
|
||||
cont.addImage().width(300f).pad(2).colspan(2).height(4f).color(Color.scarlet);
|
||||
cont.image().width(300f).pad(2).colspan(2).height(4f).color(Color.scarlet);
|
||||
cont.row();
|
||||
cont.add("$mod.errors").wrap().growX().center().get().setAlignment(Align.center);
|
||||
cont.row();
|
||||
@@ -394,18 +394,18 @@ public class Mods implements Loadable{
|
||||
mods.each(m -> m.enabled() && m.hasContentErrors(), m -> {
|
||||
p.add(m.name).color(Pal.accent).left();
|
||||
p.row();
|
||||
p.addImage().fillX().pad(4).color(Pal.accent);
|
||||
p.image().fillX().pad(4).color(Pal.accent);
|
||||
p.row();
|
||||
p.table(d -> {
|
||||
d.left().marginLeft(15f);
|
||||
for(Content c : m.erroredContent){
|
||||
d.add(c.minfo.sourceFile.nameWithoutExtension()).left().padRight(10);
|
||||
d.addImageTextButton("$details", Icon.downOpen, Styles.transt, () -> {
|
||||
d.button("$details", Icon.downOpen, Styles.transt, () -> {
|
||||
new Dialog(""){{
|
||||
setFillParent(true);
|
||||
cont.pane(e -> e.add(c.minfo.error)).grow();
|
||||
cont.row();
|
||||
cont.addImageTextButton("$ok", Icon.left, this::hide).size(240f, 60f);
|
||||
cont.button("$ok", Icon.left, this::hide).size(240f, 60f);
|
||||
}}.show();
|
||||
}).size(190f, 50f).left().marginLeft(6);
|
||||
d.row();
|
||||
@@ -416,7 +416,7 @@ public class Mods implements Loadable{
|
||||
});
|
||||
|
||||
cont.row();
|
||||
cont.addButton("$ok", this::hide).size(300, 50);
|
||||
cont.button("$ok", this::hide).size(300, 50);
|
||||
}}.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class BeControl{
|
||||
});
|
||||
|
||||
dialog.cont.add(new Bar(() -> length[0] == 0 ? Core.bundle.get("be.updating") : (int)(progress[0] * length[0]) / 1024/ 1024 + "/" + length[0]/1024/1024 + " MB", () -> Pal.accent, () -> progress[0])).width(400f).height(70f);
|
||||
dialog.buttons.addImageTextButton("$cancel", Icon.cancel, () -> {
|
||||
dialog.buttons.button("$cancel", Icon.cancel, () -> {
|
||||
cancel[0] = true;
|
||||
dialog.hide();
|
||||
}).size(210f, 64f);
|
||||
|
||||
@@ -17,13 +17,13 @@ public class ContentDisplay{
|
||||
table.table(title -> {
|
||||
int size = 8 * 6;
|
||||
|
||||
title.addImage(block.icon(Cicon.xlarge)).size(size);
|
||||
title.image(block.icon(Cicon.xlarge)).size(size);
|
||||
title.add("[accent]" + block.localizedName).padLeft(5);
|
||||
});
|
||||
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(8).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(8).padLeft(0).padRight(0).fillX();
|
||||
|
||||
table.row();
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ContentDisplay{
|
||||
table.add(block.displayDescription()).padLeft(5).padRight(5).width(400f).wrap().fillX();
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(8).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(8).padLeft(0).padRight(0).fillX();
|
||||
table.row();
|
||||
}
|
||||
|
||||
@@ -65,13 +65,13 @@ public class ContentDisplay{
|
||||
public static void displayItem(Table table, Item item){
|
||||
|
||||
table.table(title -> {
|
||||
title.addImage(item.icon(Cicon.xlarge)).size(8 * 6);
|
||||
title.image(item.icon(Cicon.xlarge)).size(8 * 6);
|
||||
title.add("[accent]" + item.localizedName).padLeft(5);
|
||||
});
|
||||
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
|
||||
table.row();
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ContentDisplay{
|
||||
table.add(item.displayDescription()).padLeft(5).padRight(5).width(400f).wrap().fillX();
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.row();
|
||||
}
|
||||
|
||||
@@ -99,13 +99,13 @@ public class ContentDisplay{
|
||||
public static void displayLiquid(Table table, Liquid liquid){
|
||||
|
||||
table.table(title -> {
|
||||
title.addImage(liquid.icon(Cicon.xlarge)).size(8 * 6);
|
||||
title.image(liquid.icon(Cicon.xlarge)).size(8 * 6);
|
||||
title.add("[accent]" + liquid.localizedName).padLeft(5);
|
||||
});
|
||||
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
|
||||
table.row();
|
||||
|
||||
@@ -113,7 +113,7 @@ public class ContentDisplay{
|
||||
table.add(liquid.displayDescription()).padLeft(5).padRight(5).width(400f).wrap().fillX();
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.row();
|
||||
}
|
||||
|
||||
@@ -133,13 +133,13 @@ public class ContentDisplay{
|
||||
|
||||
public static void displayUnit(Table table, UnitType unit){
|
||||
table.table(title -> {
|
||||
title.addImage(unit.icon(Cicon.xlarge)).size(8 * 6);
|
||||
title.image(unit.icon(Cicon.xlarge)).size(8 * 6);
|
||||
title.add("[accent]" + unit.localizedName).padLeft(5);
|
||||
});
|
||||
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
|
||||
table.row();
|
||||
|
||||
@@ -147,7 +147,7 @@ public class ContentDisplay{
|
||||
table.add(unit.displayDescription()).padLeft(5).padRight(5).width(400f).wrap().fillX();
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.row();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package mindustry.ui;
|
||||
import arc.graphics.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import mindustry.core.GameState.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
@@ -33,14 +32,14 @@ public class ItemsDisplay extends Table{
|
||||
for(Item item : content.items()){
|
||||
if(item.type == ItemType.material && data.isUnlocked(item)){
|
||||
t.label(() -> format(item)).left();
|
||||
t.addImage(item.icon(Cicon.small)).size(8 * 3).padLeft(4).padRight(4);
|
||||
t.image(item.icon(Cicon.small)).size(8 * 3).padLeft(4).padRight(4);
|
||||
t.add(item.localizedName).color(Color.lightGray).left();
|
||||
t.row();
|
||||
}
|
||||
}
|
||||
}).get().setScrollingDisabled(true, false), false).setDuration(0.3f);
|
||||
|
||||
c.addImageTextButton("$launcheditems", Icon.downOpen, Styles.clearTogglet, col::toggle).update(t -> {
|
||||
c.button("$launcheditems", Icon.downOpen, Styles.clearTogglet, col::toggle).update(t -> {
|
||||
t.setText(state.isMenu() ? "$launcheditems" : "$launchinfo");
|
||||
t.setChecked(col.isCollapsed());
|
||||
((Image)t.getChildren().get(1)).setDrawable(col.isCollapsed() ? Icon.upOpen : Icon.downOpen);
|
||||
|
||||
@@ -48,14 +48,14 @@ public class AboutDialog extends FloatingDialog{
|
||||
Table table = new Table(Tex.underline);
|
||||
table.margin(0);
|
||||
table.table(img -> {
|
||||
img.addImage().height(h - 5).width(40f).color(link.color);
|
||||
img.image().height(h - 5).width(40f).color(link.color);
|
||||
img.row();
|
||||
img.addImage().height(5).width(40f).color(link.color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
|
||||
img.image().height(5).width(40f).color(link.color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
|
||||
}).expandY();
|
||||
|
||||
table.table(i -> {
|
||||
i.background(Tex.buttonEdge3);
|
||||
i.addImage(link.icon);
|
||||
i.image(link.icon);
|
||||
}).size(h - 5, h);
|
||||
|
||||
table.table(inset -> {
|
||||
@@ -64,7 +64,7 @@ public class AboutDialog extends FloatingDialog{
|
||||
inset.labelWrap(link.description).width(w - 100f).color(Color.lightGray).growX();
|
||||
}).padLeft(8);
|
||||
|
||||
table.addImageButton(Icon.link, () -> {
|
||||
table.button(Icon.link, () -> {
|
||||
if(link.name.equals("wiki")) Events.fire(Trigger.openWiki);
|
||||
|
||||
if(!Core.net.openURI(link.link)){
|
||||
@@ -82,7 +82,7 @@ public class AboutDialog extends FloatingDialog{
|
||||
|
||||
addCloseButton();
|
||||
|
||||
buttons.addButton("$credits", this::showCredits).size(200f, 64f);
|
||||
buttons.button("$credits", this::showCredits).size(200f, 64f);
|
||||
|
||||
if(Core.graphics.isPortrait()){
|
||||
for(Cell<?> cell : buttons.getCells()){
|
||||
@@ -98,7 +98,7 @@ public class AboutDialog extends FloatingDialog{
|
||||
dialog.cont.add("$credits.text").fillX().wrap().get().setAlignment(Align.center);
|
||||
dialog.cont.row();
|
||||
if(!contributors.isEmpty()){
|
||||
dialog.cont.addImage().color(Pal.accent).fillX().height(3f).pad(3f);
|
||||
dialog.cont.image().color(Pal.accent).fillX().height(3f).pad(3f);
|
||||
dialog.cont.row();
|
||||
dialog.cont.add("$contributors");
|
||||
dialog.cont.row();
|
||||
|
||||
@@ -38,7 +38,7 @@ public class AdminsDialog extends FloatingDialog{
|
||||
|
||||
res.labelWrap("[LIGHT_GRAY]" + info.lastName).width(w - h - 24f);
|
||||
res.add().growX();
|
||||
res.addImageButton(Icon.cancel, () -> {
|
||||
res.button(Icon.cancel, () -> {
|
||||
ui.showConfirm("$confirm", "$confirmunadmin", () -> {
|
||||
netServer.admins.unAdminPlayer(info.id);
|
||||
Groups.player.each(player -> {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class BansDialog extends FloatingDialog{
|
||||
|
||||
res.labelWrap("IP: [LIGHT_GRAY]" + info.lastIP + "\n[]Name: [LIGHT_GRAY]" + info.lastName).width(w - h - 24f);
|
||||
res.add().growX();
|
||||
res.addImageButton(Icon.cancel, () -> {
|
||||
res.button(Icon.cancel, () -> {
|
||||
ui.showConfirm("$confirm", "$confirmunban", () -> {
|
||||
netServer.admins.unbanPlayerID(info.id);
|
||||
setup();
|
||||
|
||||
@@ -38,24 +38,24 @@ public class ColorPicker extends FloatingDialog{
|
||||
|
||||
t.defaults().padBottom(4);
|
||||
t.add("R").color(Pal.remove);
|
||||
t.addSlider(0f, 1f, 0.01f, current.r, current::r).width(w);
|
||||
t.slider(0f, 1f, 0.01f, current.r, current::r).width(w);
|
||||
t.row();
|
||||
t.add("G").color(Color.lime);
|
||||
t.addSlider(0f, 1f, 0.01f, current.g, current::g).width(w);
|
||||
t.slider(0f, 1f, 0.01f, current.g, current::g).width(w);
|
||||
t.row();
|
||||
t.add("B").color(Color.royal);
|
||||
t.addSlider(0f, 1f, 0.01f, current.b, current::b).width(w);
|
||||
t.slider(0f, 1f, 0.01f, current.b, current::b).width(w);
|
||||
t.row();
|
||||
if(alpha){
|
||||
t.add("A");
|
||||
t.addSlider(0f, 1f, 0.01f, current.a, current::a).width(w);
|
||||
t.slider(0f, 1f, 0.01f, current.a, current::a).width(w);
|
||||
t.row();
|
||||
}
|
||||
});
|
||||
|
||||
buttons.clear();
|
||||
addCloseButton();
|
||||
buttons.addImageTextButton("$ok", Icon.ok, () -> {
|
||||
buttons.button("$ok", Icon.ok, () -> {
|
||||
cons.get(current);
|
||||
hide();
|
||||
});
|
||||
|
||||
@@ -17,10 +17,10 @@ public class ControlsDialog extends KeybindDialog{
|
||||
|
||||
@Override
|
||||
public void addCloseButton(){
|
||||
buttons.addImageTextButton("$back", Icon.left, this::hide).size(230f, 64f);
|
||||
buttons.button("$back", Icon.left, this::hide).size(230f, 64f);
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK)
|
||||
if(key == KeyCode.escape || key == KeyCode.back)
|
||||
hide();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -62,14 +62,14 @@ public class CustomGameDialog extends FloatingDialog{
|
||||
for(Gamemode mode : Gamemode.all){
|
||||
TextureRegionDrawable icon = Vars.ui.getIcon("mode" + Strings.capitalize(mode.name()) + "Small");
|
||||
if(mode.valid(map) && Core.atlas.isFound(icon.getRegion())){
|
||||
t.addImage(icon).size(16f).pad(4f);
|
||||
t.image(icon).size(16f).pad(4f);
|
||||
}
|
||||
}
|
||||
}).left();
|
||||
image.row();
|
||||
image.add(map.name()).pad(1f).growX().wrap().left().get().setEllipsis(true);
|
||||
image.row();
|
||||
image.addImage(Tex.whiteui, Pal.gray).growX().pad(3).height(4f);
|
||||
image.image(Tex.whiteui, Pal.gray).growX().pad(3).height(4f);
|
||||
image.row();
|
||||
image.add(img).size(images);
|
||||
|
||||
|
||||
@@ -35,12 +35,12 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
banDialog.addCloseButton();
|
||||
|
||||
banDialog.shown(this::rebuildBanned);
|
||||
banDialog.buttons.addImageTextButton("$addall", Icon.add, () -> {
|
||||
banDialog.buttons.button("$addall", Icon.add, () -> {
|
||||
rules.bannedBlocks.addAll(content.blocks().select(Block::isBuildable));
|
||||
rebuildBanned();
|
||||
}).size(180, 64f);
|
||||
|
||||
banDialog.buttons.addImageTextButton("$clear", Icon.trash, () -> {
|
||||
banDialog.buttons.button("$clear", Icon.trash, () -> {
|
||||
rules.bannedBlocks.clear();
|
||||
rebuildBanned();
|
||||
}).size(180, 64f);
|
||||
@@ -69,10 +69,10 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
for(Block block : array){
|
||||
t.table(Tex.underline, b -> {
|
||||
b.left().margin(4f);
|
||||
b.addImage(block.icon(Cicon.medium)).size(Cicon.medium.size).padRight(3);
|
||||
b.image(block.icon(Cicon.medium)).size(Cicon.medium.size).padRight(3);
|
||||
b.add(block.localizedName).color(Color.lightGray).padLeft(3).growX().left().wrap();
|
||||
|
||||
b.addImageButton(Icon.cancel, Styles.clearPartiali, () -> {
|
||||
b.button(Icon.cancel, Styles.clearPartiali, () -> {
|
||||
rules.bannedBlocks.remove(block);
|
||||
rebuildBanned();
|
||||
}).size(70f).pad(-4f).padLeft(0f);
|
||||
@@ -84,14 +84,14 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
}
|
||||
}).get().setScrollYForce(previousScroll);
|
||||
banDialog.cont.row();
|
||||
banDialog.cont.addImageTextButton("$add", Icon.add, () -> {
|
||||
banDialog.cont.button("$add", Icon.add, () -> {
|
||||
FloatingDialog dialog = new FloatingDialog("$add");
|
||||
dialog.cont.pane(t -> {
|
||||
t.left().margin(14f);
|
||||
int[] i = {0};
|
||||
content.blocks().each(b -> !rules.bannedBlocks.contains(b) && b.isBuildable(), b -> {
|
||||
int cols = mobile && Core.graphics.isPortrait() ? 4 : 12;
|
||||
t.addImageButton(new TextureRegionDrawable(b.icon(Cicon.medium)), Styles.cleari, () -> {
|
||||
t.button(new TextureRegionDrawable(b.icon(Cicon.medium)), Styles.cleari, () -> {
|
||||
rules.bannedBlocks.add(b);
|
||||
rebuildBanned();
|
||||
dialog.hide();
|
||||
@@ -118,7 +118,7 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
cont.clear();
|
||||
cont.pane(m -> main = m).get().setScrollingDisabled(true, false);
|
||||
main.margin(10f);
|
||||
main.addButton("$settings.reset", () -> {
|
||||
main.button("$settings.reset", () -> {
|
||||
rules = resetter.get();
|
||||
setup();
|
||||
requestKeyboard();
|
||||
@@ -145,7 +145,7 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
number("$rules.deconstructrefundmultiplier", false, f -> rules.deconstructRefundMultiplier = f, () -> rules.deconstructRefundMultiplier, () -> !rules.infiniteResources);
|
||||
number("$rules.blockhealthmultiplier", f -> rules.blockHealthMultiplier = f, () -> rules.blockHealthMultiplier);
|
||||
|
||||
main.addButton("$configure",
|
||||
main.button("$configure",
|
||||
() -> loadoutDialog.show(Blocks.coreShard.itemCapacity, rules.loadout,
|
||||
() -> {
|
||||
rules.loadout.clear();
|
||||
@@ -154,7 +154,7 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
)).left().width(300f);
|
||||
main.row();
|
||||
|
||||
main.addButton("$bannedblocks", banDialog::show).left().width(300f);
|
||||
main.button("$bannedblocks", banDialog::show).left().width(300f);
|
||||
main.row();
|
||||
|
||||
title("$rules.title.player");
|
||||
@@ -176,7 +176,7 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
number("$rules.solarpowermultiplier", f -> rules.solarPowerMultiplier = f, () -> rules.solarPowerMultiplier);
|
||||
check("$rules.lighting", b -> rules.lighting = b, () -> rules.lighting);
|
||||
|
||||
main.addButton(b -> {
|
||||
main.button(b -> {
|
||||
b.left();
|
||||
b.table(Tex.pane, in -> {
|
||||
in.stack(new Image(Tex.alphaBg), new Image(Tex.whiteui){{
|
||||
@@ -197,7 +197,7 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
t.left();
|
||||
t.add(text).left().padRight(5)
|
||||
.update(a -> a.setColor(condition.get() ? Color.white : Color.gray));
|
||||
Vars.platform.addDialog(t.addField((integer ? (int)prov.get() : prov.get()) + "", s -> cons.get(Strings.parseFloat(s)))
|
||||
Vars.platform.addDialog(t.field((integer ? (int)prov.get() : prov.get()) + "", s -> cons.get(Strings.parseFloat(s)))
|
||||
.padRight(100f)
|
||||
.update(a -> a.setDisabled(!condition.get()))
|
||||
.valid(Strings::canParsePositiveFloat).width(120f).left().get());
|
||||
@@ -210,14 +210,14 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
void check(String text, Boolc cons, Boolp prov, Boolp condition){
|
||||
main.addCheck(text, cons).checked(prov.get()).update(a -> a.setDisabled(!condition.get())).padRight(100f).get().left();
|
||||
main.check(text, cons).checked(prov.get()).update(a -> a.setDisabled(!condition.get())).padRight(100f).get().left();
|
||||
main.row();
|
||||
}
|
||||
|
||||
void title(String text){
|
||||
main.add(text).color(Pal.accent).padTop(20).padRight(100f).padBottom(-3);
|
||||
main.row();
|
||||
main.addImage().color(Pal.accent).height(3f).padRight(100f).padBottom(20);
|
||||
main.image().color(Pal.accent).height(3f).padRight(100f).padBottom(20);
|
||||
main.row();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.core.GameState.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.ctype.ContentType;
|
||||
import mindustry.gen.*;
|
||||
@@ -46,7 +45,7 @@ public class DatabaseDialog extends FloatingDialog{
|
||||
|
||||
table.add("$content." + type.name() + ".name").growX().left().color(Pal.accent);
|
||||
table.row();
|
||||
table.addImage().growX().pad(5).padLeft(0).padRight(0).height(3).color(Pal.accent);
|
||||
table.image().growX().pad(5).padLeft(0).padRight(0).height(3).color(Pal.accent);
|
||||
table.row();
|
||||
table.table(list -> {
|
||||
list.left();
|
||||
@@ -69,7 +68,7 @@ public class DatabaseDialog extends FloatingDialog{
|
||||
|
||||
if(unlocked(unlock)){
|
||||
image.clicked(() -> {
|
||||
if(Core.input.keyDown(KeyCode.SHIFT_LEFT) && Fonts.getUnicode(unlock.name) != 0){
|
||||
if(Core.input.keyDown(KeyCode.shiftLeft) && Fonts.getUnicode(unlock.name) != 0){
|
||||
Core.app.setClipboardText((char)Fonts.getUnicode(unlock.name) + "");
|
||||
ui.showInfoFade("$copied");
|
||||
}else{
|
||||
|
||||
@@ -23,14 +23,14 @@ public class DiscordDialog extends Dialog{
|
||||
t.background(Tex.button).margin(0);
|
||||
|
||||
t.table(img -> {
|
||||
img.addImage().height(h - 5).width(40f).color(color);
|
||||
img.image().height(h - 5).width(40f).color(color);
|
||||
img.row();
|
||||
img.addImage().height(5).width(40f).color(color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
|
||||
img.image().height(5).width(40f).color(color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
|
||||
}).expandY();
|
||||
|
||||
t.table(i -> {
|
||||
i.background(Tex.button);
|
||||
i.addImage(Icon.discord);
|
||||
i.image(Icon.discord);
|
||||
}).size(h).left();
|
||||
|
||||
t.add("$discord").color(Pal.accent).growX().padLeft(10f);
|
||||
@@ -38,11 +38,11 @@ public class DiscordDialog extends Dialog{
|
||||
|
||||
buttons.defaults().size(150f, 50);
|
||||
|
||||
buttons.addButton("$back", this::hide);
|
||||
buttons.addButton("$copylink", () -> {
|
||||
buttons.button("$back", this::hide);
|
||||
buttons.button("$copylink", () -> {
|
||||
Core.app.setClipboardText(discordURL);
|
||||
});
|
||||
buttons.addButton("$openlink", () -> {
|
||||
buttons.button("$openlink", () -> {
|
||||
if(!Core.net.openURI(discordURL)){
|
||||
ui.showErrorMessage("$linkfail");
|
||||
Core.app.setClipboardText(discordURL);
|
||||
|
||||
@@ -20,7 +20,7 @@ public class FloatingDialog extends Dialog{
|
||||
setFillParent(true);
|
||||
this.title.setAlignment(Align.center);
|
||||
titleTable.row();
|
||||
titleTable.addImage(Tex.whiteui, Pal.accent)
|
||||
titleTable.image(Tex.whiteui, Pal.accent)
|
||||
.growX().height(3f).pad(4f);
|
||||
|
||||
hidden(() -> {
|
||||
@@ -56,10 +56,10 @@ public class FloatingDialog extends Dialog{
|
||||
@Override
|
||||
public void addCloseButton(){
|
||||
buttons.defaults().size(210f, 64f);
|
||||
buttons.addImageTextButton("$back", Icon.left, this::hide).size(210f, 64f);
|
||||
buttons.button("$back", Icon.left, this::hide).size(210f, 64f);
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK){
|
||||
if(key == KeyCode.escape || key == KeyCode.back){
|
||||
Core.app.post(this::hide);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ public class GameOverDialog extends FloatingDialog{
|
||||
|
||||
if(state.rules.pvp){
|
||||
cont.add(Core.bundle.format("gameover.pvp", winner.localized())).pad(6);
|
||||
buttons.addButton("$menu", () -> {
|
||||
buttons.button("$menu", () -> {
|
||||
hide();
|
||||
logic.reset();
|
||||
}).size(130f, 60f);
|
||||
@@ -71,7 +71,7 @@ public class GameOverDialog extends FloatingDialog{
|
||||
if(state.stats.itemsDelivered.get(item, 0) > 0){
|
||||
t.table(items -> {
|
||||
items.add(" [LIGHT_GRAY]" + state.stats.itemsDelivered.get(item, 0));
|
||||
items.addImage(item.icon(Cicon.small)).size(8 * 3).pad(4);
|
||||
items.image(item.icon(Cicon.small)).size(8 * 3).pad(4);
|
||||
}).left();
|
||||
t.row();
|
||||
}
|
||||
@@ -86,13 +86,13 @@ public class GameOverDialog extends FloatingDialog{
|
||||
}).pad(12);
|
||||
|
||||
if(state.isCampaign()){
|
||||
buttons.addButton("$continue", () -> {
|
||||
buttons.button("$continue", () -> {
|
||||
hide();
|
||||
logic.reset();
|
||||
ui.planet.show();
|
||||
}).size(130f, 60f);
|
||||
}else{
|
||||
buttons.addButton("$menu", () -> {
|
||||
buttons.button("$menu", () -> {
|
||||
hide();
|
||||
logic.reset();
|
||||
}).size(130f, 60f);
|
||||
|
||||
@@ -22,14 +22,14 @@ public class HostDialog extends FloatingDialog{
|
||||
|
||||
cont.table(t -> {
|
||||
t.add("$name").padRight(10);
|
||||
t.addField(Core.settings.getString("name"), text -> {
|
||||
t.field(Core.settings.getString("name"), text -> {
|
||||
player.name(text);
|
||||
Core.settings.put("name", text);
|
||||
Core.settings.save();
|
||||
ui.listfrag.rebuild();
|
||||
}).grow().pad(8).get().setMaxLength(40);
|
||||
|
||||
ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
||||
ImageButton button = t.button(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
||||
new PaletteDialog().show(color -> {
|
||||
player.color().set(color);
|
||||
Core.settings.put("color-0", color.rgba());
|
||||
@@ -43,7 +43,7 @@ public class HostDialog extends FloatingDialog{
|
||||
|
||||
cont.add().width(65f);
|
||||
|
||||
cont.addButton("$host", () -> {
|
||||
cont.button("$host", () -> {
|
||||
if(Core.settings.getString("name").trim().isEmpty()){
|
||||
ui.showInfo("$noname");
|
||||
return;
|
||||
@@ -52,7 +52,7 @@ public class HostDialog extends FloatingDialog{
|
||||
runHost();
|
||||
}).width(w).height(70f);
|
||||
|
||||
cont.addButton("?", () -> ui.showInfo("$host.info")).size(65f, 70f).padLeft(6f);
|
||||
cont.button("?", () -> ui.showInfo("$host.info")).size(65f, 70f).padLeft(6f);
|
||||
|
||||
shown(() -> {
|
||||
if(!steam){
|
||||
|
||||
@@ -41,13 +41,13 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
buttons.add().growX().width(-1);
|
||||
if(!steam){
|
||||
buttons.addButton("?", () -> ui.showInfo("$join.info")).size(60f, 64f).width(-1);
|
||||
buttons.button("?", () -> ui.showInfo("$join.info")).size(60f, 64f).width(-1);
|
||||
}
|
||||
|
||||
add = new FloatingDialog("$joingame.title");
|
||||
add.cont.add("$joingame.ip").padRight(5f).left();
|
||||
|
||||
TextField field = add.cont.addField(Core.settings.getString("ip"), text -> {
|
||||
TextField field = add.cont.field(Core.settings.getString("ip"), text -> {
|
||||
Core.settings.put("ip", text);
|
||||
Core.settings.save();
|
||||
}).size(320f, 54f).get();
|
||||
@@ -56,8 +56,8 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
add.cont.row();
|
||||
add.buttons.defaults().size(140f, 60f).pad(4f);
|
||||
add.buttons.addButton("$cancel", add::hide);
|
||||
add.buttons.addButton("$ok", () -> {
|
||||
add.buttons.button("$cancel", add::hide);
|
||||
add.buttons.button("$ok", () -> {
|
||||
if(renaming == null){
|
||||
Server server = new Server();
|
||||
server.setIP(Core.settings.getString("ip"));
|
||||
@@ -81,7 +81,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
}
|
||||
});
|
||||
|
||||
keyDown(KeyCode.F5, this::refreshAll);
|
||||
keyDown(KeyCode.f5, this::refreshAll);
|
||||
|
||||
shown(() -> {
|
||||
setup();
|
||||
@@ -111,7 +111,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
//why are java lambdas this bad
|
||||
TextButton[] buttons = {null};
|
||||
|
||||
TextButton button = buttons[0] = remote.addButton("[accent]" + server.displayIP(), Styles.cleart, () -> {
|
||||
TextButton button = buttons[0] = remote.button("[accent]" + server.displayIP(), Styles.cleart, () -> {
|
||||
if(!buttons[0].childrenPressed()){
|
||||
if(server.lastHost != null){
|
||||
safeConnect(server.ip, server.port, server.lastHost.version);
|
||||
@@ -129,26 +129,26 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
inner.add(button.getLabel()).growX();
|
||||
|
||||
inner.addImageButton(Icon.upOpen, Styles.emptyi, () -> {
|
||||
inner.button(Icon.upOpen, Styles.emptyi, () -> {
|
||||
moveRemote(server, -1);
|
||||
|
||||
}).margin(3f).padTop(6f).top().right();
|
||||
|
||||
inner.addImageButton(Icon.downOpen, Styles.emptyi, () -> {
|
||||
inner.button(Icon.downOpen, Styles.emptyi, () -> {
|
||||
moveRemote(server, +1);
|
||||
|
||||
}).margin(3f).pad(2).padTop(6f).top().right();
|
||||
|
||||
inner.addImageButton(Icon.refresh, Styles.emptyi, () -> {
|
||||
inner.button(Icon.refresh, Styles.emptyi, () -> {
|
||||
refreshServer(server);
|
||||
}).margin(3f).pad(2).padTop(6f).top().right();
|
||||
|
||||
inner.addImageButton(Icon.pencil, Styles.emptyi, () -> {
|
||||
inner.button(Icon.pencil, Styles.emptyi, () -> {
|
||||
renaming = server;
|
||||
add.show();
|
||||
}).margin(3f).pad(2).padTop(6f).top().right();
|
||||
|
||||
inner.addImageButton(Icon.trash, Styles.emptyi, () -> {
|
||||
inner.button(Icon.trash, Styles.emptyi, () -> {
|
||||
ui.showConfirm("$confirm", "$server.delete", () -> {
|
||||
servers.remove(server, true);
|
||||
saveServers();
|
||||
@@ -262,7 +262,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
cont.table(t -> {
|
||||
t.add("$name").padRight(10);
|
||||
if(!steam){
|
||||
t.addField(Core.settings.getString("name"), text -> {
|
||||
t.field(Core.settings.getString("name"), text -> {
|
||||
player.name(text);
|
||||
Core.settings.put("name", text);
|
||||
Core.settings.save();
|
||||
@@ -271,7 +271,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
t.add(player.name()).update(l -> l.setColor(player.color())).grow().pad(8);
|
||||
}
|
||||
|
||||
ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
||||
ImageButton button = t.button(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
||||
new PaletteDialog().show(color -> {
|
||||
player.color().set(color);
|
||||
Core.settings.put("color-0", color.rgba8888());
|
||||
@@ -283,7 +283,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
cont.row();
|
||||
cont.add(pane).width(w + 38).pad(0);
|
||||
cont.row();
|
||||
cont.addCenteredImageTextButton("$server.add", Icon.add, () -> {
|
||||
cont.buttonCenter("$server.add", Icon.add, () -> {
|
||||
renaming = null;
|
||||
add.show();
|
||||
}).marginLeft(10).width(w).height(80f).update(button -> {
|
||||
@@ -310,13 +310,13 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
hosts.table(name -> {
|
||||
name.add(label).pad(10).growX().left().color(Pal.accent);
|
||||
name.addImageButton(Icon.downOpen, Styles.emptyi, () -> {
|
||||
name.button(Icon.downOpen, Styles.emptyi, () -> {
|
||||
coll.toggle(false);
|
||||
Core.settings.putSave("collapsed-" + label, coll.isCollapsed());
|
||||
}).update(i -> i.getStyle().imageUp = (!coll.isCollapsed() ? Icon.upOpen : Icon.downOpen)).size(40f).right().padRight(10f);
|
||||
}).growX();
|
||||
hosts.row();
|
||||
hosts.addImage().growX().pad(5).padLeft(10).padRight(10).height(3).color(Pal.accent);
|
||||
hosts.image().growX().pad(5).padLeft(10).padRight(10).height(3).color(Pal.accent);
|
||||
hosts.row();
|
||||
hosts.add(coll).width(targetWidth());
|
||||
hosts.row();
|
||||
@@ -350,7 +350,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
local.background(Tex.button);
|
||||
local.add("$hosts.none").pad(10f);
|
||||
local.add().growX();
|
||||
local.addImageButton(Icon.refresh, this::refreshLocal).pad(-12f).padLeft(0).size(70f);
|
||||
local.button(Icon.refresh, this::refreshLocal).pad(-12f).padLeft(0).size(70f);
|
||||
}else{
|
||||
local.background(null);
|
||||
}
|
||||
@@ -366,7 +366,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
local.row();
|
||||
|
||||
TextButton button = local.addButton("", Styles.cleart, () -> safeConnect(host.address, host.port, host.version))
|
||||
TextButton button = local.button("", Styles.cleart, () -> safeConnect(host.address, host.port, host.version))
|
||||
.width(w).pad(5f).get();
|
||||
button.clearChildren();
|
||||
buildServer(host, button);
|
||||
@@ -378,7 +378,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
global.row();
|
||||
|
||||
TextButton button = global.addButton("", Styles.cleart, () -> safeConnect(host.address, host.port, host.version))
|
||||
TextButton button = global.button("", Styles.cleart, () -> safeConnect(host.address, host.port, host.version))
|
||||
.width(w).pad(5f).get();
|
||||
button.clearChildren();
|
||||
buildServer(host, button);
|
||||
|
||||
@@ -70,25 +70,25 @@ public class LoadDialog extends FloatingDialog{
|
||||
t.right();
|
||||
t.defaults().size(40f);
|
||||
|
||||
t.addImageButton(Icon.save, Styles.emptytogglei, () -> {
|
||||
t.button(Icon.save, Styles.emptytogglei, () -> {
|
||||
slot.setAutosave(!slot.isAutosave());
|
||||
}).checked(slot.isAutosave()).right();
|
||||
|
||||
t.addImageButton(Icon.trash, Styles.emptyi, () -> {
|
||||
t.button(Icon.trash, Styles.emptyi, () -> {
|
||||
ui.showConfirm("$confirm", "$save.delete.confirm", () -> {
|
||||
slot.delete();
|
||||
setup();
|
||||
});
|
||||
}).right();
|
||||
|
||||
t.addImageButton(Icon.pencil, Styles.emptyi, () -> {
|
||||
t.button(Icon.pencil, Styles.emptyi, () -> {
|
||||
ui.showTextInput("$save.rename", "$save.rename.text", slot.getName(), text -> {
|
||||
slot.setName(text);
|
||||
setup();
|
||||
});
|
||||
}).right();
|
||||
|
||||
t.addImageButton(Icon.export, Styles.emptyi, () -> platform.export("save-" + slot.getName(), saveExtension, slot::exportFile)).right();
|
||||
t.button(Icon.export, Styles.emptyi, () -> platform.export("save-" + slot.getName(), saveExtension, slot::exportFile)).right();
|
||||
|
||||
}).padRight(-10).growX();
|
||||
}).growX().colspan(2);
|
||||
@@ -142,13 +142,13 @@ public class LoadDialog extends FloatingDialog{
|
||||
|
||||
if(!valids){
|
||||
slots.row();
|
||||
slots.addButton("$save.none", () -> {
|
||||
slots.button("$save.none", () -> {
|
||||
}).disabled(true).fillX().margin(20f).minWidth(340f).height(80f).pad(4f);
|
||||
}
|
||||
|
||||
slots.row();
|
||||
|
||||
slots.addImageTextButton("$save.import", Icon.add, () -> {
|
||||
slots.button("$save.import", Icon.add, () -> {
|
||||
platform.showFileChooser(true, saveExtension, file -> {
|
||||
if(SaveIO.isSaveValid(file)){
|
||||
try{
|
||||
|
||||
@@ -26,7 +26,7 @@ public class LoadoutDialog extends FloatingDialog{
|
||||
setFillParent(true);
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK){
|
||||
if(key == KeyCode.escape || key == KeyCode.back){
|
||||
Core.app.post(this::hide);
|
||||
}
|
||||
});
|
||||
@@ -42,9 +42,9 @@ public class LoadoutDialog extends FloatingDialog{
|
||||
}
|
||||
});
|
||||
|
||||
buttons.addImageTextButton("$back", Icon.left, this::hide).size(210f, 64f);
|
||||
buttons.button("$back", Icon.left, this::hide).size(210f, 64f);
|
||||
|
||||
buttons.addImageTextButton("$settings.reset", Icon.refresh, () -> {
|
||||
buttons.button("$settings.reset", Icon.refresh, () -> {
|
||||
resetter.run();
|
||||
reseed();
|
||||
updater.run();
|
||||
@@ -73,17 +73,17 @@ public class LoadoutDialog extends FloatingDialog{
|
||||
for(ItemStack stack : stacks){
|
||||
items.table(Tex.pane, t -> {
|
||||
t.margin(4).marginRight(8).left();
|
||||
t.addButton("-", Styles.cleart, () -> {
|
||||
t.button("-", Styles.cleart, () -> {
|
||||
stack.amount = Math.max(stack.amount - step(stack.amount), 0);
|
||||
updater.run();
|
||||
}).size(bsize);
|
||||
|
||||
t.addButton("+", Styles.cleart, () -> {
|
||||
t.button("+", Styles.cleart, () -> {
|
||||
stack.amount = Math.min(stack.amount + step(stack.amount), capacity);
|
||||
updater.run();
|
||||
}).size(bsize);
|
||||
|
||||
t.addImageButton(Icon.pencil, Styles.cleari, () -> ui.showTextInput("$configure", stack.item.localizedName, 10, stack.amount + "", true, str -> {
|
||||
t.button(Icon.pencil, Styles.cleari, () -> ui.showTextInput("$configure", stack.item.localizedName, 10, stack.amount + "", true, str -> {
|
||||
if(Strings.canParsePostiveInt(str)){
|
||||
int amount = Strings.parseInt(str);
|
||||
if(amount >= 0 && amount <= capacity){
|
||||
@@ -95,7 +95,7 @@ public class LoadoutDialog extends FloatingDialog{
|
||||
ui.showInfo(Core.bundle.format("configure.invalid", capacity));
|
||||
})).size(bsize);
|
||||
|
||||
t.addImage(stack.item.icon(Cicon.small)).size(8 * 3).padRight(4).padLeft(4);
|
||||
t.image(stack.item.icon(Cicon.small)).size(8 * 3).padRight(4).padLeft(4);
|
||||
t.label(() -> stack.amount + "").left().width(90f);
|
||||
}).pad(2).left().fillX();
|
||||
|
||||
|
||||
@@ -56,18 +56,18 @@ public class MapPlayDialog extends FloatingDialog{
|
||||
for(Gamemode mode : Gamemode.values()){
|
||||
if(mode.hidden) continue;
|
||||
|
||||
modes.addButton(mode.toString(), Styles.togglet, () -> {
|
||||
modes.button(mode.toString(), Styles.togglet, () -> {
|
||||
selectedGamemode = mode;
|
||||
rules = map.applyRules(mode);
|
||||
}).update(b -> b.setChecked(selectedGamemode == mode)).size(140f, 54f).disabled(!mode.valid(map));
|
||||
if(i++ % 2 == 1) modes.row();
|
||||
}
|
||||
selmode.add(modes);
|
||||
selmode.addButton("?", this::displayGameModeHelp).width(50f).fillY().padLeft(18f);
|
||||
selmode.button("?", this::displayGameModeHelp).width(50f).fillY().padLeft(18f);
|
||||
|
||||
cont.add(selmode);
|
||||
cont.row();
|
||||
cont.addImageTextButton("$customize", Icon.settings, () -> dialog.show(rules, () -> rules = map.applyRules(selectedGamemode))).width(230);
|
||||
cont.button("$customize", Icon.settings, () -> dialog.show(rules, () -> rules = map.applyRules(selectedGamemode))).width(230);
|
||||
cont.row();
|
||||
cont.add(new BorderImage(map.safeTexture(), 3f)).size(mobile && !Core.graphics.isPortrait() ? 150f : 250f).get().setScaling(Scaling.fit);
|
||||
//only maps with survival are valid for high scores
|
||||
@@ -79,7 +79,7 @@ public class MapPlayDialog extends FloatingDialog{
|
||||
buttons.clearChildren();
|
||||
addCloseButton();
|
||||
|
||||
buttons.addImageTextButton("$play", Icon.play, () -> {
|
||||
buttons.button("$play", Icon.play, () -> {
|
||||
control.playMap(map, rules);
|
||||
hide();
|
||||
ui.custom.hide();
|
||||
@@ -103,7 +103,7 @@ public class MapPlayDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
d.cont.add(pane);
|
||||
d.buttons.addButton("$ok", d::hide).size(110, 50).pad(10f);
|
||||
d.buttons.button("$ok", d::hide).size(110, 50).pad(10f);
|
||||
d.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class MapsDialog extends FloatingDialog{
|
||||
buttons.remove();
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK){
|
||||
if(key == KeyCode.escape || key == KeyCode.back){
|
||||
Core.app.post(this::hide);
|
||||
}
|
||||
});
|
||||
@@ -44,13 +44,13 @@ public class MapsDialog extends FloatingDialog{
|
||||
buttons.clearChildren();
|
||||
|
||||
if(Core.graphics.isPortrait()){
|
||||
buttons.addImageTextButton("$back", Icon.left, this::hide).size(210f*2f, 64f).colspan(2);
|
||||
buttons.button("$back", Icon.left, this::hide).size(210f*2f, 64f).colspan(2);
|
||||
buttons.row();
|
||||
}else{
|
||||
buttons.addImageTextButton("$back", Icon.left, this::hide).size(210f, 64f);
|
||||
buttons.button("$back", Icon.left, this::hide).size(210f, 64f);
|
||||
}
|
||||
|
||||
buttons.addImageTextButton("$editor.newmap", Icon.add, () -> {
|
||||
buttons.button("$editor.newmap", Icon.add, () -> {
|
||||
ui.showTextInput("$editor.newmap", "$editor.mapname", "", text -> {
|
||||
Runnable show = () -> ui.loadAnd(() -> {
|
||||
hide();
|
||||
@@ -67,7 +67,7 @@ public class MapsDialog extends FloatingDialog{
|
||||
});
|
||||
}).size(210f, 64f);
|
||||
|
||||
buttons.addImageTextButton("$editor.importmap", Icon.upload, () -> {
|
||||
buttons.button("$editor.importmap", Icon.upload, () -> {
|
||||
platform.showFileChooser(true, mapExtension, file -> {
|
||||
ui.loadAnd(() -> {
|
||||
maps.tryCatchMapError(() -> {
|
||||
@@ -134,12 +134,12 @@ public class MapsDialog extends FloatingDialog{
|
||||
maps.row();
|
||||
}
|
||||
|
||||
TextButton button = maps.addButton("", Styles.cleart, () -> showMapInfo(map)).width(mapsize).pad(8).get();
|
||||
TextButton button = maps.button("", Styles.cleart, () -> showMapInfo(map)).width(mapsize).pad(8).get();
|
||||
button.clearChildren();
|
||||
button.margin(9);
|
||||
button.add(map.name()).width(mapsize - 18f).center().get().setEllipsis(true);
|
||||
button.row();
|
||||
button.addImage().growX().pad(4).color(Pal.gray);
|
||||
button.image().growX().pad(4).color(Pal.gray);
|
||||
button.row();
|
||||
button.stack(new Image(map.safeTexture()).setScaling(Scaling.fit), new BorderImage(map.safeTexture()).setScaling(Scaling.fit)).size(mapsize - 20f);
|
||||
button.row();
|
||||
@@ -192,7 +192,7 @@ public class MapsDialog extends FloatingDialog{
|
||||
|
||||
table.row();
|
||||
|
||||
table.addImageTextButton("$editor.openin", Icon.export, () -> {
|
||||
table.button("$editor.openin", Icon.export, () -> {
|
||||
try{
|
||||
Vars.ui.editor.beginEditMap(map.file);
|
||||
dialog.hide();
|
||||
@@ -203,7 +203,7 @@ public class MapsDialog extends FloatingDialog{
|
||||
}
|
||||
}).fillX().height(54f).marginLeft(10);
|
||||
|
||||
table.addImageTextButton(map.workshop && steam ? "$view.workshop" : "$delete", map.workshop && steam ? Icon.link : Icon.trash, () -> {
|
||||
table.button(map.workshop && steam ? "$view.workshop" : "$delete", map.workshop && steam ? Icon.link : Icon.trash, () -> {
|
||||
if(map.workshop && steam){
|
||||
platform.viewListing(map);
|
||||
}else{
|
||||
|
||||
@@ -28,7 +28,7 @@ public class MinimapDialog extends FloatingDialog{
|
||||
cont.clear();
|
||||
|
||||
cont.table(Tex.pane,t -> {
|
||||
t.addRect((x, y, width, height) -> {
|
||||
t.rect((x, y, width, height) -> {
|
||||
if(renderer.minimap.getRegion() == null) return;
|
||||
Draw.color(Color.white);
|
||||
Draw.alpha(parentAlpha);
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ModsDialog extends FloatingDialog{
|
||||
super("$mods");
|
||||
addCloseButton();
|
||||
|
||||
buttons.addImageTextButton("$mods.guide", Icon.link, () -> Core.net.openURI(modGuideURL)).size(210, 64f);
|
||||
buttons.button("$mods.guide", Icon.link, () -> Core.net.openURI(modGuideURL)).size(210, 64f);
|
||||
|
||||
|
||||
shown(this::setup);
|
||||
@@ -66,7 +66,7 @@ public class ModsDialog extends FloatingDialog{
|
||||
TextButtonStyle style = Styles.clearPartialt;
|
||||
float margin = 12f;
|
||||
|
||||
buttons.addImageTextButton("$mod.import", Icon.add, style, () -> {
|
||||
buttons.button("$mod.import", Icon.add, style, () -> {
|
||||
FloatingDialog dialog = new FloatingDialog("$mod.import");
|
||||
|
||||
TextButtonStyle bstyle = Styles.cleart;
|
||||
@@ -75,7 +75,7 @@ public class ModsDialog extends FloatingDialog{
|
||||
t.defaults().size(300f, 70f);
|
||||
t.margin(12f);
|
||||
|
||||
t.addImageTextButton("$mod.import.file", Icon.file, bstyle, () -> {
|
||||
t.button("$mod.import.file", Icon.file, bstyle, () -> {
|
||||
dialog.hide();
|
||||
|
||||
platform.showFileChooser(true, "zip", file -> {
|
||||
@@ -91,7 +91,7 @@ public class ModsDialog extends FloatingDialog{
|
||||
|
||||
t.row();
|
||||
|
||||
t.addImageTextButton("$mod.import.github", Icon.github, bstyle, () -> {
|
||||
t.button("$mod.import.github", Icon.github, bstyle, () -> {
|
||||
dialog.hide();
|
||||
|
||||
ui.showTextInput("$mod.import.github", "", 64, "Anuken/ExampleMod", text -> {
|
||||
@@ -131,10 +131,10 @@ public class ModsDialog extends FloatingDialog{
|
||||
dialog.show();
|
||||
}).margin(margin);
|
||||
|
||||
buttons.addImageTextButton("$mods.reload", Icon.refresh, style, this::reload).margin(margin);
|
||||
buttons.button("$mods.reload", Icon.refresh, style, this::reload).margin(margin);
|
||||
|
||||
if(!mobile){
|
||||
buttons.addImageTextButton("$mods.openfolder", Icon.link, style, () -> Core.app.openFolder(modDirectory.absolutePath())).margin(margin);
|
||||
buttons.button("$mods.openfolder", Icon.link, style, () -> Core.app.openFolder(modDirectory.absolutePath())).margin(margin);
|
||||
}
|
||||
}).width(w);
|
||||
|
||||
@@ -151,11 +151,11 @@ public class ModsDialog extends FloatingDialog{
|
||||
if(!mod.enabled() && !anyDisabled && mods.list().size > 0){
|
||||
anyDisabled = true;
|
||||
table.row();
|
||||
table.addImage().growX().height(4f).pad(6f).color(Pal.gray);
|
||||
table.image().growX().height(4f).pad(6f).color(Pal.gray);
|
||||
table.row();
|
||||
}
|
||||
|
||||
table.addButton(t -> {
|
||||
table.button(t -> {
|
||||
t.top().left();
|
||||
t.margin(12f);
|
||||
|
||||
@@ -176,26 +176,26 @@ public class ModsDialog extends FloatingDialog{
|
||||
Fonts.def.draw(letter, x + width/2f, y + height/2f, Align.center);
|
||||
}
|
||||
}
|
||||
}.border(Pal.accent)).size(h - 8f).padTop(-8f).padLeft(-8f).padRight(6f);
|
||||
}.border(Pal.accent)).size(h - 8f).padTop(-8f).padLeft(-8f).padRight(2f);
|
||||
|
||||
t.defaults().left().top();
|
||||
t.table(title -> {
|
||||
title.left();
|
||||
title.add("" + mod.meta.displayName() + "\n[lightgray]v" + mod.meta.version + (mod.enabled() ? "" : "\n" + Core.bundle.get("mod.disabled") + "")).growX();
|
||||
title.add("" + mod.meta.displayName() + "\n[lightgray]v" + mod.meta.version + (mod.enabled() ? "" : "\n" + Core.bundle.get("mod.disabled") + "")).wrap().width(170f).growX();
|
||||
title.add().growX();
|
||||
|
||||
title.addImageTextButton(mod.enabled() ? "$mod.disable" : "$mod.enable", mod.enabled() ? Icon.downOpen : Icon.upOpen, Styles.transt, () -> {
|
||||
title.button(mod.enabled() ? "$mod.disable" : "$mod.enable", mod.enabled() ? Icon.downOpen : Icon.upOpen, Styles.transt, () -> {
|
||||
mods.setEnabled(mod, !mod.enabled());
|
||||
setup();
|
||||
}).height(50f).margin(8f).width(130f).disabled(!mod.isSupported());
|
||||
|
||||
if(steam && !mod.hasSteamID()){
|
||||
title.addImageButton(Icon.download, Styles.clearTransi, () -> {
|
||||
title.button(Icon.download, Styles.clearTransi, () -> {
|
||||
platform.publish(mod);
|
||||
}).size(50f);
|
||||
}
|
||||
|
||||
title.addImageButton(mod.hasSteamID() ? Icon.link : Icon.trash, Styles.clearPartiali, () -> {
|
||||
title.button(mod.hasSteamID() ? Icon.link : Icon.trash, Styles.clearPartiali, () -> {
|
||||
if(!mod.hasSteamID()){
|
||||
ui.showConfirm("$confirm", "$mod.remove.confirm", () -> {
|
||||
mods.removeMod(mod);
|
||||
@@ -250,7 +250,7 @@ public class ModsDialog extends FloatingDialog{
|
||||
dialog.addCloseButton();
|
||||
|
||||
if(!mobile){
|
||||
dialog.buttons.addImageTextButton("$mods.openfolder", Icon.link, () -> Core.app.openFolder(mod.file.absolutePath()));
|
||||
dialog.buttons.button("$mods.openfolder", Icon.link, () -> Core.app.openFolder(mod.file.absolutePath()));
|
||||
}
|
||||
|
||||
//TODO improve this menu later
|
||||
|
||||
@@ -25,7 +25,7 @@ public class PaletteDialog extends Dialog{
|
||||
for(int i = 0; i < playerColors.length; i++){
|
||||
Color color = playerColors[i];
|
||||
|
||||
ImageButton button = table.addImageButton(Tex.whiteui, Styles.clearTogglei, 34, () -> {
|
||||
ImageButton button = table.button(Tex.whiteui, Styles.clearTogglei, 34, () -> {
|
||||
cons.get(color);
|
||||
hide();
|
||||
}).size(48).get();
|
||||
@@ -38,7 +38,7 @@ public class PaletteDialog extends Dialog{
|
||||
}
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK)
|
||||
if(key == KeyCode.escape || key == KeyCode.back)
|
||||
hide();
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public class PausedDialog extends FloatingDialog{
|
||||
shown(this::rebuild);
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK){
|
||||
if(key == KeyCode.escape || key == KeyCode.back){
|
||||
hide();
|
||||
}
|
||||
});
|
||||
@@ -37,26 +37,26 @@ public class PausedDialog extends FloatingDialog{
|
||||
float dw = 220f;
|
||||
cont.defaults().width(dw).height(55).pad(5f);
|
||||
|
||||
cont.addImageTextButton("$back", Icon.left, this::hide).colspan(2).width(dw * 2 + 20f);
|
||||
cont.button("$back", Icon.left, this::hide).colspan(2).width(dw * 2 + 20f);
|
||||
|
||||
cont.row();
|
||||
if(state.isCampaign()){
|
||||
cont.addImageTextButton("$techtree", Icon.tree, ui.tech::show);
|
||||
cont.button("$techtree", Icon.tree, ui.tech::show);
|
||||
}else{
|
||||
cont.addImageTextButton("$database", Icon.book, ui.database::show);
|
||||
cont.button("$database", Icon.book, ui.database::show);
|
||||
}
|
||||
cont.addImageTextButton("$settings", Icon.settings, ui.settings::show);
|
||||
cont.button("$settings", Icon.settings, ui.settings::show);
|
||||
|
||||
if(!state.rules.tutorial){
|
||||
if(!state.isCampaign() && !state.isEditor()){
|
||||
cont.row();
|
||||
cont.addImageTextButton("$savegame", Icon.save, save::show);
|
||||
cont.addImageTextButton("$loadgame", Icon.upload, load::show).disabled(b -> net.active());
|
||||
cont.button("$savegame", Icon.save, save::show);
|
||||
cont.button("$loadgame", Icon.upload, load::show).disabled(b -> net.active());
|
||||
}
|
||||
|
||||
cont.row();
|
||||
|
||||
cont.addImageTextButton("$hostserver", Icon.host, () -> {
|
||||
cont.button("$hostserver", Icon.host, () -> {
|
||||
if(net.server() && steam){
|
||||
platform.inviteFriends();
|
||||
}else{
|
||||
@@ -71,26 +71,26 @@ public class PausedDialog extends FloatingDialog{
|
||||
|
||||
cont.row();
|
||||
|
||||
cont.addImageTextButton("$quit", Icon.exit, this::showQuitConfirm).colspan(2).width(dw + 20f).update(s -> s.setText(control.saves.getCurrent() != null && control.saves.getCurrent().isAutosave() ? "$save.quit" : "$quit"));
|
||||
cont.button("$quit", Icon.exit, this::showQuitConfirm).colspan(2).width(dw + 20f).update(s -> s.setText(control.saves.getCurrent() != null && control.saves.getCurrent().isAutosave() ? "$save.quit" : "$quit"));
|
||||
|
||||
}else{
|
||||
cont.defaults().size(130f).pad(5);
|
||||
cont.addRowImageTextButton("$back", Icon.play, this::hide);
|
||||
cont.addRowImageTextButton("$settings", Icon.settings, ui.settings::show);
|
||||
cont.buttonRow("$back", Icon.play, this::hide);
|
||||
cont.buttonRow("$settings", Icon.settings, ui.settings::show);
|
||||
|
||||
if(!state.isCampaign() && !state.isEditor()){
|
||||
cont.addRowImageTextButton("$save", Icon.save, save::show);
|
||||
cont.buttonRow("$save", Icon.save, save::show);
|
||||
|
||||
cont.row();
|
||||
|
||||
cont.addRowImageTextButton("$load", Icon.download, load::show).disabled(b -> net.active());
|
||||
cont.buttonRow("$load", Icon.download, load::show).disabled(b -> net.active());
|
||||
}else{
|
||||
cont.row();
|
||||
}
|
||||
|
||||
cont.addRowImageTextButton("$hostserver.mobile", Icon.host, ui.host::show).disabled(b -> net.active());
|
||||
cont.buttonRow("$hostserver.mobile", Icon.host, ui.host::show).disabled(b -> net.active());
|
||||
|
||||
cont.addRowImageTextButton("$quit", Icon.exit, this::showQuitConfirm).update(s -> {
|
||||
cont.buttonRow("$quit", Icon.exit, this::showQuitConfirm).update(s -> {
|
||||
s.setText(control.saves.getCurrent() != null && control.saves.getCurrent().isAutosave() ? "$save.quit" : "$quit");
|
||||
s.getLabelCell().growX().wrap();
|
||||
});
|
||||
|
||||
@@ -92,7 +92,7 @@ public class PlanetDialog extends FloatingDialog{
|
||||
float bmargin = 6f;
|
||||
|
||||
//TODO names
|
||||
buttons.addImageTextButton("$back", Icon.left, style, this::hide).margin(bmargin);
|
||||
buttons.button("$back", Icon.left, style, this::hide).margin(bmargin);
|
||||
//buttons.addImageTextButton("Tech", Icon.tree, style, () -> ui.tech.show()).margin(bmargin);
|
||||
//buttons.addImageTextButton("Launch", Icon.upOpen, style, this::hide).margin(bmargin);
|
||||
//buttons.addImageTextButton("Database", Icon.book, style, () -> ui.database.show()).margin(bmargin);
|
||||
@@ -163,7 +163,7 @@ public class PlanetDialog extends FloatingDialog{
|
||||
cont.clear();
|
||||
titleTable.remove();
|
||||
|
||||
cont.addRect((x, y, w, h) -> render()).grow();
|
||||
cont.rect((x, y, w, h) -> render()).grow();
|
||||
}
|
||||
|
||||
private void render(){
|
||||
@@ -341,7 +341,7 @@ public class PlanetDialog extends FloatingDialog{
|
||||
//TODO add strings to bundle after prototyping is done
|
||||
|
||||
stable.add("[accent]" + selected.id).row();
|
||||
stable.addImage().color(Pal.accent).fillX().height(3f).pad(3f).row();
|
||||
stable.image().color(Pal.accent).fillX().height(3f).pad(3f).row();
|
||||
stable.add(selected.save != null ? selected.save.getPlayTime() : "[lightgray]Unexplored").row();
|
||||
|
||||
stable.add("Resources:").row();
|
||||
@@ -350,14 +350,14 @@ public class PlanetDialog extends FloatingDialog{
|
||||
int idx = 0;
|
||||
int max = 5;
|
||||
for(UnlockableContent c : selected.data.resources){
|
||||
t.addImage(c.icon(Cicon.small)).padRight(3);
|
||||
t.image(c.icon(Cicon.small)).padRight(3);
|
||||
if(++idx % max == 0) t.row();
|
||||
}
|
||||
}).fillX().row();
|
||||
|
||||
stable.row();
|
||||
|
||||
stable.addButton("Launch", Styles.transt, () -> {
|
||||
stable.button("Launch", Styles.transt, () -> {
|
||||
if(selected != null){
|
||||
if(selected.is(SectorAttribute.naval)){
|
||||
ui.showInfo("You need a naval loadout to launch here.");
|
||||
|
||||
@@ -3,7 +3,6 @@ package mindustry.ui.dialogs;
|
||||
import arc.Core;
|
||||
import arc.scene.ui.TextButton;
|
||||
import arc.util.Time;
|
||||
import mindustry.core.GameState.State;
|
||||
import mindustry.game.Saves.SaveSlot;
|
||||
import mindustry.gen.*;
|
||||
|
||||
@@ -23,7 +22,7 @@ public class SaveDialog extends LoadDialog{
|
||||
|
||||
public void addSetup(){
|
||||
slots.row();
|
||||
slots.addImageTextButton("$save.new", Icon.add, () ->
|
||||
slots.button("$save.new", Icon.add, () ->
|
||||
ui.showTextInput("$save", "$save.newslot", 30, "", text -> {
|
||||
ui.loadAnd("$saving", () -> {
|
||||
control.saves.addSave(text);
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
|
||||
shouldPause = true;
|
||||
addCloseButton();
|
||||
buttons.addImageTextButton("$schematic.import", Icon.download, this::showImport);
|
||||
buttons.button("$schematic.import", Icon.download, this::showImport);
|
||||
shown(this::setup);
|
||||
onResize(this::setup);
|
||||
}
|
||||
@@ -45,8 +45,8 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
|
||||
cont.table(s -> {
|
||||
s.left();
|
||||
s.addImage(Icon.zoom);
|
||||
s.addField(search, res -> {
|
||||
s.image(Icon.zoom);
|
||||
s.field(search, res -> {
|
||||
search = res;
|
||||
rebuildPane[0].run();
|
||||
}).growX();
|
||||
@@ -69,7 +69,7 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
if(!search.isEmpty() && !s.name().toLowerCase().contains(search.toLowerCase())) continue;
|
||||
|
||||
Button[] sel = {null};
|
||||
sel[0] = t.addButton(b -> {
|
||||
sel[0] = t.button(b -> {
|
||||
b.top();
|
||||
b.margin(0f);
|
||||
b.table(buttons -> {
|
||||
@@ -78,15 +78,15 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
|
||||
ImageButtonStyle style = Styles.clearPartiali;
|
||||
|
||||
buttons.addImageButton(Icon.info, style, () -> {
|
||||
buttons.button(Icon.info, style, () -> {
|
||||
showInfo(s);
|
||||
});
|
||||
|
||||
buttons.addImageButton(Icon.download, style, () -> {
|
||||
buttons.button(Icon.download, style, () -> {
|
||||
showExport(s);
|
||||
});
|
||||
|
||||
buttons.addImageButton(Icon.pencil, style, () -> {
|
||||
buttons.button(Icon.pencil, style, () -> {
|
||||
ui.showTextInput("$schematic.rename", "$name", s.name(), res -> {
|
||||
Schematic replacement = schematics.all().find(other -> other.name().equals(res) && other != s);
|
||||
if(replacement != null){
|
||||
@@ -102,9 +102,9 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
});
|
||||
|
||||
if(s.hasSteamID()){
|
||||
buttons.addImageButton(Icon.link, style, () -> platform.viewListing(s));
|
||||
buttons.button(Icon.link, style, () -> platform.viewListing(s));
|
||||
}else{
|
||||
buttons.addImageButton(Icon.trash, style, () -> {
|
||||
buttons.button(Icon.trash, style, () -> {
|
||||
if(s.mod != null){
|
||||
ui.showInfo(Core.bundle.format("mod.item.remove", s.mod.meta.displayName()));
|
||||
}else{
|
||||
@@ -160,7 +160,7 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
TextButtonStyle style = Styles.cleart;
|
||||
t.defaults().size(280f, 60f).left();
|
||||
t.row();
|
||||
t.addImageTextButton("$schematic.copy.import", Icon.copy, style, () -> {
|
||||
t.button("$schematic.copy.import", Icon.copy, style, () -> {
|
||||
dialog.hide();
|
||||
try{
|
||||
Schematic s = Schematics.readBase64(Core.app.getClipboardText());
|
||||
@@ -174,7 +174,7 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
}
|
||||
}).marginLeft(12f).disabled(b -> Core.app.getClipboardText() == null || !Core.app.getClipboardText().startsWith(schematicBaseStart));
|
||||
t.row();
|
||||
t.addImageTextButton("$schematic.importfile", Icon.download, style, () -> platform.showFileChooser(true, schematicExtension, file -> {
|
||||
t.button("$schematic.importfile", Icon.download, style, () -> platform.showFileChooser(true, schematicExtension, file -> {
|
||||
dialog.hide();
|
||||
|
||||
try{
|
||||
@@ -189,7 +189,7 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
})).marginLeft(12f);
|
||||
t.row();
|
||||
if(steam){
|
||||
t.addImageTextButton("$schematic.browseworkshop", Icon.book, style, () -> {
|
||||
t.button("$schematic.browseworkshop", Icon.book, style, () -> {
|
||||
dialog.hide();
|
||||
platform.openWorkshop();
|
||||
}).marginLeft(12f);
|
||||
@@ -209,18 +209,18 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
TextButtonStyle style = Styles.cleart;
|
||||
t.defaults().size(280f, 60f).left();
|
||||
if(steam && !s.hasSteamID()){
|
||||
t.addImageTextButton("$schematic.shareworkshop", Icon.book, style,
|
||||
t.button("$schematic.shareworkshop", Icon.book, style,
|
||||
() -> platform.publish(s)).marginLeft(12f);
|
||||
t.row();
|
||||
dialog.hide();
|
||||
}
|
||||
t.addImageTextButton("$schematic.copy", Icon.copy, style, () -> {
|
||||
t.button("$schematic.copy", Icon.copy, style, () -> {
|
||||
dialog.hide();
|
||||
ui.showInfoFade("$copied");
|
||||
Core.app.setClipboardText(schematics.writeBase64(s));
|
||||
}).marginLeft(12f);
|
||||
t.row();
|
||||
t.addImageTextButton("$schematic.exportfile", Icon.export, style, () -> {
|
||||
t.button("$schematic.exportfile", Icon.export, style, () -> {
|
||||
dialog.hide();
|
||||
platform.export(s.name(), schematicExtension, file -> Schematics.write(s, file));
|
||||
}).marginLeft(12f);
|
||||
@@ -312,7 +312,7 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
cont.table(r -> {
|
||||
int i = 0;
|
||||
for(ItemStack s : arr){
|
||||
r.addImage(s.item.icon(Cicon.small)).left();
|
||||
r.image(s.item.icon(Cicon.small)).left();
|
||||
r.label(() -> {
|
||||
Tilec core = player.closestCore();
|
||||
if(core == null || state.rules.infiniteResources || core.items().has(s.item, s.amount)) return "[lightgray]" + s.amount + "";
|
||||
|
||||
@@ -84,7 +84,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
t.defaults().size(270f, 60f).left();
|
||||
TextButtonStyle style = Styles.cleart;
|
||||
|
||||
t.addImageTextButton("$settings.cleardata", Icon.trash, style, () -> ui.showConfirm("$confirm", "$settings.clearall.confirm", () -> {
|
||||
t.button("$settings.cleardata", Icon.trash, style, () -> ui.showConfirm("$confirm", "$settings.clearall.confirm", () -> {
|
||||
ObjectMap<String, Object> map = new ObjectMap<>();
|
||||
for(String value : Core.settings.keys()){
|
||||
if(value.contains("usid") || value.contains("uuid")){
|
||||
@@ -104,7 +104,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
|
||||
t.row();
|
||||
|
||||
t.addImageTextButton("$data.export", Icon.download, style, () -> {
|
||||
t.button("$data.export", Icon.download, style, () -> {
|
||||
if(ios){
|
||||
Fi file = Core.files.local("mindustry-data-export.zip");
|
||||
try{
|
||||
@@ -128,7 +128,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
|
||||
t.row();
|
||||
|
||||
t.addImageTextButton("$data.import", Icon.download, style, () -> ui.showConfirm("$confirm", "$data.import.confirm", () -> platform.showFileChooser(true, "zip", file -> {
|
||||
t.button("$data.import", Icon.download, style, () -> ui.showConfirm("$confirm", "$data.import.confirm", () -> platform.showFileChooser(true, "zip", file -> {
|
||||
try{
|
||||
data.importData(file);
|
||||
Core.app.exit();
|
||||
@@ -146,7 +146,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
|
||||
if(!mobile){
|
||||
t.row();
|
||||
t.addImageTextButton("$data.openfolder", Icon.folder, style, () -> Core.app.openFolder(Core.settings.getDataDirectory().absolutePath()));
|
||||
t.button("$data.openfolder", Icon.folder, style, () -> Core.app.openFolder(Core.settings.getDataDirectory().absolutePath()));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -185,20 +185,20 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
TextButtonStyle style = Styles.cleart;
|
||||
|
||||
menu.defaults().size(300f, 60f);
|
||||
menu.addButton("$settings.game", style, () -> visible(0));
|
||||
menu.button("$settings.game", style, () -> visible(0));
|
||||
menu.row();
|
||||
menu.addButton("$settings.graphics", style, () -> visible(1));
|
||||
menu.button("$settings.graphics", style, () -> visible(1));
|
||||
menu.row();
|
||||
menu.addButton("$settings.sound", style, () -> visible(2));
|
||||
menu.button("$settings.sound", style, () -> visible(2));
|
||||
menu.row();
|
||||
menu.addButton("$settings.language", style, ui.language::show);
|
||||
menu.button("$settings.language", style, ui.language::show);
|
||||
if(!mobile || Core.settings.getBool("keyboard")){
|
||||
menu.row();
|
||||
menu.addButton("$settings.controls", style, ui.controls::show);
|
||||
menu.button("$settings.controls", style, ui.controls::show);
|
||||
}
|
||||
|
||||
menu.row();
|
||||
menu.addButton("$settings.data", style, () -> dataDialog.show());
|
||||
menu.button("$settings.data", style, () -> dataDialog.show());
|
||||
}
|
||||
|
||||
void addSettings(){
|
||||
@@ -256,7 +256,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
game.pref(new Setting(){
|
||||
@Override
|
||||
public void add(SettingsTable table){
|
||||
table.addButton("$tutorial.retake", () -> {
|
||||
table.button("$tutorial.retake", () -> {
|
||||
hide();
|
||||
control.playTutorial();
|
||||
}).size(220f, 60f).pad(6).left();
|
||||
@@ -378,7 +378,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
|
||||
@Override
|
||||
public void addCloseButton(){
|
||||
buttons.addImageTextButton("$back", Icon.leftOpen, () -> {
|
||||
buttons.button("$back", Icon.leftOpen, () -> {
|
||||
if(prefs.getChildren().first() != menu){
|
||||
back();
|
||||
}else{
|
||||
@@ -387,7 +387,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
}).size(230f, 64f);
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK){
|
||||
if(key == KeyCode.escape || key == KeyCode.back){
|
||||
if(prefs.getChildren().first() != menu){
|
||||
back();
|
||||
}else{
|
||||
|
||||
@@ -63,7 +63,7 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
|
||||
addCloseButton();
|
||||
|
||||
buttons.addImageTextButton("$database", Icon.book, () -> {
|
||||
buttons.button("$database", Icon.book, () -> {
|
||||
hide();
|
||||
ui.database.show();
|
||||
}).size(210f, 64f);
|
||||
@@ -343,7 +343,7 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
infoTable.table(b -> {
|
||||
b.margin(0).left().defaults().left();
|
||||
|
||||
b.addImageButton(Icon.info, Styles.cleari, () -> ui.content.show(node.block)).growY().width(50f);
|
||||
b.button(Icon.info, Styles.cleari, () -> ui.content.show(node.block)).growY().width(50f);
|
||||
b.add().grow();
|
||||
b.table(desc -> {
|
||||
desc.left().defaults().left();
|
||||
@@ -355,7 +355,7 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
for(ItemStack req : node.requirements){
|
||||
t.table(list -> {
|
||||
list.left();
|
||||
list.addImage(req.item.icon(Cicon.small)).size(8 * 3).padRight(3);
|
||||
list.image(req.item.icon(Cicon.small)).size(8 * 3).padRight(3);
|
||||
list.add(req.item.localizedName).color(Color.lightGray);
|
||||
list.label(() -> " " + Math.min(data.getItem(req.item), req.amount) + " / " + req.amount)
|
||||
.update(l -> l.setColor(data.has(req.item, req.amount) ? Color.lightGray : Color.scarlet));
|
||||
@@ -370,7 +370,7 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
|
||||
if(mobile && locked(node)){
|
||||
b.row();
|
||||
b.addImageTextButton("$research", Icon.ok, Styles.nodet, () -> unlock(node))
|
||||
b.button("$research", Icon.ok, Styles.nodet, () -> unlock(node))
|
||||
.disabled(i -> !data.hasItems(node.requirements)).growX().height(44f).colspan(3);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
if(i++ % 2 == 0){
|
||||
iteminfo.row();
|
||||
}
|
||||
iteminfo.addImage(stack.item.icon(Cicon.small)).size(8 * 3).padRight(1);
|
||||
iteminfo.image(stack.item.icon(Cicon.small)).size(8 * 3).padRight(1);
|
||||
iteminfo.add(stack.amount + "").color(Color.lightGray).padRight(5);
|
||||
}
|
||||
};
|
||||
@@ -55,7 +55,7 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
|
||||
cont.pane(cont -> {
|
||||
if(zone.locked()){
|
||||
cont.addImage(Icon.lock);
|
||||
cont.image(Icon.lock);
|
||||
cont.row();
|
||||
cont.add("$locked").padBottom(6);
|
||||
cont.row();
|
||||
@@ -70,9 +70,9 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
r.add("$complete").colspan(2).left();
|
||||
r.row();
|
||||
for(Objective o : zones){
|
||||
r.addImage(Icon.terrain).padRight(4);
|
||||
r.image(Icon.terrain).padRight(4);
|
||||
r.add(o.display()).color(Color.lightGray);
|
||||
r.addImage(o.complete() ? Icon.ok : Icon.cancel, o.complete() ? Color.lightGray : Color.scarlet).padLeft(3);
|
||||
r.image(o.complete() ? Icon.ok : Icon.cancel, o.complete() ? Color.lightGray : Color.scarlet).padLeft(3);
|
||||
r.row();
|
||||
}
|
||||
});
|
||||
@@ -86,9 +86,9 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
r.add("$research.list").colspan(2).left();
|
||||
r.row();
|
||||
for(Unlock blocko : blocks){
|
||||
r.addImage(blocko.block.icon(Cicon.small)).size(8 * 3).padRight(5);
|
||||
r.image(blocko.block.icon(Cicon.small)).size(8 * 3).padRight(5);
|
||||
r.add(blocko.block.localizedName).color(Color.lightGray).left();
|
||||
r.addImage(blocko.block.unlocked() ? Icon.ok : Icon.cancel, blocko.block.unlocked() ? Color.lightGray : Color.scarlet).padLeft(3);
|
||||
r.image(blocko.block.unlocked() ? Icon.ok : Icon.cancel, blocko.block.unlocked() ? Color.lightGray : Color.scarlet).padLeft(3);
|
||||
r.row();
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
}else{
|
||||
cont.add(zone.localizedName).color(Pal.accent).growX().center();
|
||||
cont.row();
|
||||
cont.addImage().color(Pal.accent).height(3).pad(6).growX();
|
||||
cont.image().color(Pal.accent).height(3).pad(6).growX();
|
||||
cont.row();
|
||||
cont.table(desc -> {
|
||||
desc.left().defaults().left().width(Core.graphics.isPortrait() ? 350f : 500f);
|
||||
@@ -115,7 +115,7 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
t.left();
|
||||
int i = 0;
|
||||
for(Item item : zone.resources){
|
||||
r.addImage(item.icon(Cicon.small)).size(8 * 3);
|
||||
r.image(item.icon(Cicon.small)).size(8 * 3);
|
||||
if(++i % 4 == 0){
|
||||
r.row();
|
||||
}
|
||||
@@ -143,13 +143,13 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
});
|
||||
cont.row();
|
||||
|
||||
cont.addButton(zone.canConfigure() ? "$configure" : Core.bundle.format("configure.locked", zone.configureObjective.display()),
|
||||
cont.button(zone.canConfigure() ? "$configure" : Core.bundle.format("configure.locked", zone.configureObjective.display()),
|
||||
() -> loadout.show(zone.loadout.findCore().itemCapacity, zone.getStartingItems(), zone::resetStartingItems, zone::updateLaunchCost, rebuildItems)
|
||||
).fillX().pad(3).disabled(b -> !zone.canConfigure());
|
||||
|
||||
cont.row();
|
||||
|
||||
Button button = cont.addButton(zone.locked() ? "$uncover" : "$launch", () -> {
|
||||
Button button = cont.button(zone.locked() ? "$uncover" : "$launch", () -> {
|
||||
if(!data.isUnlocked(zone)){
|
||||
Sounds.unlock.play();
|
||||
data.unlockContent(zone);
|
||||
|
||||
@@ -57,12 +57,12 @@ public class HudFragment extends Fragment{
|
||||
|
||||
ImageButtonStyle style = Styles.clearTransi;
|
||||
|
||||
select.addImageButton(Icon.menu, style, ui.paused::show);
|
||||
flip = select.addImageButton(Icon.upOpen, style, this::toggleMenus).get();
|
||||
select.button(Icon.menu, style, ui.paused::show);
|
||||
flip = select.button(Icon.upOpen, style, this::toggleMenus).get();
|
||||
|
||||
select.addImageButton(Icon.paste, style, ui.schematics::show);
|
||||
select.button(Icon.paste, style, ui.schematics::show);
|
||||
|
||||
select.addImageButton(Icon.pause, style, () -> {
|
||||
select.button(Icon.pause, style, () -> {
|
||||
if(net.active()){
|
||||
ui.listfrag.toggle();
|
||||
}else{
|
||||
@@ -77,7 +77,7 @@ public class HudFragment extends Fragment{
|
||||
}
|
||||
});
|
||||
|
||||
select.addImageButton(Icon.chat, style,() -> {
|
||||
select.button(Icon.chat, style,() -> {
|
||||
if(net.active() && mobile){
|
||||
if(ui.chatfrag.shown()){
|
||||
ui.chatfrag.hide();
|
||||
@@ -97,7 +97,7 @@ public class HudFragment extends Fragment{
|
||||
}
|
||||
});
|
||||
|
||||
select.addImage().color(Pal.gray).width(4f).fillY();
|
||||
select.image().color(Pal.gray).width(4f).fillY();
|
||||
|
||||
float size = Scl.scl(dsize);
|
||||
Array<Element> children = new Array<>(select.getChildren());
|
||||
@@ -122,7 +122,7 @@ public class HudFragment extends Fragment{
|
||||
}
|
||||
|
||||
cont.row();
|
||||
cont.addImage().height(4f).color(Pal.gray).fillX();
|
||||
cont.image().height(4f).color(Pal.gray).fillX();
|
||||
cont.row();
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public class HudFragment extends Fragment{
|
||||
teams.left();
|
||||
int i = 0;
|
||||
for(Team team : Team.base()){
|
||||
ImageButton button = teams.addImageButton(Tex.whiteui, Styles.clearTogglePartiali, 40f, () -> Call.setPlayerTeamEditor(player, team))
|
||||
ImageButton button = teams.button(Tex.whiteui, Styles.clearTogglePartiali, 40f, () -> Call.setPlayerTeamEditor(player, team))
|
||||
.size(50f).margin(6f).get();
|
||||
button.getImageCell().grow();
|
||||
button.getStyle().imageUpColor = team.color;
|
||||
@@ -261,7 +261,7 @@ public class HudFragment extends Fragment{
|
||||
setDisabled(() -> !control.tutorial.canNext());
|
||||
}},
|
||||
new Table(f -> {
|
||||
f.left().addImageButton(Icon.left, Styles.emptyi, () -> {
|
||||
f.left().button(Icon.left, Styles.emptyi, () -> {
|
||||
control.tutorial.prevSentence();
|
||||
}).width(44f).growY().visible(() -> control.tutorial.canPrev());
|
||||
}));
|
||||
@@ -340,7 +340,7 @@ public class HudFragment extends Fragment{
|
||||
}
|
||||
});
|
||||
table.margin(12);
|
||||
table.addImage(Icon.ok).pad(3);
|
||||
table.image(Icon.ok).pad(3);
|
||||
table.add(text).wrap().width(280f).get().setAlignment(Align.center, Align.center);
|
||||
table.pack();
|
||||
|
||||
@@ -441,7 +441,7 @@ public class HudFragment extends Fragment{
|
||||
|
||||
lastUnlockLayout.add(image);
|
||||
}else{ //else, add a specific icon to denote no more space
|
||||
lastUnlockLayout.addImage(Icon.add);
|
||||
lastUnlockLayout.image(Icon.add);
|
||||
}
|
||||
|
||||
lastUnlockLayout.pack();
|
||||
@@ -486,13 +486,13 @@ public class HudFragment extends Fragment{
|
||||
dialog.cont.add("$launch.confirm").width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
||||
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
||||
dialog.setFillParent(false);
|
||||
dialog.buttons.addButton("$cancel", dialog::hide);
|
||||
dialog.buttons.addButton("$ok", () -> {
|
||||
dialog.buttons.button("$cancel", dialog::hide);
|
||||
dialog.buttons.button("$ok", () -> {
|
||||
dialog.hide();
|
||||
Call.launchZone();
|
||||
});
|
||||
dialog.keyDown(KeyCode.ESCAPE, dialog::hide);
|
||||
dialog.keyDown(KeyCode.BACK, dialog::hide);
|
||||
dialog.keyDown(KeyCode.escape, dialog::hide);
|
||||
dialog.keyDown(KeyCode.back, dialog::hide);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@@ -597,7 +597,7 @@ public class HudFragment extends Fragment{
|
||||
}
|
||||
|
||||
private void addPlayButton(Table table){
|
||||
table.right().addImageButton(Icon.play, Styles.righti, 30f, () -> {
|
||||
table.right().button(Icon.play, Styles.righti, 30f, () -> {
|
||||
if(net.client() && player.admin()){
|
||||
Call.onAdminRequest(player, AdminAction.wave);
|
||||
}else if(inLaunchWave()){
|
||||
|
||||
@@ -22,16 +22,16 @@ public class LoadingFragment extends Fragment{
|
||||
t.visible(false);
|
||||
t.touchable(Touchable.enabled);
|
||||
t.add().height(133f).row();
|
||||
t.addImage().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
|
||||
t.image().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
|
||||
t.row();
|
||||
t.add("$loading").name("namelabel").pad(10f);
|
||||
t.row();
|
||||
t.addImage().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
|
||||
t.image().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
|
||||
t.row();
|
||||
|
||||
bar = t.add(new Bar()).pad(3).size(500f, 40f).visible(false).get();
|
||||
t.row();
|
||||
button = t.addButton("$cancel", () -> {}).pad(20).size(250f, 70f).visible(false).get();
|
||||
button = t.button("$cancel", () -> {}).pad(20).size(250f, 70f).visible(false).get();
|
||||
table = t;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,10 +57,10 @@ public class MenuFragment extends Fragment{
|
||||
|
||||
//info icon
|
||||
if(mobile){
|
||||
parent.fill(c -> c.bottom().left().addButton("", Styles.infot, ui.about::show).size(84, 45));
|
||||
parent.fill(c -> c.bottom().right().addButton("", Styles.discordt, ui.discord::show).size(84, 45));
|
||||
parent.fill(c -> c.bottom().left().button("", Styles.infot, ui.about::show).size(84, 45));
|
||||
parent.fill(c -> c.bottom().right().button("", Styles.discordt, ui.discord::show).size(84, 45));
|
||||
}else if(becontrol.active()){
|
||||
parent.fill(c -> c.bottom().right().addImageTextButton("$be.check", Icon.refresh, () -> {
|
||||
parent.fill(c -> c.bottom().right().button("$be.check", Icon.refresh, () -> {
|
||||
ui.loadfrag.show();
|
||||
becontrol.checkUpdate(result -> {
|
||||
ui.loadfrag.hide();
|
||||
@@ -219,7 +219,7 @@ public class MenuFragment extends Fragment{
|
||||
for(Buttoni b : buttons){
|
||||
if(b == null) continue;
|
||||
Button[] out = {null};
|
||||
out[0] = t.addImageTextButton(b.text, b.icon, Styles.clearToggleMenut, () -> {
|
||||
out[0] = t.button(b.text, b.icon, Styles.clearToggleMenut, () -> {
|
||||
if(currentMenu == out[0]){
|
||||
currentMenu = null;
|
||||
fadeOutMenu();
|
||||
|
||||
@@ -100,7 +100,7 @@ public class MinimapFragment extends Fragment{
|
||||
t.row();
|
||||
t.add().growY();
|
||||
t.row();
|
||||
t.addImageTextButton("$back", Icon.leftOpen, () -> shown = false).size(220f, 60f).pad(10f);
|
||||
t.button("$back", Icon.leftOpen, () -> shown = false).size(220f, 60f).pad(10f);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -205,9 +205,9 @@ public class PlacementFragment extends Fragment{
|
||||
blockTable.row();
|
||||
}
|
||||
|
||||
ImageButton button = blockTable.addImageButton(new TextureRegionDrawable(block.icon(Cicon.medium)), Styles.selecti, () -> {
|
||||
ImageButton button = blockTable.button(new TextureRegionDrawable(block.icon(Cicon.medium)), Styles.selecti, () -> {
|
||||
if(unlocked(block)){
|
||||
if(Core.input.keyDown(KeyCode.SHIFT_LEFT) && Fonts.getUnicode(block.name) != 0){
|
||||
if(Core.input.keyDown(KeyCode.shiftLeft) && Fonts.getUnicode(block.name) != 0){
|
||||
Core.app.setClipboardText((char)Fonts.getUnicode(block.name) + "");
|
||||
ui.showInfoFade("$copied");
|
||||
}else{
|
||||
@@ -290,7 +290,7 @@ public class PlacementFragment extends Fragment{
|
||||
.left().width(190f).padLeft(5);
|
||||
header.add().growX();
|
||||
if(unlocked(lastDisplay)){
|
||||
header.addButton("?", Styles.clearPartialt, () -> {
|
||||
header.button("?", Styles.clearPartialt, () -> {
|
||||
ui.content.show(lastDisplay);
|
||||
Events.fire(new BlockInfoEvent());
|
||||
}).size(8 * 5).padTop(-5).padRight(-5).right().grow().name("blockinfo");
|
||||
@@ -304,7 +304,7 @@ public class PlacementFragment extends Fragment{
|
||||
for(ItemStack stack : lastDisplay.requirements){
|
||||
req.table(line -> {
|
||||
line.left();
|
||||
line.addImage(stack.item.icon(Cicon.small)).size(8 * 2);
|
||||
line.image(stack.item.icon(Cicon.small)).size(8 * 2);
|
||||
line.add(stack.item.localizedName).maxWidth(140f).fillX().color(Color.lightGray).padLeft(2).left().get().setEllipsis(true);
|
||||
line.labelWrap(() -> {
|
||||
Tilec core = player.closestCore();
|
||||
@@ -324,7 +324,7 @@ public class PlacementFragment extends Fragment{
|
||||
if(state.rules.bannedBlocks.contains(lastDisplay) || !player.isBuilder()){
|
||||
topTable.row();
|
||||
topTable.table(b -> {
|
||||
b.addImage(Icon.cancel).padRight(2).color(Color.scarlet);
|
||||
b.image(Icon.cancel).padRight(2).color(Color.scarlet);
|
||||
b.add(!player.isBuilder() ? "$unit.nobuild" : "$banned");
|
||||
b.left();
|
||||
}).padTop(2).left();
|
||||
@@ -350,7 +350,7 @@ public class PlacementFragment extends Fragment{
|
||||
});
|
||||
}).colspan(3).fillX().visible(() -> getSelected() != null || tileDisplayBlock() != null).touchable(Touchable.enabled);
|
||||
frame.row();
|
||||
frame.addImage().color(Pal.gray).colspan(3).height(4).growX();
|
||||
frame.image().color(Pal.gray).colspan(3).height(4).growX();
|
||||
frame.row();
|
||||
frame.table(Tex.pane2, blocksSelect -> {
|
||||
blocksSelect.margin(4).marginTop(0);
|
||||
@@ -390,11 +390,11 @@ public class PlacementFragment extends Fragment{
|
||||
if(f++ % 2 == 0) categories.row();
|
||||
|
||||
if(categoryEmpty[cat.ordinal()]){
|
||||
categories.addImage(Styles.black6);
|
||||
categories.image(Styles.black6);
|
||||
continue;
|
||||
}
|
||||
|
||||
categories.addImageButton(ui.getIcon(cat.name()), Styles.clearToggleTransi, () -> {
|
||||
categories.button(ui.getIcon(cat.name()), Styles.clearToggleTransi, () -> {
|
||||
currentCategory = cat;
|
||||
if(control.input.block != null){
|
||||
control.input.block = getSelectedBlock(currentCategory);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PlayerListFragment extends Fragment{
|
||||
cont.table(Tex.buttonTrans, pane -> {
|
||||
pane.label(() -> Core.bundle.format(Groups.player.size() == 1 ? "players.single" : "players", Groups.player.size()));
|
||||
pane.row();
|
||||
sField = pane.addField(null, text -> {
|
||||
sField = pane.field(null, text -> {
|
||||
rebuild();
|
||||
}).grow().pad(8).get();
|
||||
sField.setMaxLength(maxNameLength);
|
||||
@@ -57,9 +57,9 @@ public class PlayerListFragment extends Fragment{
|
||||
pane.table(menu -> {
|
||||
menu.defaults().growX().height(50f).fillY();
|
||||
|
||||
menu.addButton("$server.bans", ui.bans::show).disabled(b -> net.client());
|
||||
menu.addButton("$server.admins", ui.admins::show).disabled(b -> net.client());
|
||||
menu.addButton("$close", this::toggle);
|
||||
menu.button("$server.bans", ui.bans::show).disabled(b -> net.client());
|
||||
menu.button("$server.admins", ui.admins::show).disabled(b -> net.client());
|
||||
menu.button("$close", this::toggle);
|
||||
}).margin(0f).pad(10f).growX();
|
||||
|
||||
}).touchable(Touchable.enabled).margin(14f);
|
||||
@@ -105,7 +105,7 @@ public class PlayerListFragment extends Fragment{
|
||||
button.labelWrap("[#" + user.color().toString().toUpperCase() + "]" + user.name()).width(170f).pad(10);
|
||||
button.add().grow();
|
||||
|
||||
button.addImage(Icon.admin).visible(() -> user.admin() && !(!user.isLocal() && net.server())).padRight(5).get().updateVisibility();
|
||||
button.image(Icon.admin).visible(() -> user.admin() && !(!user.isLocal() && net.server())).padRight(5).get().updateVisibility();
|
||||
|
||||
if((net.server() || player.admin()) && !user.isLocal() && (!user.admin() || net.server())){
|
||||
button.add().growY();
|
||||
@@ -115,14 +115,14 @@ public class PlayerListFragment extends Fragment{
|
||||
button.table(t -> {
|
||||
t.defaults().size(bs);
|
||||
|
||||
t.addImageButton(Icon.hammer, Styles.clearPartiali,
|
||||
t.button(Icon.hammer, Styles.clearPartiali,
|
||||
() -> ui.showConfirm("$confirm", Core.bundle.format("confirmban", user.name()), () -> Call.onAdminRequest(user, AdminAction.ban)));
|
||||
t.addImageButton(Icon.cancel, Styles.clearPartiali,
|
||||
t.button(Icon.cancel, Styles.clearPartiali,
|
||||
() -> ui.showConfirm("$confirm", Core.bundle.format("confirmkick", user.name()), () -> Call.onAdminRequest(user, AdminAction.kick)));
|
||||
|
||||
t.row();
|
||||
|
||||
t.addImageButton(Icon.admin, Styles.clearTogglePartiali, () -> {
|
||||
t.button(Icon.admin, Styles.clearTogglePartiali, () -> {
|
||||
if(net.client()) return;
|
||||
|
||||
String id = user.uuid();
|
||||
@@ -137,19 +137,19 @@ public class PlayerListFragment extends Fragment{
|
||||
.touchable(() -> net.client() ? Touchable.disabled : Touchable.enabled)
|
||||
.checked(user.admin());
|
||||
|
||||
t.addImageButton(Icon.zoom, Styles.clearPartiali, () -> Call.onAdminRequest(user, AdminAction.trace));
|
||||
t.button(Icon.zoom, Styles.clearPartiali, () -> Call.onAdminRequest(user, AdminAction.trace));
|
||||
|
||||
}).padRight(12).size(bs + 10f, bs);
|
||||
}else if(!user.isLocal() && !user.admin() && net.client() && Groups.player.size() >= 3 && player.team() == user.team()){ //votekick
|
||||
button.add().growY();
|
||||
|
||||
button.addImageButton(Icon.hammer, Styles.clearPartiali,
|
||||
button.button(Icon.hammer, Styles.clearPartiali,
|
||||
() -> ui.showConfirm("$confirm", Core.bundle.format("confirmvotekick", user.name()), () -> Call.sendChatMessage("/votekick " + user.name()))).size(h);
|
||||
}
|
||||
|
||||
content.add(button).padBottom(-6).width(350f).maxHeight(h + 14);
|
||||
content.row();
|
||||
content.addImage().height(4f).color(state.rules.pvp ? user.team().color : Pal.gray).growX();
|
||||
content.image().height(4f).color(state.rules.pvp ? user.team().color : Pal.gray).growX();
|
||||
content.row();
|
||||
});
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ItemSelection{
|
||||
for(T item : items){
|
||||
if(!data.isUnlocked(item) && state.isCampaign()) continue;
|
||||
|
||||
ImageButton button = cont.addImageButton(Tex.whiteui, Styles.clearToggleTransi, 24, () -> control.input.frag.config.hideConfig()).group(group).get();
|
||||
ImageButton button = cont.button(Tex.whiteui, Styles.clearToggleTransi, 24, () -> control.input.frag.config.hideConfig()).group(group).get();
|
||||
button.changed(() -> consumer.get(button.isChecked() ? item : null));
|
||||
button.getStyle().imageUp = new TextureRegionDrawable(item.icon(Cicon.small));
|
||||
button.update(() -> button.setChecked(holder.get() == item));
|
||||
@@ -40,7 +40,7 @@ public class ItemSelection{
|
||||
if(i % 4 != 0){
|
||||
int remaining = 4 - (i % 4);
|
||||
for(int j = 0; j < remaining; j++){
|
||||
cont.addImage(Styles.black6);
|
||||
cont.image(Styles.black6);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ public class MassConveyor extends Block{
|
||||
progress = Time.time() % moveTime;
|
||||
|
||||
//TODO DEBUG
|
||||
if(Core.input.keyTap(KeyCode.G) && world.entWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y) == this){
|
||||
if(Core.input.keyTap(KeyCode.g) && world.entWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y) == this){
|
||||
item = new UnitPayload((Mathf.chance(0.5) ? UnitTypes.wraith : UnitTypes.dagger).create(Team.sharded));
|
||||
itemRotation = rotation() * 90;
|
||||
animation = 0f;
|
||||
|
||||
@@ -87,7 +87,7 @@ public class MessageBlock extends Block{
|
||||
|
||||
@Override
|
||||
public void buildConfiguration(Table table){
|
||||
table.addImageButton(Icon.pencil, () -> {
|
||||
table.button(Icon.pencil, () -> {
|
||||
if(mobile){
|
||||
Core.input.getTextInput(new TextInput(){{
|
||||
text = message;
|
||||
@@ -112,7 +112,7 @@ public class MessageBlock extends Block{
|
||||
return true;
|
||||
});
|
||||
a.setMaxLength(maxTextLength);
|
||||
dialog.buttons.addButton("$ok", () -> {
|
||||
dialog.buttons.button("$ok", () -> {
|
||||
tile.configure(a.getText());
|
||||
dialog.hide();
|
||||
}).size(130f, 60f);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class LightBlock extends Block{
|
||||
|
||||
@Override
|
||||
public void buildConfiguration(Table table){
|
||||
table.addImageButton(Icon.pencil, () -> {
|
||||
table.button(Icon.pencil, () -> {
|
||||
ui.picker.show(Tmp.c1.set(color).a(0.5f), false, res -> {
|
||||
color = res.rgba();
|
||||
lastColor = color;
|
||||
|
||||
@@ -139,7 +139,7 @@ public class Drill extends Block{
|
||||
for(int i = 0; i < list.size; i++){
|
||||
Block item = list.get(i);
|
||||
|
||||
l.addImage(item.icon(Cicon.small)).size(8 * 3).padRight(2).padLeft(2).padTop(3).padBottom(3);
|
||||
l.image(item.icon(Cicon.small)).size(8 * 3).padRight(2).padLeft(2).padTop(3).padBottom(3);
|
||||
l.add(item.localizedName).left().padLeft(1).padRight(4);
|
||||
if(i % 5 == 4){
|
||||
l.row();
|
||||
|
||||
@@ -84,7 +84,7 @@ public class CommandCenter extends Block{
|
||||
Table buttons = new Table();
|
||||
|
||||
for(UnitCommand cmd : UnitCommand.all){
|
||||
buttons.addImageButton(commandRegions[cmd.ordinal()], Styles.clearToggleTransi, () -> tile.configure(cmd.ordinal()))
|
||||
buttons.button(commandRegions[cmd.ordinal()], Styles.clearToggleTransi, () -> tile.configure(cmd.ordinal()))
|
||||
.size(44).group(group).update(b -> b.setChecked(command == cmd));
|
||||
}
|
||||
table.add(buttons);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
table.row();
|
||||
for(T t : map.keys()){
|
||||
BulletType type = map.get(t);
|
||||
table.addImage(icon(t)).size(3 * 8).padRight(4).right().top();
|
||||
table.image(icon(t)).size(3 * 8).padRight(4).right().top();
|
||||
table.add(t.localizedName).padRight(10).left().top();
|
||||
table.table(Tex.underline, bt -> {
|
||||
bt.left().defaults().padRight(3).left();
|
||||
|
||||
@@ -32,7 +32,7 @@ public class BoosterListValue implements StatValue{
|
||||
for(Liquid liquid : content.liquids()){
|
||||
if(!filter.get(liquid)) continue;
|
||||
|
||||
c.addImage(liquid.icon(Cicon.medium)).size(3 * 8).padRight(4).right().top();
|
||||
c.image(liquid.icon(Cicon.medium)).size(3 * 8).padRight(4).right().top();
|
||||
c.add(liquid.localizedName).padRight(10).left().top();
|
||||
c.table(Tex.underline, bt -> {
|
||||
bt.left().defaults().padRight(3).left();
|
||||
|
||||
Reference in New Issue
Block a user