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