Renamed key fields and table methods
This commit is contained in:
@@ -17,13 +17,13 @@ public class ContentDisplay{
|
||||
table.table(title -> {
|
||||
int size = 8 * 6;
|
||||
|
||||
title.addImage(block.icon(Cicon.xlarge)).size(size);
|
||||
title.image(block.icon(Cicon.xlarge)).size(size);
|
||||
title.add("[accent]" + block.localizedName).padLeft(5);
|
||||
});
|
||||
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(8).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(8).padLeft(0).padRight(0).fillX();
|
||||
|
||||
table.row();
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ContentDisplay{
|
||||
table.add(block.displayDescription()).padLeft(5).padRight(5).width(400f).wrap().fillX();
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(8).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(8).padLeft(0).padRight(0).fillX();
|
||||
table.row();
|
||||
}
|
||||
|
||||
@@ -65,13 +65,13 @@ public class ContentDisplay{
|
||||
public static void displayItem(Table table, Item item){
|
||||
|
||||
table.table(title -> {
|
||||
title.addImage(item.icon(Cicon.xlarge)).size(8 * 6);
|
||||
title.image(item.icon(Cicon.xlarge)).size(8 * 6);
|
||||
title.add("[accent]" + item.localizedName).padLeft(5);
|
||||
});
|
||||
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
|
||||
table.row();
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ContentDisplay{
|
||||
table.add(item.displayDescription()).padLeft(5).padRight(5).width(400f).wrap().fillX();
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.row();
|
||||
}
|
||||
|
||||
@@ -99,13 +99,13 @@ public class ContentDisplay{
|
||||
public static void displayLiquid(Table table, Liquid liquid){
|
||||
|
||||
table.table(title -> {
|
||||
title.addImage(liquid.icon(Cicon.xlarge)).size(8 * 6);
|
||||
title.image(liquid.icon(Cicon.xlarge)).size(8 * 6);
|
||||
title.add("[accent]" + liquid.localizedName).padLeft(5);
|
||||
});
|
||||
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
|
||||
table.row();
|
||||
|
||||
@@ -113,7 +113,7 @@ public class ContentDisplay{
|
||||
table.add(liquid.displayDescription()).padLeft(5).padRight(5).width(400f).wrap().fillX();
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.row();
|
||||
}
|
||||
|
||||
@@ -133,13 +133,13 @@ public class ContentDisplay{
|
||||
|
||||
public static void displayUnit(Table table, UnitType unit){
|
||||
table.table(title -> {
|
||||
title.addImage(unit.icon(Cicon.xlarge)).size(8 * 6);
|
||||
title.image(unit.icon(Cicon.xlarge)).size(8 * 6);
|
||||
title.add("[accent]" + unit.localizedName).padLeft(5);
|
||||
});
|
||||
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
|
||||
table.row();
|
||||
|
||||
@@ -147,7 +147,7 @@ public class ContentDisplay{
|
||||
table.add(unit.displayDescription()).padLeft(5).padRight(5).width(400f).wrap().fillX();
|
||||
table.row();
|
||||
|
||||
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.image().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
|
||||
table.row();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package mindustry.ui;
|
||||
import arc.graphics.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import mindustry.core.GameState.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
@@ -33,14 +32,14 @@ public class ItemsDisplay extends Table{
|
||||
for(Item item : content.items()){
|
||||
if(item.type == ItemType.material && data.isUnlocked(item)){
|
||||
t.label(() -> format(item)).left();
|
||||
t.addImage(item.icon(Cicon.small)).size(8 * 3).padLeft(4).padRight(4);
|
||||
t.image(item.icon(Cicon.small)).size(8 * 3).padLeft(4).padRight(4);
|
||||
t.add(item.localizedName).color(Color.lightGray).left();
|
||||
t.row();
|
||||
}
|
||||
}
|
||||
}).get().setScrollingDisabled(true, false), false).setDuration(0.3f);
|
||||
|
||||
c.addImageTextButton("$launcheditems", Icon.downOpen, Styles.clearTogglet, col::toggle).update(t -> {
|
||||
c.button("$launcheditems", Icon.downOpen, Styles.clearTogglet, col::toggle).update(t -> {
|
||||
t.setText(state.isMenu() ? "$launcheditems" : "$launchinfo");
|
||||
t.setChecked(col.isCollapsed());
|
||||
((Image)t.getChildren().get(1)).setDrawable(col.isCollapsed() ? Icon.upOpen : Icon.downOpen);
|
||||
|
||||
@@ -48,14 +48,14 @@ public class AboutDialog extends FloatingDialog{
|
||||
Table table = new Table(Tex.underline);
|
||||
table.margin(0);
|
||||
table.table(img -> {
|
||||
img.addImage().height(h - 5).width(40f).color(link.color);
|
||||
img.image().height(h - 5).width(40f).color(link.color);
|
||||
img.row();
|
||||
img.addImage().height(5).width(40f).color(link.color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
|
||||
img.image().height(5).width(40f).color(link.color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
|
||||
}).expandY();
|
||||
|
||||
table.table(i -> {
|
||||
i.background(Tex.buttonEdge3);
|
||||
i.addImage(link.icon);
|
||||
i.image(link.icon);
|
||||
}).size(h - 5, h);
|
||||
|
||||
table.table(inset -> {
|
||||
@@ -64,7 +64,7 @@ public class AboutDialog extends FloatingDialog{
|
||||
inset.labelWrap(link.description).width(w - 100f).color(Color.lightGray).growX();
|
||||
}).padLeft(8);
|
||||
|
||||
table.addImageButton(Icon.link, () -> {
|
||||
table.button(Icon.link, () -> {
|
||||
if(link.name.equals("wiki")) Events.fire(Trigger.openWiki);
|
||||
|
||||
if(!Core.net.openURI(link.link)){
|
||||
@@ -82,7 +82,7 @@ public class AboutDialog extends FloatingDialog{
|
||||
|
||||
addCloseButton();
|
||||
|
||||
buttons.addButton("$credits", this::showCredits).size(200f, 64f);
|
||||
buttons.button("$credits", this::showCredits).size(200f, 64f);
|
||||
|
||||
if(Core.graphics.isPortrait()){
|
||||
for(Cell<?> cell : buttons.getCells()){
|
||||
@@ -98,7 +98,7 @@ public class AboutDialog extends FloatingDialog{
|
||||
dialog.cont.add("$credits.text").fillX().wrap().get().setAlignment(Align.center);
|
||||
dialog.cont.row();
|
||||
if(!contributors.isEmpty()){
|
||||
dialog.cont.addImage().color(Pal.accent).fillX().height(3f).pad(3f);
|
||||
dialog.cont.image().color(Pal.accent).fillX().height(3f).pad(3f);
|
||||
dialog.cont.row();
|
||||
dialog.cont.add("$contributors");
|
||||
dialog.cont.row();
|
||||
|
||||
@@ -38,7 +38,7 @@ public class AdminsDialog extends FloatingDialog{
|
||||
|
||||
res.labelWrap("[LIGHT_GRAY]" + info.lastName).width(w - h - 24f);
|
||||
res.add().growX();
|
||||
res.addImageButton(Icon.cancel, () -> {
|
||||
res.button(Icon.cancel, () -> {
|
||||
ui.showConfirm("$confirm", "$confirmunadmin", () -> {
|
||||
netServer.admins.unAdminPlayer(info.id);
|
||||
Groups.player.each(player -> {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class BansDialog extends FloatingDialog{
|
||||
|
||||
res.labelWrap("IP: [LIGHT_GRAY]" + info.lastIP + "\n[]Name: [LIGHT_GRAY]" + info.lastName).width(w - h - 24f);
|
||||
res.add().growX();
|
||||
res.addImageButton(Icon.cancel, () -> {
|
||||
res.button(Icon.cancel, () -> {
|
||||
ui.showConfirm("$confirm", "$confirmunban", () -> {
|
||||
netServer.admins.unbanPlayerID(info.id);
|
||||
setup();
|
||||
|
||||
@@ -38,24 +38,24 @@ public class ColorPicker extends FloatingDialog{
|
||||
|
||||
t.defaults().padBottom(4);
|
||||
t.add("R").color(Pal.remove);
|
||||
t.addSlider(0f, 1f, 0.01f, current.r, current::r).width(w);
|
||||
t.slider(0f, 1f, 0.01f, current.r, current::r).width(w);
|
||||
t.row();
|
||||
t.add("G").color(Color.lime);
|
||||
t.addSlider(0f, 1f, 0.01f, current.g, current::g).width(w);
|
||||
t.slider(0f, 1f, 0.01f, current.g, current::g).width(w);
|
||||
t.row();
|
||||
t.add("B").color(Color.royal);
|
||||
t.addSlider(0f, 1f, 0.01f, current.b, current::b).width(w);
|
||||
t.slider(0f, 1f, 0.01f, current.b, current::b).width(w);
|
||||
t.row();
|
||||
if(alpha){
|
||||
t.add("A");
|
||||
t.addSlider(0f, 1f, 0.01f, current.a, current::a).width(w);
|
||||
t.slider(0f, 1f, 0.01f, current.a, current::a).width(w);
|
||||
t.row();
|
||||
}
|
||||
});
|
||||
|
||||
buttons.clear();
|
||||
addCloseButton();
|
||||
buttons.addImageTextButton("$ok", Icon.ok, () -> {
|
||||
buttons.button("$ok", Icon.ok, () -> {
|
||||
cons.get(current);
|
||||
hide();
|
||||
});
|
||||
|
||||
@@ -17,10 +17,10 @@ public class ControlsDialog extends KeybindDialog{
|
||||
|
||||
@Override
|
||||
public void addCloseButton(){
|
||||
buttons.addImageTextButton("$back", Icon.left, this::hide).size(230f, 64f);
|
||||
buttons.button("$back", Icon.left, this::hide).size(230f, 64f);
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK)
|
||||
if(key == KeyCode.escape || key == KeyCode.back)
|
||||
hide();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -62,14 +62,14 @@ public class CustomGameDialog extends FloatingDialog{
|
||||
for(Gamemode mode : Gamemode.all){
|
||||
TextureRegionDrawable icon = Vars.ui.getIcon("mode" + Strings.capitalize(mode.name()) + "Small");
|
||||
if(mode.valid(map) && Core.atlas.isFound(icon.getRegion())){
|
||||
t.addImage(icon).size(16f).pad(4f);
|
||||
t.image(icon).size(16f).pad(4f);
|
||||
}
|
||||
}
|
||||
}).left();
|
||||
image.row();
|
||||
image.add(map.name()).pad(1f).growX().wrap().left().get().setEllipsis(true);
|
||||
image.row();
|
||||
image.addImage(Tex.whiteui, Pal.gray).growX().pad(3).height(4f);
|
||||
image.image(Tex.whiteui, Pal.gray).growX().pad(3).height(4f);
|
||||
image.row();
|
||||
image.add(img).size(images);
|
||||
|
||||
|
||||
@@ -35,12 +35,12 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
banDialog.addCloseButton();
|
||||
|
||||
banDialog.shown(this::rebuildBanned);
|
||||
banDialog.buttons.addImageTextButton("$addall", Icon.add, () -> {
|
||||
banDialog.buttons.button("$addall", Icon.add, () -> {
|
||||
rules.bannedBlocks.addAll(content.blocks().select(Block::isBuildable));
|
||||
rebuildBanned();
|
||||
}).size(180, 64f);
|
||||
|
||||
banDialog.buttons.addImageTextButton("$clear", Icon.trash, () -> {
|
||||
banDialog.buttons.button("$clear", Icon.trash, () -> {
|
||||
rules.bannedBlocks.clear();
|
||||
rebuildBanned();
|
||||
}).size(180, 64f);
|
||||
@@ -69,10 +69,10 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
for(Block block : array){
|
||||
t.table(Tex.underline, b -> {
|
||||
b.left().margin(4f);
|
||||
b.addImage(block.icon(Cicon.medium)).size(Cicon.medium.size).padRight(3);
|
||||
b.image(block.icon(Cicon.medium)).size(Cicon.medium.size).padRight(3);
|
||||
b.add(block.localizedName).color(Color.lightGray).padLeft(3).growX().left().wrap();
|
||||
|
||||
b.addImageButton(Icon.cancel, Styles.clearPartiali, () -> {
|
||||
b.button(Icon.cancel, Styles.clearPartiali, () -> {
|
||||
rules.bannedBlocks.remove(block);
|
||||
rebuildBanned();
|
||||
}).size(70f).pad(-4f).padLeft(0f);
|
||||
@@ -84,14 +84,14 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
}
|
||||
}).get().setScrollYForce(previousScroll);
|
||||
banDialog.cont.row();
|
||||
banDialog.cont.addImageTextButton("$add", Icon.add, () -> {
|
||||
banDialog.cont.button("$add", Icon.add, () -> {
|
||||
FloatingDialog dialog = new FloatingDialog("$add");
|
||||
dialog.cont.pane(t -> {
|
||||
t.left().margin(14f);
|
||||
int[] i = {0};
|
||||
content.blocks().each(b -> !rules.bannedBlocks.contains(b) && b.isBuildable(), b -> {
|
||||
int cols = mobile && Core.graphics.isPortrait() ? 4 : 12;
|
||||
t.addImageButton(new TextureRegionDrawable(b.icon(Cicon.medium)), Styles.cleari, () -> {
|
||||
t.button(new TextureRegionDrawable(b.icon(Cicon.medium)), Styles.cleari, () -> {
|
||||
rules.bannedBlocks.add(b);
|
||||
rebuildBanned();
|
||||
dialog.hide();
|
||||
@@ -118,7 +118,7 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
cont.clear();
|
||||
cont.pane(m -> main = m).get().setScrollingDisabled(true, false);
|
||||
main.margin(10f);
|
||||
main.addButton("$settings.reset", () -> {
|
||||
main.button("$settings.reset", () -> {
|
||||
rules = resetter.get();
|
||||
setup();
|
||||
requestKeyboard();
|
||||
@@ -145,7 +145,7 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
number("$rules.deconstructrefundmultiplier", false, f -> rules.deconstructRefundMultiplier = f, () -> rules.deconstructRefundMultiplier, () -> !rules.infiniteResources);
|
||||
number("$rules.blockhealthmultiplier", f -> rules.blockHealthMultiplier = f, () -> rules.blockHealthMultiplier);
|
||||
|
||||
main.addButton("$configure",
|
||||
main.button("$configure",
|
||||
() -> loadoutDialog.show(Blocks.coreShard.itemCapacity, rules.loadout,
|
||||
() -> {
|
||||
rules.loadout.clear();
|
||||
@@ -154,7 +154,7 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
)).left().width(300f);
|
||||
main.row();
|
||||
|
||||
main.addButton("$bannedblocks", banDialog::show).left().width(300f);
|
||||
main.button("$bannedblocks", banDialog::show).left().width(300f);
|
||||
main.row();
|
||||
|
||||
title("$rules.title.player");
|
||||
@@ -176,7 +176,7 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
number("$rules.solarpowermultiplier", f -> rules.solarPowerMultiplier = f, () -> rules.solarPowerMultiplier);
|
||||
check("$rules.lighting", b -> rules.lighting = b, () -> rules.lighting);
|
||||
|
||||
main.addButton(b -> {
|
||||
main.button(b -> {
|
||||
b.left();
|
||||
b.table(Tex.pane, in -> {
|
||||
in.stack(new Image(Tex.alphaBg), new Image(Tex.whiteui){{
|
||||
@@ -197,7 +197,7 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
t.left();
|
||||
t.add(text).left().padRight(5)
|
||||
.update(a -> a.setColor(condition.get() ? Color.white : Color.gray));
|
||||
Vars.platform.addDialog(t.addField((integer ? (int)prov.get() : prov.get()) + "", s -> cons.get(Strings.parseFloat(s)))
|
||||
Vars.platform.addDialog(t.field((integer ? (int)prov.get() : prov.get()) + "", s -> cons.get(Strings.parseFloat(s)))
|
||||
.padRight(100f)
|
||||
.update(a -> a.setDisabled(!condition.get()))
|
||||
.valid(Strings::canParsePositiveFloat).width(120f).left().get());
|
||||
@@ -210,14 +210,14 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
void check(String text, Boolc cons, Boolp prov, Boolp condition){
|
||||
main.addCheck(text, cons).checked(prov.get()).update(a -> a.setDisabled(!condition.get())).padRight(100f).get().left();
|
||||
main.check(text, cons).checked(prov.get()).update(a -> a.setDisabled(!condition.get())).padRight(100f).get().left();
|
||||
main.row();
|
||||
}
|
||||
|
||||
void title(String text){
|
||||
main.add(text).color(Pal.accent).padTop(20).padRight(100f).padBottom(-3);
|
||||
main.row();
|
||||
main.addImage().color(Pal.accent).height(3f).padRight(100f).padBottom(20);
|
||||
main.image().color(Pal.accent).height(3f).padRight(100f).padBottom(20);
|
||||
main.row();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.core.GameState.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.ctype.ContentType;
|
||||
import mindustry.gen.*;
|
||||
@@ -46,7 +45,7 @@ public class DatabaseDialog extends FloatingDialog{
|
||||
|
||||
table.add("$content." + type.name() + ".name").growX().left().color(Pal.accent);
|
||||
table.row();
|
||||
table.addImage().growX().pad(5).padLeft(0).padRight(0).height(3).color(Pal.accent);
|
||||
table.image().growX().pad(5).padLeft(0).padRight(0).height(3).color(Pal.accent);
|
||||
table.row();
|
||||
table.table(list -> {
|
||||
list.left();
|
||||
@@ -69,7 +68,7 @@ public class DatabaseDialog extends FloatingDialog{
|
||||
|
||||
if(unlocked(unlock)){
|
||||
image.clicked(() -> {
|
||||
if(Core.input.keyDown(KeyCode.SHIFT_LEFT) && Fonts.getUnicode(unlock.name) != 0){
|
||||
if(Core.input.keyDown(KeyCode.shiftLeft) && Fonts.getUnicode(unlock.name) != 0){
|
||||
Core.app.setClipboardText((char)Fonts.getUnicode(unlock.name) + "");
|
||||
ui.showInfoFade("$copied");
|
||||
}else{
|
||||
|
||||
@@ -23,14 +23,14 @@ public class DiscordDialog extends Dialog{
|
||||
t.background(Tex.button).margin(0);
|
||||
|
||||
t.table(img -> {
|
||||
img.addImage().height(h - 5).width(40f).color(color);
|
||||
img.image().height(h - 5).width(40f).color(color);
|
||||
img.row();
|
||||
img.addImage().height(5).width(40f).color(color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
|
||||
img.image().height(5).width(40f).color(color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
|
||||
}).expandY();
|
||||
|
||||
t.table(i -> {
|
||||
i.background(Tex.button);
|
||||
i.addImage(Icon.discord);
|
||||
i.image(Icon.discord);
|
||||
}).size(h).left();
|
||||
|
||||
t.add("$discord").color(Pal.accent).growX().padLeft(10f);
|
||||
@@ -38,11 +38,11 @@ public class DiscordDialog extends Dialog{
|
||||
|
||||
buttons.defaults().size(150f, 50);
|
||||
|
||||
buttons.addButton("$back", this::hide);
|
||||
buttons.addButton("$copylink", () -> {
|
||||
buttons.button("$back", this::hide);
|
||||
buttons.button("$copylink", () -> {
|
||||
Core.app.setClipboardText(discordURL);
|
||||
});
|
||||
buttons.addButton("$openlink", () -> {
|
||||
buttons.button("$openlink", () -> {
|
||||
if(!Core.net.openURI(discordURL)){
|
||||
ui.showErrorMessage("$linkfail");
|
||||
Core.app.setClipboardText(discordURL);
|
||||
|
||||
@@ -20,7 +20,7 @@ public class FloatingDialog extends Dialog{
|
||||
setFillParent(true);
|
||||
this.title.setAlignment(Align.center);
|
||||
titleTable.row();
|
||||
titleTable.addImage(Tex.whiteui, Pal.accent)
|
||||
titleTable.image(Tex.whiteui, Pal.accent)
|
||||
.growX().height(3f).pad(4f);
|
||||
|
||||
hidden(() -> {
|
||||
@@ -56,10 +56,10 @@ public class FloatingDialog extends Dialog{
|
||||
@Override
|
||||
public void addCloseButton(){
|
||||
buttons.defaults().size(210f, 64f);
|
||||
buttons.addImageTextButton("$back", Icon.left, this::hide).size(210f, 64f);
|
||||
buttons.button("$back", Icon.left, this::hide).size(210f, 64f);
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK){
|
||||
if(key == KeyCode.escape || key == KeyCode.back){
|
||||
Core.app.post(this::hide);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ public class GameOverDialog extends FloatingDialog{
|
||||
|
||||
if(state.rules.pvp){
|
||||
cont.add(Core.bundle.format("gameover.pvp", winner.localized())).pad(6);
|
||||
buttons.addButton("$menu", () -> {
|
||||
buttons.button("$menu", () -> {
|
||||
hide();
|
||||
logic.reset();
|
||||
}).size(130f, 60f);
|
||||
@@ -71,7 +71,7 @@ public class GameOverDialog extends FloatingDialog{
|
||||
if(state.stats.itemsDelivered.get(item, 0) > 0){
|
||||
t.table(items -> {
|
||||
items.add(" [LIGHT_GRAY]" + state.stats.itemsDelivered.get(item, 0));
|
||||
items.addImage(item.icon(Cicon.small)).size(8 * 3).pad(4);
|
||||
items.image(item.icon(Cicon.small)).size(8 * 3).pad(4);
|
||||
}).left();
|
||||
t.row();
|
||||
}
|
||||
@@ -86,13 +86,13 @@ public class GameOverDialog extends FloatingDialog{
|
||||
}).pad(12);
|
||||
|
||||
if(state.isCampaign()){
|
||||
buttons.addButton("$continue", () -> {
|
||||
buttons.button("$continue", () -> {
|
||||
hide();
|
||||
logic.reset();
|
||||
ui.planet.show();
|
||||
}).size(130f, 60f);
|
||||
}else{
|
||||
buttons.addButton("$menu", () -> {
|
||||
buttons.button("$menu", () -> {
|
||||
hide();
|
||||
logic.reset();
|
||||
}).size(130f, 60f);
|
||||
|
||||
@@ -22,14 +22,14 @@ public class HostDialog extends FloatingDialog{
|
||||
|
||||
cont.table(t -> {
|
||||
t.add("$name").padRight(10);
|
||||
t.addField(Core.settings.getString("name"), text -> {
|
||||
t.field(Core.settings.getString("name"), text -> {
|
||||
player.name(text);
|
||||
Core.settings.put("name", text);
|
||||
Core.settings.save();
|
||||
ui.listfrag.rebuild();
|
||||
}).grow().pad(8).get().setMaxLength(40);
|
||||
|
||||
ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
||||
ImageButton button = t.button(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
||||
new PaletteDialog().show(color -> {
|
||||
player.color().set(color);
|
||||
Core.settings.put("color-0", color.rgba());
|
||||
@@ -43,7 +43,7 @@ public class HostDialog extends FloatingDialog{
|
||||
|
||||
cont.add().width(65f);
|
||||
|
||||
cont.addButton("$host", () -> {
|
||||
cont.button("$host", () -> {
|
||||
if(Core.settings.getString("name").trim().isEmpty()){
|
||||
ui.showInfo("$noname");
|
||||
return;
|
||||
@@ -52,7 +52,7 @@ public class HostDialog extends FloatingDialog{
|
||||
runHost();
|
||||
}).width(w).height(70f);
|
||||
|
||||
cont.addButton("?", () -> ui.showInfo("$host.info")).size(65f, 70f).padLeft(6f);
|
||||
cont.button("?", () -> ui.showInfo("$host.info")).size(65f, 70f).padLeft(6f);
|
||||
|
||||
shown(() -> {
|
||||
if(!steam){
|
||||
|
||||
@@ -41,13 +41,13 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
buttons.add().growX().width(-1);
|
||||
if(!steam){
|
||||
buttons.addButton("?", () -> ui.showInfo("$join.info")).size(60f, 64f).width(-1);
|
||||
buttons.button("?", () -> ui.showInfo("$join.info")).size(60f, 64f).width(-1);
|
||||
}
|
||||
|
||||
add = new FloatingDialog("$joingame.title");
|
||||
add.cont.add("$joingame.ip").padRight(5f).left();
|
||||
|
||||
TextField field = add.cont.addField(Core.settings.getString("ip"), text -> {
|
||||
TextField field = add.cont.field(Core.settings.getString("ip"), text -> {
|
||||
Core.settings.put("ip", text);
|
||||
Core.settings.save();
|
||||
}).size(320f, 54f).get();
|
||||
@@ -56,8 +56,8 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
add.cont.row();
|
||||
add.buttons.defaults().size(140f, 60f).pad(4f);
|
||||
add.buttons.addButton("$cancel", add::hide);
|
||||
add.buttons.addButton("$ok", () -> {
|
||||
add.buttons.button("$cancel", add::hide);
|
||||
add.buttons.button("$ok", () -> {
|
||||
if(renaming == null){
|
||||
Server server = new Server();
|
||||
server.setIP(Core.settings.getString("ip"));
|
||||
@@ -81,7 +81,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
}
|
||||
});
|
||||
|
||||
keyDown(KeyCode.F5, this::refreshAll);
|
||||
keyDown(KeyCode.f5, this::refreshAll);
|
||||
|
||||
shown(() -> {
|
||||
setup();
|
||||
@@ -111,7 +111,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
//why are java lambdas this bad
|
||||
TextButton[] buttons = {null};
|
||||
|
||||
TextButton button = buttons[0] = remote.addButton("[accent]" + server.displayIP(), Styles.cleart, () -> {
|
||||
TextButton button = buttons[0] = remote.button("[accent]" + server.displayIP(), Styles.cleart, () -> {
|
||||
if(!buttons[0].childrenPressed()){
|
||||
if(server.lastHost != null){
|
||||
safeConnect(server.ip, server.port, server.lastHost.version);
|
||||
@@ -129,26 +129,26 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
inner.add(button.getLabel()).growX();
|
||||
|
||||
inner.addImageButton(Icon.upOpen, Styles.emptyi, () -> {
|
||||
inner.button(Icon.upOpen, Styles.emptyi, () -> {
|
||||
moveRemote(server, -1);
|
||||
|
||||
}).margin(3f).padTop(6f).top().right();
|
||||
|
||||
inner.addImageButton(Icon.downOpen, Styles.emptyi, () -> {
|
||||
inner.button(Icon.downOpen, Styles.emptyi, () -> {
|
||||
moveRemote(server, +1);
|
||||
|
||||
}).margin(3f).pad(2).padTop(6f).top().right();
|
||||
|
||||
inner.addImageButton(Icon.refresh, Styles.emptyi, () -> {
|
||||
inner.button(Icon.refresh, Styles.emptyi, () -> {
|
||||
refreshServer(server);
|
||||
}).margin(3f).pad(2).padTop(6f).top().right();
|
||||
|
||||
inner.addImageButton(Icon.pencil, Styles.emptyi, () -> {
|
||||
inner.button(Icon.pencil, Styles.emptyi, () -> {
|
||||
renaming = server;
|
||||
add.show();
|
||||
}).margin(3f).pad(2).padTop(6f).top().right();
|
||||
|
||||
inner.addImageButton(Icon.trash, Styles.emptyi, () -> {
|
||||
inner.button(Icon.trash, Styles.emptyi, () -> {
|
||||
ui.showConfirm("$confirm", "$server.delete", () -> {
|
||||
servers.remove(server, true);
|
||||
saveServers();
|
||||
@@ -262,7 +262,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
cont.table(t -> {
|
||||
t.add("$name").padRight(10);
|
||||
if(!steam){
|
||||
t.addField(Core.settings.getString("name"), text -> {
|
||||
t.field(Core.settings.getString("name"), text -> {
|
||||
player.name(text);
|
||||
Core.settings.put("name", text);
|
||||
Core.settings.save();
|
||||
@@ -271,7 +271,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
t.add(player.name()).update(l -> l.setColor(player.color())).grow().pad(8);
|
||||
}
|
||||
|
||||
ImageButton button = t.addImageButton(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
||||
ImageButton button = t.button(Tex.whiteui, Styles.clearFulli, 40, () -> {
|
||||
new PaletteDialog().show(color -> {
|
||||
player.color().set(color);
|
||||
Core.settings.put("color-0", color.rgba8888());
|
||||
@@ -283,7 +283,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
cont.row();
|
||||
cont.add(pane).width(w + 38).pad(0);
|
||||
cont.row();
|
||||
cont.addCenteredImageTextButton("$server.add", Icon.add, () -> {
|
||||
cont.buttonCenter("$server.add", Icon.add, () -> {
|
||||
renaming = null;
|
||||
add.show();
|
||||
}).marginLeft(10).width(w).height(80f).update(button -> {
|
||||
@@ -310,13 +310,13 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
hosts.table(name -> {
|
||||
name.add(label).pad(10).growX().left().color(Pal.accent);
|
||||
name.addImageButton(Icon.downOpen, Styles.emptyi, () -> {
|
||||
name.button(Icon.downOpen, Styles.emptyi, () -> {
|
||||
coll.toggle(false);
|
||||
Core.settings.putSave("collapsed-" + label, coll.isCollapsed());
|
||||
}).update(i -> i.getStyle().imageUp = (!coll.isCollapsed() ? Icon.upOpen : Icon.downOpen)).size(40f).right().padRight(10f);
|
||||
}).growX();
|
||||
hosts.row();
|
||||
hosts.addImage().growX().pad(5).padLeft(10).padRight(10).height(3).color(Pal.accent);
|
||||
hosts.image().growX().pad(5).padLeft(10).padRight(10).height(3).color(Pal.accent);
|
||||
hosts.row();
|
||||
hosts.add(coll).width(targetWidth());
|
||||
hosts.row();
|
||||
@@ -350,7 +350,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
local.background(Tex.button);
|
||||
local.add("$hosts.none").pad(10f);
|
||||
local.add().growX();
|
||||
local.addImageButton(Icon.refresh, this::refreshLocal).pad(-12f).padLeft(0).size(70f);
|
||||
local.button(Icon.refresh, this::refreshLocal).pad(-12f).padLeft(0).size(70f);
|
||||
}else{
|
||||
local.background(null);
|
||||
}
|
||||
@@ -366,7 +366,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
local.row();
|
||||
|
||||
TextButton button = local.addButton("", Styles.cleart, () -> safeConnect(host.address, host.port, host.version))
|
||||
TextButton button = local.button("", Styles.cleart, () -> safeConnect(host.address, host.port, host.version))
|
||||
.width(w).pad(5f).get();
|
||||
button.clearChildren();
|
||||
buildServer(host, button);
|
||||
@@ -378,7 +378,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
global.row();
|
||||
|
||||
TextButton button = global.addButton("", Styles.cleart, () -> safeConnect(host.address, host.port, host.version))
|
||||
TextButton button = global.button("", Styles.cleart, () -> safeConnect(host.address, host.port, host.version))
|
||||
.width(w).pad(5f).get();
|
||||
button.clearChildren();
|
||||
buildServer(host, button);
|
||||
|
||||
@@ -70,25 +70,25 @@ public class LoadDialog extends FloatingDialog{
|
||||
t.right();
|
||||
t.defaults().size(40f);
|
||||
|
||||
t.addImageButton(Icon.save, Styles.emptytogglei, () -> {
|
||||
t.button(Icon.save, Styles.emptytogglei, () -> {
|
||||
slot.setAutosave(!slot.isAutosave());
|
||||
}).checked(slot.isAutosave()).right();
|
||||
|
||||
t.addImageButton(Icon.trash, Styles.emptyi, () -> {
|
||||
t.button(Icon.trash, Styles.emptyi, () -> {
|
||||
ui.showConfirm("$confirm", "$save.delete.confirm", () -> {
|
||||
slot.delete();
|
||||
setup();
|
||||
});
|
||||
}).right();
|
||||
|
||||
t.addImageButton(Icon.pencil, Styles.emptyi, () -> {
|
||||
t.button(Icon.pencil, Styles.emptyi, () -> {
|
||||
ui.showTextInput("$save.rename", "$save.rename.text", slot.getName(), text -> {
|
||||
slot.setName(text);
|
||||
setup();
|
||||
});
|
||||
}).right();
|
||||
|
||||
t.addImageButton(Icon.export, Styles.emptyi, () -> platform.export("save-" + slot.getName(), saveExtension, slot::exportFile)).right();
|
||||
t.button(Icon.export, Styles.emptyi, () -> platform.export("save-" + slot.getName(), saveExtension, slot::exportFile)).right();
|
||||
|
||||
}).padRight(-10).growX();
|
||||
}).growX().colspan(2);
|
||||
@@ -142,13 +142,13 @@ public class LoadDialog extends FloatingDialog{
|
||||
|
||||
if(!valids){
|
||||
slots.row();
|
||||
slots.addButton("$save.none", () -> {
|
||||
slots.button("$save.none", () -> {
|
||||
}).disabled(true).fillX().margin(20f).minWidth(340f).height(80f).pad(4f);
|
||||
}
|
||||
|
||||
slots.row();
|
||||
|
||||
slots.addImageTextButton("$save.import", Icon.add, () -> {
|
||||
slots.button("$save.import", Icon.add, () -> {
|
||||
platform.showFileChooser(true, saveExtension, file -> {
|
||||
if(SaveIO.isSaveValid(file)){
|
||||
try{
|
||||
|
||||
@@ -26,7 +26,7 @@ public class LoadoutDialog extends FloatingDialog{
|
||||
setFillParent(true);
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK){
|
||||
if(key == KeyCode.escape || key == KeyCode.back){
|
||||
Core.app.post(this::hide);
|
||||
}
|
||||
});
|
||||
@@ -42,9 +42,9 @@ public class LoadoutDialog extends FloatingDialog{
|
||||
}
|
||||
});
|
||||
|
||||
buttons.addImageTextButton("$back", Icon.left, this::hide).size(210f, 64f);
|
||||
buttons.button("$back", Icon.left, this::hide).size(210f, 64f);
|
||||
|
||||
buttons.addImageTextButton("$settings.reset", Icon.refresh, () -> {
|
||||
buttons.button("$settings.reset", Icon.refresh, () -> {
|
||||
resetter.run();
|
||||
reseed();
|
||||
updater.run();
|
||||
@@ -73,17 +73,17 @@ public class LoadoutDialog extends FloatingDialog{
|
||||
for(ItemStack stack : stacks){
|
||||
items.table(Tex.pane, t -> {
|
||||
t.margin(4).marginRight(8).left();
|
||||
t.addButton("-", Styles.cleart, () -> {
|
||||
t.button("-", Styles.cleart, () -> {
|
||||
stack.amount = Math.max(stack.amount - step(stack.amount), 0);
|
||||
updater.run();
|
||||
}).size(bsize);
|
||||
|
||||
t.addButton("+", Styles.cleart, () -> {
|
||||
t.button("+", Styles.cleart, () -> {
|
||||
stack.amount = Math.min(stack.amount + step(stack.amount), capacity);
|
||||
updater.run();
|
||||
}).size(bsize);
|
||||
|
||||
t.addImageButton(Icon.pencil, Styles.cleari, () -> ui.showTextInput("$configure", stack.item.localizedName, 10, stack.amount + "", true, str -> {
|
||||
t.button(Icon.pencil, Styles.cleari, () -> ui.showTextInput("$configure", stack.item.localizedName, 10, stack.amount + "", true, str -> {
|
||||
if(Strings.canParsePostiveInt(str)){
|
||||
int amount = Strings.parseInt(str);
|
||||
if(amount >= 0 && amount <= capacity){
|
||||
@@ -95,7 +95,7 @@ public class LoadoutDialog extends FloatingDialog{
|
||||
ui.showInfo(Core.bundle.format("configure.invalid", capacity));
|
||||
})).size(bsize);
|
||||
|
||||
t.addImage(stack.item.icon(Cicon.small)).size(8 * 3).padRight(4).padLeft(4);
|
||||
t.image(stack.item.icon(Cicon.small)).size(8 * 3).padRight(4).padLeft(4);
|
||||
t.label(() -> stack.amount + "").left().width(90f);
|
||||
}).pad(2).left().fillX();
|
||||
|
||||
|
||||
@@ -56,18 +56,18 @@ public class MapPlayDialog extends FloatingDialog{
|
||||
for(Gamemode mode : Gamemode.values()){
|
||||
if(mode.hidden) continue;
|
||||
|
||||
modes.addButton(mode.toString(), Styles.togglet, () -> {
|
||||
modes.button(mode.toString(), Styles.togglet, () -> {
|
||||
selectedGamemode = mode;
|
||||
rules = map.applyRules(mode);
|
||||
}).update(b -> b.setChecked(selectedGamemode == mode)).size(140f, 54f).disabled(!mode.valid(map));
|
||||
if(i++ % 2 == 1) modes.row();
|
||||
}
|
||||
selmode.add(modes);
|
||||
selmode.addButton("?", this::displayGameModeHelp).width(50f).fillY().padLeft(18f);
|
||||
selmode.button("?", this::displayGameModeHelp).width(50f).fillY().padLeft(18f);
|
||||
|
||||
cont.add(selmode);
|
||||
cont.row();
|
||||
cont.addImageTextButton("$customize", Icon.settings, () -> dialog.show(rules, () -> rules = map.applyRules(selectedGamemode))).width(230);
|
||||
cont.button("$customize", Icon.settings, () -> dialog.show(rules, () -> rules = map.applyRules(selectedGamemode))).width(230);
|
||||
cont.row();
|
||||
cont.add(new BorderImage(map.safeTexture(), 3f)).size(mobile && !Core.graphics.isPortrait() ? 150f : 250f).get().setScaling(Scaling.fit);
|
||||
//only maps with survival are valid for high scores
|
||||
@@ -79,7 +79,7 @@ public class MapPlayDialog extends FloatingDialog{
|
||||
buttons.clearChildren();
|
||||
addCloseButton();
|
||||
|
||||
buttons.addImageTextButton("$play", Icon.play, () -> {
|
||||
buttons.button("$play", Icon.play, () -> {
|
||||
control.playMap(map, rules);
|
||||
hide();
|
||||
ui.custom.hide();
|
||||
@@ -103,7 +103,7 @@ public class MapPlayDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
d.cont.add(pane);
|
||||
d.buttons.addButton("$ok", d::hide).size(110, 50).pad(10f);
|
||||
d.buttons.button("$ok", d::hide).size(110, 50).pad(10f);
|
||||
d.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class MapsDialog extends FloatingDialog{
|
||||
buttons.remove();
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK){
|
||||
if(key == KeyCode.escape || key == KeyCode.back){
|
||||
Core.app.post(this::hide);
|
||||
}
|
||||
});
|
||||
@@ -44,13 +44,13 @@ public class MapsDialog extends FloatingDialog{
|
||||
buttons.clearChildren();
|
||||
|
||||
if(Core.graphics.isPortrait()){
|
||||
buttons.addImageTextButton("$back", Icon.left, this::hide).size(210f*2f, 64f).colspan(2);
|
||||
buttons.button("$back", Icon.left, this::hide).size(210f*2f, 64f).colspan(2);
|
||||
buttons.row();
|
||||
}else{
|
||||
buttons.addImageTextButton("$back", Icon.left, this::hide).size(210f, 64f);
|
||||
buttons.button("$back", Icon.left, this::hide).size(210f, 64f);
|
||||
}
|
||||
|
||||
buttons.addImageTextButton("$editor.newmap", Icon.add, () -> {
|
||||
buttons.button("$editor.newmap", Icon.add, () -> {
|
||||
ui.showTextInput("$editor.newmap", "$editor.mapname", "", text -> {
|
||||
Runnable show = () -> ui.loadAnd(() -> {
|
||||
hide();
|
||||
@@ -67,7 +67,7 @@ public class MapsDialog extends FloatingDialog{
|
||||
});
|
||||
}).size(210f, 64f);
|
||||
|
||||
buttons.addImageTextButton("$editor.importmap", Icon.upload, () -> {
|
||||
buttons.button("$editor.importmap", Icon.upload, () -> {
|
||||
platform.showFileChooser(true, mapExtension, file -> {
|
||||
ui.loadAnd(() -> {
|
||||
maps.tryCatchMapError(() -> {
|
||||
@@ -134,12 +134,12 @@ public class MapsDialog extends FloatingDialog{
|
||||
maps.row();
|
||||
}
|
||||
|
||||
TextButton button = maps.addButton("", Styles.cleart, () -> showMapInfo(map)).width(mapsize).pad(8).get();
|
||||
TextButton button = maps.button("", Styles.cleart, () -> showMapInfo(map)).width(mapsize).pad(8).get();
|
||||
button.clearChildren();
|
||||
button.margin(9);
|
||||
button.add(map.name()).width(mapsize - 18f).center().get().setEllipsis(true);
|
||||
button.row();
|
||||
button.addImage().growX().pad(4).color(Pal.gray);
|
||||
button.image().growX().pad(4).color(Pal.gray);
|
||||
button.row();
|
||||
button.stack(new Image(map.safeTexture()).setScaling(Scaling.fit), new BorderImage(map.safeTexture()).setScaling(Scaling.fit)).size(mapsize - 20f);
|
||||
button.row();
|
||||
@@ -192,7 +192,7 @@ public class MapsDialog extends FloatingDialog{
|
||||
|
||||
table.row();
|
||||
|
||||
table.addImageTextButton("$editor.openin", Icon.export, () -> {
|
||||
table.button("$editor.openin", Icon.export, () -> {
|
||||
try{
|
||||
Vars.ui.editor.beginEditMap(map.file);
|
||||
dialog.hide();
|
||||
@@ -203,7 +203,7 @@ public class MapsDialog extends FloatingDialog{
|
||||
}
|
||||
}).fillX().height(54f).marginLeft(10);
|
||||
|
||||
table.addImageTextButton(map.workshop && steam ? "$view.workshop" : "$delete", map.workshop && steam ? Icon.link : Icon.trash, () -> {
|
||||
table.button(map.workshop && steam ? "$view.workshop" : "$delete", map.workshop && steam ? Icon.link : Icon.trash, () -> {
|
||||
if(map.workshop && steam){
|
||||
platform.viewListing(map);
|
||||
}else{
|
||||
|
||||
@@ -28,7 +28,7 @@ public class MinimapDialog extends FloatingDialog{
|
||||
cont.clear();
|
||||
|
||||
cont.table(Tex.pane,t -> {
|
||||
t.addRect((x, y, width, height) -> {
|
||||
t.rect((x, y, width, height) -> {
|
||||
if(renderer.minimap.getRegion() == null) return;
|
||||
Draw.color(Color.white);
|
||||
Draw.alpha(parentAlpha);
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ModsDialog extends FloatingDialog{
|
||||
super("$mods");
|
||||
addCloseButton();
|
||||
|
||||
buttons.addImageTextButton("$mods.guide", Icon.link, () -> Core.net.openURI(modGuideURL)).size(210, 64f);
|
||||
buttons.button("$mods.guide", Icon.link, () -> Core.net.openURI(modGuideURL)).size(210, 64f);
|
||||
|
||||
|
||||
shown(this::setup);
|
||||
@@ -66,7 +66,7 @@ public class ModsDialog extends FloatingDialog{
|
||||
TextButtonStyle style = Styles.clearPartialt;
|
||||
float margin = 12f;
|
||||
|
||||
buttons.addImageTextButton("$mod.import", Icon.add, style, () -> {
|
||||
buttons.button("$mod.import", Icon.add, style, () -> {
|
||||
FloatingDialog dialog = new FloatingDialog("$mod.import");
|
||||
|
||||
TextButtonStyle bstyle = Styles.cleart;
|
||||
@@ -75,7 +75,7 @@ public class ModsDialog extends FloatingDialog{
|
||||
t.defaults().size(300f, 70f);
|
||||
t.margin(12f);
|
||||
|
||||
t.addImageTextButton("$mod.import.file", Icon.file, bstyle, () -> {
|
||||
t.button("$mod.import.file", Icon.file, bstyle, () -> {
|
||||
dialog.hide();
|
||||
|
||||
platform.showFileChooser(true, "zip", file -> {
|
||||
@@ -91,7 +91,7 @@ public class ModsDialog extends FloatingDialog{
|
||||
|
||||
t.row();
|
||||
|
||||
t.addImageTextButton("$mod.import.github", Icon.github, bstyle, () -> {
|
||||
t.button("$mod.import.github", Icon.github, bstyle, () -> {
|
||||
dialog.hide();
|
||||
|
||||
ui.showTextInput("$mod.import.github", "", 64, "Anuken/ExampleMod", text -> {
|
||||
@@ -131,10 +131,10 @@ public class ModsDialog extends FloatingDialog{
|
||||
dialog.show();
|
||||
}).margin(margin);
|
||||
|
||||
buttons.addImageTextButton("$mods.reload", Icon.refresh, style, this::reload).margin(margin);
|
||||
buttons.button("$mods.reload", Icon.refresh, style, this::reload).margin(margin);
|
||||
|
||||
if(!mobile){
|
||||
buttons.addImageTextButton("$mods.openfolder", Icon.link, style, () -> Core.app.openFolder(modDirectory.absolutePath())).margin(margin);
|
||||
buttons.button("$mods.openfolder", Icon.link, style, () -> Core.app.openFolder(modDirectory.absolutePath())).margin(margin);
|
||||
}
|
||||
}).width(w);
|
||||
|
||||
@@ -151,11 +151,11 @@ public class ModsDialog extends FloatingDialog{
|
||||
if(!mod.enabled() && !anyDisabled && mods.list().size > 0){
|
||||
anyDisabled = true;
|
||||
table.row();
|
||||
table.addImage().growX().height(4f).pad(6f).color(Pal.gray);
|
||||
table.image().growX().height(4f).pad(6f).color(Pal.gray);
|
||||
table.row();
|
||||
}
|
||||
|
||||
table.addButton(t -> {
|
||||
table.button(t -> {
|
||||
t.top().left();
|
||||
t.margin(12f);
|
||||
|
||||
@@ -176,26 +176,26 @@ public class ModsDialog extends FloatingDialog{
|
||||
Fonts.def.draw(letter, x + width/2f, y + height/2f, Align.center);
|
||||
}
|
||||
}
|
||||
}.border(Pal.accent)).size(h - 8f).padTop(-8f).padLeft(-8f).padRight(6f);
|
||||
}.border(Pal.accent)).size(h - 8f).padTop(-8f).padLeft(-8f).padRight(2f);
|
||||
|
||||
t.defaults().left().top();
|
||||
t.table(title -> {
|
||||
title.left();
|
||||
title.add("" + mod.meta.displayName() + "\n[lightgray]v" + mod.meta.version + (mod.enabled() ? "" : "\n" + Core.bundle.get("mod.disabled") + "")).growX();
|
||||
title.add("" + mod.meta.displayName() + "\n[lightgray]v" + mod.meta.version + (mod.enabled() ? "" : "\n" + Core.bundle.get("mod.disabled") + "")).wrap().width(170f).growX();
|
||||
title.add().growX();
|
||||
|
||||
title.addImageTextButton(mod.enabled() ? "$mod.disable" : "$mod.enable", mod.enabled() ? Icon.downOpen : Icon.upOpen, Styles.transt, () -> {
|
||||
title.button(mod.enabled() ? "$mod.disable" : "$mod.enable", mod.enabled() ? Icon.downOpen : Icon.upOpen, Styles.transt, () -> {
|
||||
mods.setEnabled(mod, !mod.enabled());
|
||||
setup();
|
||||
}).height(50f).margin(8f).width(130f).disabled(!mod.isSupported());
|
||||
|
||||
if(steam && !mod.hasSteamID()){
|
||||
title.addImageButton(Icon.download, Styles.clearTransi, () -> {
|
||||
title.button(Icon.download, Styles.clearTransi, () -> {
|
||||
platform.publish(mod);
|
||||
}).size(50f);
|
||||
}
|
||||
|
||||
title.addImageButton(mod.hasSteamID() ? Icon.link : Icon.trash, Styles.clearPartiali, () -> {
|
||||
title.button(mod.hasSteamID() ? Icon.link : Icon.trash, Styles.clearPartiali, () -> {
|
||||
if(!mod.hasSteamID()){
|
||||
ui.showConfirm("$confirm", "$mod.remove.confirm", () -> {
|
||||
mods.removeMod(mod);
|
||||
@@ -250,7 +250,7 @@ public class ModsDialog extends FloatingDialog{
|
||||
dialog.addCloseButton();
|
||||
|
||||
if(!mobile){
|
||||
dialog.buttons.addImageTextButton("$mods.openfolder", Icon.link, () -> Core.app.openFolder(mod.file.absolutePath()));
|
||||
dialog.buttons.button("$mods.openfolder", Icon.link, () -> Core.app.openFolder(mod.file.absolutePath()));
|
||||
}
|
||||
|
||||
//TODO improve this menu later
|
||||
|
||||
@@ -25,7 +25,7 @@ public class PaletteDialog extends Dialog{
|
||||
for(int i = 0; i < playerColors.length; i++){
|
||||
Color color = playerColors[i];
|
||||
|
||||
ImageButton button = table.addImageButton(Tex.whiteui, Styles.clearTogglei, 34, () -> {
|
||||
ImageButton button = table.button(Tex.whiteui, Styles.clearTogglei, 34, () -> {
|
||||
cons.get(color);
|
||||
hide();
|
||||
}).size(48).get();
|
||||
@@ -38,7 +38,7 @@ public class PaletteDialog extends Dialog{
|
||||
}
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK)
|
||||
if(key == KeyCode.escape || key == KeyCode.back)
|
||||
hide();
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public class PausedDialog extends FloatingDialog{
|
||||
shown(this::rebuild);
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK){
|
||||
if(key == KeyCode.escape || key == KeyCode.back){
|
||||
hide();
|
||||
}
|
||||
});
|
||||
@@ -37,26 +37,26 @@ public class PausedDialog extends FloatingDialog{
|
||||
float dw = 220f;
|
||||
cont.defaults().width(dw).height(55).pad(5f);
|
||||
|
||||
cont.addImageTextButton("$back", Icon.left, this::hide).colspan(2).width(dw * 2 + 20f);
|
||||
cont.button("$back", Icon.left, this::hide).colspan(2).width(dw * 2 + 20f);
|
||||
|
||||
cont.row();
|
||||
if(state.isCampaign()){
|
||||
cont.addImageTextButton("$techtree", Icon.tree, ui.tech::show);
|
||||
cont.button("$techtree", Icon.tree, ui.tech::show);
|
||||
}else{
|
||||
cont.addImageTextButton("$database", Icon.book, ui.database::show);
|
||||
cont.button("$database", Icon.book, ui.database::show);
|
||||
}
|
||||
cont.addImageTextButton("$settings", Icon.settings, ui.settings::show);
|
||||
cont.button("$settings", Icon.settings, ui.settings::show);
|
||||
|
||||
if(!state.rules.tutorial){
|
||||
if(!state.isCampaign() && !state.isEditor()){
|
||||
cont.row();
|
||||
cont.addImageTextButton("$savegame", Icon.save, save::show);
|
||||
cont.addImageTextButton("$loadgame", Icon.upload, load::show).disabled(b -> net.active());
|
||||
cont.button("$savegame", Icon.save, save::show);
|
||||
cont.button("$loadgame", Icon.upload, load::show).disabled(b -> net.active());
|
||||
}
|
||||
|
||||
cont.row();
|
||||
|
||||
cont.addImageTextButton("$hostserver", Icon.host, () -> {
|
||||
cont.button("$hostserver", Icon.host, () -> {
|
||||
if(net.server() && steam){
|
||||
platform.inviteFriends();
|
||||
}else{
|
||||
@@ -71,26 +71,26 @@ public class PausedDialog extends FloatingDialog{
|
||||
|
||||
cont.row();
|
||||
|
||||
cont.addImageTextButton("$quit", Icon.exit, this::showQuitConfirm).colspan(2).width(dw + 20f).update(s -> s.setText(control.saves.getCurrent() != null && control.saves.getCurrent().isAutosave() ? "$save.quit" : "$quit"));
|
||||
cont.button("$quit", Icon.exit, this::showQuitConfirm).colspan(2).width(dw + 20f).update(s -> s.setText(control.saves.getCurrent() != null && control.saves.getCurrent().isAutosave() ? "$save.quit" : "$quit"));
|
||||
|
||||
}else{
|
||||
cont.defaults().size(130f).pad(5);
|
||||
cont.addRowImageTextButton("$back", Icon.play, this::hide);
|
||||
cont.addRowImageTextButton("$settings", Icon.settings, ui.settings::show);
|
||||
cont.buttonRow("$back", Icon.play, this::hide);
|
||||
cont.buttonRow("$settings", Icon.settings, ui.settings::show);
|
||||
|
||||
if(!state.isCampaign() && !state.isEditor()){
|
||||
cont.addRowImageTextButton("$save", Icon.save, save::show);
|
||||
cont.buttonRow("$save", Icon.save, save::show);
|
||||
|
||||
cont.row();
|
||||
|
||||
cont.addRowImageTextButton("$load", Icon.download, load::show).disabled(b -> net.active());
|
||||
cont.buttonRow("$load", Icon.download, load::show).disabled(b -> net.active());
|
||||
}else{
|
||||
cont.row();
|
||||
}
|
||||
|
||||
cont.addRowImageTextButton("$hostserver.mobile", Icon.host, ui.host::show).disabled(b -> net.active());
|
||||
cont.buttonRow("$hostserver.mobile", Icon.host, ui.host::show).disabled(b -> net.active());
|
||||
|
||||
cont.addRowImageTextButton("$quit", Icon.exit, this::showQuitConfirm).update(s -> {
|
||||
cont.buttonRow("$quit", Icon.exit, this::showQuitConfirm).update(s -> {
|
||||
s.setText(control.saves.getCurrent() != null && control.saves.getCurrent().isAutosave() ? "$save.quit" : "$quit");
|
||||
s.getLabelCell().growX().wrap();
|
||||
});
|
||||
|
||||
@@ -92,7 +92,7 @@ public class PlanetDialog extends FloatingDialog{
|
||||
float bmargin = 6f;
|
||||
|
||||
//TODO names
|
||||
buttons.addImageTextButton("$back", Icon.left, style, this::hide).margin(bmargin);
|
||||
buttons.button("$back", Icon.left, style, this::hide).margin(bmargin);
|
||||
//buttons.addImageTextButton("Tech", Icon.tree, style, () -> ui.tech.show()).margin(bmargin);
|
||||
//buttons.addImageTextButton("Launch", Icon.upOpen, style, this::hide).margin(bmargin);
|
||||
//buttons.addImageTextButton("Database", Icon.book, style, () -> ui.database.show()).margin(bmargin);
|
||||
@@ -163,7 +163,7 @@ public class PlanetDialog extends FloatingDialog{
|
||||
cont.clear();
|
||||
titleTable.remove();
|
||||
|
||||
cont.addRect((x, y, w, h) -> render()).grow();
|
||||
cont.rect((x, y, w, h) -> render()).grow();
|
||||
}
|
||||
|
||||
private void render(){
|
||||
@@ -341,7 +341,7 @@ public class PlanetDialog extends FloatingDialog{
|
||||
//TODO add strings to bundle after prototyping is done
|
||||
|
||||
stable.add("[accent]" + selected.id).row();
|
||||
stable.addImage().color(Pal.accent).fillX().height(3f).pad(3f).row();
|
||||
stable.image().color(Pal.accent).fillX().height(3f).pad(3f).row();
|
||||
stable.add(selected.save != null ? selected.save.getPlayTime() : "[lightgray]Unexplored").row();
|
||||
|
||||
stable.add("Resources:").row();
|
||||
@@ -350,14 +350,14 @@ public class PlanetDialog extends FloatingDialog{
|
||||
int idx = 0;
|
||||
int max = 5;
|
||||
for(UnlockableContent c : selected.data.resources){
|
||||
t.addImage(c.icon(Cicon.small)).padRight(3);
|
||||
t.image(c.icon(Cicon.small)).padRight(3);
|
||||
if(++idx % max == 0) t.row();
|
||||
}
|
||||
}).fillX().row();
|
||||
|
||||
stable.row();
|
||||
|
||||
stable.addButton("Launch", Styles.transt, () -> {
|
||||
stable.button("Launch", Styles.transt, () -> {
|
||||
if(selected != null){
|
||||
if(selected.is(SectorAttribute.naval)){
|
||||
ui.showInfo("You need a naval loadout to launch here.");
|
||||
|
||||
@@ -3,7 +3,6 @@ package mindustry.ui.dialogs;
|
||||
import arc.Core;
|
||||
import arc.scene.ui.TextButton;
|
||||
import arc.util.Time;
|
||||
import mindustry.core.GameState.State;
|
||||
import mindustry.game.Saves.SaveSlot;
|
||||
import mindustry.gen.*;
|
||||
|
||||
@@ -23,7 +22,7 @@ public class SaveDialog extends LoadDialog{
|
||||
|
||||
public void addSetup(){
|
||||
slots.row();
|
||||
slots.addImageTextButton("$save.new", Icon.add, () ->
|
||||
slots.button("$save.new", Icon.add, () ->
|
||||
ui.showTextInput("$save", "$save.newslot", 30, "", text -> {
|
||||
ui.loadAnd("$saving", () -> {
|
||||
control.saves.addSave(text);
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
|
||||
shouldPause = true;
|
||||
addCloseButton();
|
||||
buttons.addImageTextButton("$schematic.import", Icon.download, this::showImport);
|
||||
buttons.button("$schematic.import", Icon.download, this::showImport);
|
||||
shown(this::setup);
|
||||
onResize(this::setup);
|
||||
}
|
||||
@@ -45,8 +45,8 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
|
||||
cont.table(s -> {
|
||||
s.left();
|
||||
s.addImage(Icon.zoom);
|
||||
s.addField(search, res -> {
|
||||
s.image(Icon.zoom);
|
||||
s.field(search, res -> {
|
||||
search = res;
|
||||
rebuildPane[0].run();
|
||||
}).growX();
|
||||
@@ -69,7 +69,7 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
if(!search.isEmpty() && !s.name().toLowerCase().contains(search.toLowerCase())) continue;
|
||||
|
||||
Button[] sel = {null};
|
||||
sel[0] = t.addButton(b -> {
|
||||
sel[0] = t.button(b -> {
|
||||
b.top();
|
||||
b.margin(0f);
|
||||
b.table(buttons -> {
|
||||
@@ -78,15 +78,15 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
|
||||
ImageButtonStyle style = Styles.clearPartiali;
|
||||
|
||||
buttons.addImageButton(Icon.info, style, () -> {
|
||||
buttons.button(Icon.info, style, () -> {
|
||||
showInfo(s);
|
||||
});
|
||||
|
||||
buttons.addImageButton(Icon.download, style, () -> {
|
||||
buttons.button(Icon.download, style, () -> {
|
||||
showExport(s);
|
||||
});
|
||||
|
||||
buttons.addImageButton(Icon.pencil, style, () -> {
|
||||
buttons.button(Icon.pencil, style, () -> {
|
||||
ui.showTextInput("$schematic.rename", "$name", s.name(), res -> {
|
||||
Schematic replacement = schematics.all().find(other -> other.name().equals(res) && other != s);
|
||||
if(replacement != null){
|
||||
@@ -102,9 +102,9 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
});
|
||||
|
||||
if(s.hasSteamID()){
|
||||
buttons.addImageButton(Icon.link, style, () -> platform.viewListing(s));
|
||||
buttons.button(Icon.link, style, () -> platform.viewListing(s));
|
||||
}else{
|
||||
buttons.addImageButton(Icon.trash, style, () -> {
|
||||
buttons.button(Icon.trash, style, () -> {
|
||||
if(s.mod != null){
|
||||
ui.showInfo(Core.bundle.format("mod.item.remove", s.mod.meta.displayName()));
|
||||
}else{
|
||||
@@ -160,7 +160,7 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
TextButtonStyle style = Styles.cleart;
|
||||
t.defaults().size(280f, 60f).left();
|
||||
t.row();
|
||||
t.addImageTextButton("$schematic.copy.import", Icon.copy, style, () -> {
|
||||
t.button("$schematic.copy.import", Icon.copy, style, () -> {
|
||||
dialog.hide();
|
||||
try{
|
||||
Schematic s = Schematics.readBase64(Core.app.getClipboardText());
|
||||
@@ -174,7 +174,7 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
}
|
||||
}).marginLeft(12f).disabled(b -> Core.app.getClipboardText() == null || !Core.app.getClipboardText().startsWith(schematicBaseStart));
|
||||
t.row();
|
||||
t.addImageTextButton("$schematic.importfile", Icon.download, style, () -> platform.showFileChooser(true, schematicExtension, file -> {
|
||||
t.button("$schematic.importfile", Icon.download, style, () -> platform.showFileChooser(true, schematicExtension, file -> {
|
||||
dialog.hide();
|
||||
|
||||
try{
|
||||
@@ -189,7 +189,7 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
})).marginLeft(12f);
|
||||
t.row();
|
||||
if(steam){
|
||||
t.addImageTextButton("$schematic.browseworkshop", Icon.book, style, () -> {
|
||||
t.button("$schematic.browseworkshop", Icon.book, style, () -> {
|
||||
dialog.hide();
|
||||
platform.openWorkshop();
|
||||
}).marginLeft(12f);
|
||||
@@ -209,18 +209,18 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
TextButtonStyle style = Styles.cleart;
|
||||
t.defaults().size(280f, 60f).left();
|
||||
if(steam && !s.hasSteamID()){
|
||||
t.addImageTextButton("$schematic.shareworkshop", Icon.book, style,
|
||||
t.button("$schematic.shareworkshop", Icon.book, style,
|
||||
() -> platform.publish(s)).marginLeft(12f);
|
||||
t.row();
|
||||
dialog.hide();
|
||||
}
|
||||
t.addImageTextButton("$schematic.copy", Icon.copy, style, () -> {
|
||||
t.button("$schematic.copy", Icon.copy, style, () -> {
|
||||
dialog.hide();
|
||||
ui.showInfoFade("$copied");
|
||||
Core.app.setClipboardText(schematics.writeBase64(s));
|
||||
}).marginLeft(12f);
|
||||
t.row();
|
||||
t.addImageTextButton("$schematic.exportfile", Icon.export, style, () -> {
|
||||
t.button("$schematic.exportfile", Icon.export, style, () -> {
|
||||
dialog.hide();
|
||||
platform.export(s.name(), schematicExtension, file -> Schematics.write(s, file));
|
||||
}).marginLeft(12f);
|
||||
@@ -312,7 +312,7 @@ public class SchematicsDialog extends FloatingDialog{
|
||||
cont.table(r -> {
|
||||
int i = 0;
|
||||
for(ItemStack s : arr){
|
||||
r.addImage(s.item.icon(Cicon.small)).left();
|
||||
r.image(s.item.icon(Cicon.small)).left();
|
||||
r.label(() -> {
|
||||
Tilec core = player.closestCore();
|
||||
if(core == null || state.rules.infiniteResources || core.items().has(s.item, s.amount)) return "[lightgray]" + s.amount + "";
|
||||
|
||||
@@ -84,7 +84,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
t.defaults().size(270f, 60f).left();
|
||||
TextButtonStyle style = Styles.cleart;
|
||||
|
||||
t.addImageTextButton("$settings.cleardata", Icon.trash, style, () -> ui.showConfirm("$confirm", "$settings.clearall.confirm", () -> {
|
||||
t.button("$settings.cleardata", Icon.trash, style, () -> ui.showConfirm("$confirm", "$settings.clearall.confirm", () -> {
|
||||
ObjectMap<String, Object> map = new ObjectMap<>();
|
||||
for(String value : Core.settings.keys()){
|
||||
if(value.contains("usid") || value.contains("uuid")){
|
||||
@@ -104,7 +104,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
|
||||
t.row();
|
||||
|
||||
t.addImageTextButton("$data.export", Icon.download, style, () -> {
|
||||
t.button("$data.export", Icon.download, style, () -> {
|
||||
if(ios){
|
||||
Fi file = Core.files.local("mindustry-data-export.zip");
|
||||
try{
|
||||
@@ -128,7 +128,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
|
||||
t.row();
|
||||
|
||||
t.addImageTextButton("$data.import", Icon.download, style, () -> ui.showConfirm("$confirm", "$data.import.confirm", () -> platform.showFileChooser(true, "zip", file -> {
|
||||
t.button("$data.import", Icon.download, style, () -> ui.showConfirm("$confirm", "$data.import.confirm", () -> platform.showFileChooser(true, "zip", file -> {
|
||||
try{
|
||||
data.importData(file);
|
||||
Core.app.exit();
|
||||
@@ -146,7 +146,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
|
||||
if(!mobile){
|
||||
t.row();
|
||||
t.addImageTextButton("$data.openfolder", Icon.folder, style, () -> Core.app.openFolder(Core.settings.getDataDirectory().absolutePath()));
|
||||
t.button("$data.openfolder", Icon.folder, style, () -> Core.app.openFolder(Core.settings.getDataDirectory().absolutePath()));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -185,20 +185,20 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
TextButtonStyle style = Styles.cleart;
|
||||
|
||||
menu.defaults().size(300f, 60f);
|
||||
menu.addButton("$settings.game", style, () -> visible(0));
|
||||
menu.button("$settings.game", style, () -> visible(0));
|
||||
menu.row();
|
||||
menu.addButton("$settings.graphics", style, () -> visible(1));
|
||||
menu.button("$settings.graphics", style, () -> visible(1));
|
||||
menu.row();
|
||||
menu.addButton("$settings.sound", style, () -> visible(2));
|
||||
menu.button("$settings.sound", style, () -> visible(2));
|
||||
menu.row();
|
||||
menu.addButton("$settings.language", style, ui.language::show);
|
||||
menu.button("$settings.language", style, ui.language::show);
|
||||
if(!mobile || Core.settings.getBool("keyboard")){
|
||||
menu.row();
|
||||
menu.addButton("$settings.controls", style, ui.controls::show);
|
||||
menu.button("$settings.controls", style, ui.controls::show);
|
||||
}
|
||||
|
||||
menu.row();
|
||||
menu.addButton("$settings.data", style, () -> dataDialog.show());
|
||||
menu.button("$settings.data", style, () -> dataDialog.show());
|
||||
}
|
||||
|
||||
void addSettings(){
|
||||
@@ -256,7 +256,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
game.pref(new Setting(){
|
||||
@Override
|
||||
public void add(SettingsTable table){
|
||||
table.addButton("$tutorial.retake", () -> {
|
||||
table.button("$tutorial.retake", () -> {
|
||||
hide();
|
||||
control.playTutorial();
|
||||
}).size(220f, 60f).pad(6).left();
|
||||
@@ -378,7 +378,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
|
||||
@Override
|
||||
public void addCloseButton(){
|
||||
buttons.addImageTextButton("$back", Icon.leftOpen, () -> {
|
||||
buttons.button("$back", Icon.leftOpen, () -> {
|
||||
if(prefs.getChildren().first() != menu){
|
||||
back();
|
||||
}else{
|
||||
@@ -387,7 +387,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
}).size(230f, 64f);
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK){
|
||||
if(key == KeyCode.escape || key == KeyCode.back){
|
||||
if(prefs.getChildren().first() != menu){
|
||||
back();
|
||||
}else{
|
||||
|
||||
@@ -63,7 +63,7 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
|
||||
addCloseButton();
|
||||
|
||||
buttons.addImageTextButton("$database", Icon.book, () -> {
|
||||
buttons.button("$database", Icon.book, () -> {
|
||||
hide();
|
||||
ui.database.show();
|
||||
}).size(210f, 64f);
|
||||
@@ -343,7 +343,7 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
infoTable.table(b -> {
|
||||
b.margin(0).left().defaults().left();
|
||||
|
||||
b.addImageButton(Icon.info, Styles.cleari, () -> ui.content.show(node.block)).growY().width(50f);
|
||||
b.button(Icon.info, Styles.cleari, () -> ui.content.show(node.block)).growY().width(50f);
|
||||
b.add().grow();
|
||||
b.table(desc -> {
|
||||
desc.left().defaults().left();
|
||||
@@ -355,7 +355,7 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
for(ItemStack req : node.requirements){
|
||||
t.table(list -> {
|
||||
list.left();
|
||||
list.addImage(req.item.icon(Cicon.small)).size(8 * 3).padRight(3);
|
||||
list.image(req.item.icon(Cicon.small)).size(8 * 3).padRight(3);
|
||||
list.add(req.item.localizedName).color(Color.lightGray);
|
||||
list.label(() -> " " + Math.min(data.getItem(req.item), req.amount) + " / " + req.amount)
|
||||
.update(l -> l.setColor(data.has(req.item, req.amount) ? Color.lightGray : Color.scarlet));
|
||||
@@ -370,7 +370,7 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
|
||||
if(mobile && locked(node)){
|
||||
b.row();
|
||||
b.addImageTextButton("$research", Icon.ok, Styles.nodet, () -> unlock(node))
|
||||
b.button("$research", Icon.ok, Styles.nodet, () -> unlock(node))
|
||||
.disabled(i -> !data.hasItems(node.requirements)).growX().height(44f).colspan(3);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
if(i++ % 2 == 0){
|
||||
iteminfo.row();
|
||||
}
|
||||
iteminfo.addImage(stack.item.icon(Cicon.small)).size(8 * 3).padRight(1);
|
||||
iteminfo.image(stack.item.icon(Cicon.small)).size(8 * 3).padRight(1);
|
||||
iteminfo.add(stack.amount + "").color(Color.lightGray).padRight(5);
|
||||
}
|
||||
};
|
||||
@@ -55,7 +55,7 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
|
||||
cont.pane(cont -> {
|
||||
if(zone.locked()){
|
||||
cont.addImage(Icon.lock);
|
||||
cont.image(Icon.lock);
|
||||
cont.row();
|
||||
cont.add("$locked").padBottom(6);
|
||||
cont.row();
|
||||
@@ -70,9 +70,9 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
r.add("$complete").colspan(2).left();
|
||||
r.row();
|
||||
for(Objective o : zones){
|
||||
r.addImage(Icon.terrain).padRight(4);
|
||||
r.image(Icon.terrain).padRight(4);
|
||||
r.add(o.display()).color(Color.lightGray);
|
||||
r.addImage(o.complete() ? Icon.ok : Icon.cancel, o.complete() ? Color.lightGray : Color.scarlet).padLeft(3);
|
||||
r.image(o.complete() ? Icon.ok : Icon.cancel, o.complete() ? Color.lightGray : Color.scarlet).padLeft(3);
|
||||
r.row();
|
||||
}
|
||||
});
|
||||
@@ -86,9 +86,9 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
r.add("$research.list").colspan(2).left();
|
||||
r.row();
|
||||
for(Unlock blocko : blocks){
|
||||
r.addImage(blocko.block.icon(Cicon.small)).size(8 * 3).padRight(5);
|
||||
r.image(blocko.block.icon(Cicon.small)).size(8 * 3).padRight(5);
|
||||
r.add(blocko.block.localizedName).color(Color.lightGray).left();
|
||||
r.addImage(blocko.block.unlocked() ? Icon.ok : Icon.cancel, blocko.block.unlocked() ? Color.lightGray : Color.scarlet).padLeft(3);
|
||||
r.image(blocko.block.unlocked() ? Icon.ok : Icon.cancel, blocko.block.unlocked() ? Color.lightGray : Color.scarlet).padLeft(3);
|
||||
r.row();
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
}else{
|
||||
cont.add(zone.localizedName).color(Pal.accent).growX().center();
|
||||
cont.row();
|
||||
cont.addImage().color(Pal.accent).height(3).pad(6).growX();
|
||||
cont.image().color(Pal.accent).height(3).pad(6).growX();
|
||||
cont.row();
|
||||
cont.table(desc -> {
|
||||
desc.left().defaults().left().width(Core.graphics.isPortrait() ? 350f : 500f);
|
||||
@@ -115,7 +115,7 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
t.left();
|
||||
int i = 0;
|
||||
for(Item item : zone.resources){
|
||||
r.addImage(item.icon(Cicon.small)).size(8 * 3);
|
||||
r.image(item.icon(Cicon.small)).size(8 * 3);
|
||||
if(++i % 4 == 0){
|
||||
r.row();
|
||||
}
|
||||
@@ -143,13 +143,13 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
});
|
||||
cont.row();
|
||||
|
||||
cont.addButton(zone.canConfigure() ? "$configure" : Core.bundle.format("configure.locked", zone.configureObjective.display()),
|
||||
cont.button(zone.canConfigure() ? "$configure" : Core.bundle.format("configure.locked", zone.configureObjective.display()),
|
||||
() -> loadout.show(zone.loadout.findCore().itemCapacity, zone.getStartingItems(), zone::resetStartingItems, zone::updateLaunchCost, rebuildItems)
|
||||
).fillX().pad(3).disabled(b -> !zone.canConfigure());
|
||||
|
||||
cont.row();
|
||||
|
||||
Button button = cont.addButton(zone.locked() ? "$uncover" : "$launch", () -> {
|
||||
Button button = cont.button(zone.locked() ? "$uncover" : "$launch", () -> {
|
||||
if(!data.isUnlocked(zone)){
|
||||
Sounds.unlock.play();
|
||||
data.unlockContent(zone);
|
||||
|
||||
@@ -57,12 +57,12 @@ public class HudFragment extends Fragment{
|
||||
|
||||
ImageButtonStyle style = Styles.clearTransi;
|
||||
|
||||
select.addImageButton(Icon.menu, style, ui.paused::show);
|
||||
flip = select.addImageButton(Icon.upOpen, style, this::toggleMenus).get();
|
||||
select.button(Icon.menu, style, ui.paused::show);
|
||||
flip = select.button(Icon.upOpen, style, this::toggleMenus).get();
|
||||
|
||||
select.addImageButton(Icon.paste, style, ui.schematics::show);
|
||||
select.button(Icon.paste, style, ui.schematics::show);
|
||||
|
||||
select.addImageButton(Icon.pause, style, () -> {
|
||||
select.button(Icon.pause, style, () -> {
|
||||
if(net.active()){
|
||||
ui.listfrag.toggle();
|
||||
}else{
|
||||
@@ -77,7 +77,7 @@ public class HudFragment extends Fragment{
|
||||
}
|
||||
});
|
||||
|
||||
select.addImageButton(Icon.chat, style,() -> {
|
||||
select.button(Icon.chat, style,() -> {
|
||||
if(net.active() && mobile){
|
||||
if(ui.chatfrag.shown()){
|
||||
ui.chatfrag.hide();
|
||||
@@ -97,7 +97,7 @@ public class HudFragment extends Fragment{
|
||||
}
|
||||
});
|
||||
|
||||
select.addImage().color(Pal.gray).width(4f).fillY();
|
||||
select.image().color(Pal.gray).width(4f).fillY();
|
||||
|
||||
float size = Scl.scl(dsize);
|
||||
Array<Element> children = new Array<>(select.getChildren());
|
||||
@@ -122,7 +122,7 @@ public class HudFragment extends Fragment{
|
||||
}
|
||||
|
||||
cont.row();
|
||||
cont.addImage().height(4f).color(Pal.gray).fillX();
|
||||
cont.image().height(4f).color(Pal.gray).fillX();
|
||||
cont.row();
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public class HudFragment extends Fragment{
|
||||
teams.left();
|
||||
int i = 0;
|
||||
for(Team team : Team.base()){
|
||||
ImageButton button = teams.addImageButton(Tex.whiteui, Styles.clearTogglePartiali, 40f, () -> Call.setPlayerTeamEditor(player, team))
|
||||
ImageButton button = teams.button(Tex.whiteui, Styles.clearTogglePartiali, 40f, () -> Call.setPlayerTeamEditor(player, team))
|
||||
.size(50f).margin(6f).get();
|
||||
button.getImageCell().grow();
|
||||
button.getStyle().imageUpColor = team.color;
|
||||
@@ -261,7 +261,7 @@ public class HudFragment extends Fragment{
|
||||
setDisabled(() -> !control.tutorial.canNext());
|
||||
}},
|
||||
new Table(f -> {
|
||||
f.left().addImageButton(Icon.left, Styles.emptyi, () -> {
|
||||
f.left().button(Icon.left, Styles.emptyi, () -> {
|
||||
control.tutorial.prevSentence();
|
||||
}).width(44f).growY().visible(() -> control.tutorial.canPrev());
|
||||
}));
|
||||
@@ -340,7 +340,7 @@ public class HudFragment extends Fragment{
|
||||
}
|
||||
});
|
||||
table.margin(12);
|
||||
table.addImage(Icon.ok).pad(3);
|
||||
table.image(Icon.ok).pad(3);
|
||||
table.add(text).wrap().width(280f).get().setAlignment(Align.center, Align.center);
|
||||
table.pack();
|
||||
|
||||
@@ -441,7 +441,7 @@ public class HudFragment extends Fragment{
|
||||
|
||||
lastUnlockLayout.add(image);
|
||||
}else{ //else, add a specific icon to denote no more space
|
||||
lastUnlockLayout.addImage(Icon.add);
|
||||
lastUnlockLayout.image(Icon.add);
|
||||
}
|
||||
|
||||
lastUnlockLayout.pack();
|
||||
@@ -486,13 +486,13 @@ public class HudFragment extends Fragment{
|
||||
dialog.cont.add("$launch.confirm").width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
||||
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
||||
dialog.setFillParent(false);
|
||||
dialog.buttons.addButton("$cancel", dialog::hide);
|
||||
dialog.buttons.addButton("$ok", () -> {
|
||||
dialog.buttons.button("$cancel", dialog::hide);
|
||||
dialog.buttons.button("$ok", () -> {
|
||||
dialog.hide();
|
||||
Call.launchZone();
|
||||
});
|
||||
dialog.keyDown(KeyCode.ESCAPE, dialog::hide);
|
||||
dialog.keyDown(KeyCode.BACK, dialog::hide);
|
||||
dialog.keyDown(KeyCode.escape, dialog::hide);
|
||||
dialog.keyDown(KeyCode.back, dialog::hide);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@@ -597,7 +597,7 @@ public class HudFragment extends Fragment{
|
||||
}
|
||||
|
||||
private void addPlayButton(Table table){
|
||||
table.right().addImageButton(Icon.play, Styles.righti, 30f, () -> {
|
||||
table.right().button(Icon.play, Styles.righti, 30f, () -> {
|
||||
if(net.client() && player.admin()){
|
||||
Call.onAdminRequest(player, AdminAction.wave);
|
||||
}else if(inLaunchWave()){
|
||||
|
||||
@@ -22,16 +22,16 @@ public class LoadingFragment extends Fragment{
|
||||
t.visible(false);
|
||||
t.touchable(Touchable.enabled);
|
||||
t.add().height(133f).row();
|
||||
t.addImage().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
|
||||
t.image().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
|
||||
t.row();
|
||||
t.add("$loading").name("namelabel").pad(10f);
|
||||
t.row();
|
||||
t.addImage().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
|
||||
t.image().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
|
||||
t.row();
|
||||
|
||||
bar = t.add(new Bar()).pad(3).size(500f, 40f).visible(false).get();
|
||||
t.row();
|
||||
button = t.addButton("$cancel", () -> {}).pad(20).size(250f, 70f).visible(false).get();
|
||||
button = t.button("$cancel", () -> {}).pad(20).size(250f, 70f).visible(false).get();
|
||||
table = t;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,10 +57,10 @@ public class MenuFragment extends Fragment{
|
||||
|
||||
//info icon
|
||||
if(mobile){
|
||||
parent.fill(c -> c.bottom().left().addButton("", Styles.infot, ui.about::show).size(84, 45));
|
||||
parent.fill(c -> c.bottom().right().addButton("", Styles.discordt, ui.discord::show).size(84, 45));
|
||||
parent.fill(c -> c.bottom().left().button("", Styles.infot, ui.about::show).size(84, 45));
|
||||
parent.fill(c -> c.bottom().right().button("", Styles.discordt, ui.discord::show).size(84, 45));
|
||||
}else if(becontrol.active()){
|
||||
parent.fill(c -> c.bottom().right().addImageTextButton("$be.check", Icon.refresh, () -> {
|
||||
parent.fill(c -> c.bottom().right().button("$be.check", Icon.refresh, () -> {
|
||||
ui.loadfrag.show();
|
||||
becontrol.checkUpdate(result -> {
|
||||
ui.loadfrag.hide();
|
||||
@@ -219,7 +219,7 @@ public class MenuFragment extends Fragment{
|
||||
for(Buttoni b : buttons){
|
||||
if(b == null) continue;
|
||||
Button[] out = {null};
|
||||
out[0] = t.addImageTextButton(b.text, b.icon, Styles.clearToggleMenut, () -> {
|
||||
out[0] = t.button(b.text, b.icon, Styles.clearToggleMenut, () -> {
|
||||
if(currentMenu == out[0]){
|
||||
currentMenu = null;
|
||||
fadeOutMenu();
|
||||
|
||||
@@ -100,7 +100,7 @@ public class MinimapFragment extends Fragment{
|
||||
t.row();
|
||||
t.add().growY();
|
||||
t.row();
|
||||
t.addImageTextButton("$back", Icon.leftOpen, () -> shown = false).size(220f, 60f).pad(10f);
|
||||
t.button("$back", Icon.leftOpen, () -> shown = false).size(220f, 60f).pad(10f);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -205,9 +205,9 @@ public class PlacementFragment extends Fragment{
|
||||
blockTable.row();
|
||||
}
|
||||
|
||||
ImageButton button = blockTable.addImageButton(new TextureRegionDrawable(block.icon(Cicon.medium)), Styles.selecti, () -> {
|
||||
ImageButton button = blockTable.button(new TextureRegionDrawable(block.icon(Cicon.medium)), Styles.selecti, () -> {
|
||||
if(unlocked(block)){
|
||||
if(Core.input.keyDown(KeyCode.SHIFT_LEFT) && Fonts.getUnicode(block.name) != 0){
|
||||
if(Core.input.keyDown(KeyCode.shiftLeft) && Fonts.getUnicode(block.name) != 0){
|
||||
Core.app.setClipboardText((char)Fonts.getUnicode(block.name) + "");
|
||||
ui.showInfoFade("$copied");
|
||||
}else{
|
||||
@@ -290,7 +290,7 @@ public class PlacementFragment extends Fragment{
|
||||
.left().width(190f).padLeft(5);
|
||||
header.add().growX();
|
||||
if(unlocked(lastDisplay)){
|
||||
header.addButton("?", Styles.clearPartialt, () -> {
|
||||
header.button("?", Styles.clearPartialt, () -> {
|
||||
ui.content.show(lastDisplay);
|
||||
Events.fire(new BlockInfoEvent());
|
||||
}).size(8 * 5).padTop(-5).padRight(-5).right().grow().name("blockinfo");
|
||||
@@ -304,7 +304,7 @@ public class PlacementFragment extends Fragment{
|
||||
for(ItemStack stack : lastDisplay.requirements){
|
||||
req.table(line -> {
|
||||
line.left();
|
||||
line.addImage(stack.item.icon(Cicon.small)).size(8 * 2);
|
||||
line.image(stack.item.icon(Cicon.small)).size(8 * 2);
|
||||
line.add(stack.item.localizedName).maxWidth(140f).fillX().color(Color.lightGray).padLeft(2).left().get().setEllipsis(true);
|
||||
line.labelWrap(() -> {
|
||||
Tilec core = player.closestCore();
|
||||
@@ -324,7 +324,7 @@ public class PlacementFragment extends Fragment{
|
||||
if(state.rules.bannedBlocks.contains(lastDisplay) || !player.isBuilder()){
|
||||
topTable.row();
|
||||
topTable.table(b -> {
|
||||
b.addImage(Icon.cancel).padRight(2).color(Color.scarlet);
|
||||
b.image(Icon.cancel).padRight(2).color(Color.scarlet);
|
||||
b.add(!player.isBuilder() ? "$unit.nobuild" : "$banned");
|
||||
b.left();
|
||||
}).padTop(2).left();
|
||||
@@ -350,7 +350,7 @@ public class PlacementFragment extends Fragment{
|
||||
});
|
||||
}).colspan(3).fillX().visible(() -> getSelected() != null || tileDisplayBlock() != null).touchable(Touchable.enabled);
|
||||
frame.row();
|
||||
frame.addImage().color(Pal.gray).colspan(3).height(4).growX();
|
||||
frame.image().color(Pal.gray).colspan(3).height(4).growX();
|
||||
frame.row();
|
||||
frame.table(Tex.pane2, blocksSelect -> {
|
||||
blocksSelect.margin(4).marginTop(0);
|
||||
@@ -390,11 +390,11 @@ public class PlacementFragment extends Fragment{
|
||||
if(f++ % 2 == 0) categories.row();
|
||||
|
||||
if(categoryEmpty[cat.ordinal()]){
|
||||
categories.addImage(Styles.black6);
|
||||
categories.image(Styles.black6);
|
||||
continue;
|
||||
}
|
||||
|
||||
categories.addImageButton(ui.getIcon(cat.name()), Styles.clearToggleTransi, () -> {
|
||||
categories.button(ui.getIcon(cat.name()), Styles.clearToggleTransi, () -> {
|
||||
currentCategory = cat;
|
||||
if(control.input.block != null){
|
||||
control.input.block = getSelectedBlock(currentCategory);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PlayerListFragment extends Fragment{
|
||||
cont.table(Tex.buttonTrans, pane -> {
|
||||
pane.label(() -> Core.bundle.format(Groups.player.size() == 1 ? "players.single" : "players", Groups.player.size()));
|
||||
pane.row();
|
||||
sField = pane.addField(null, text -> {
|
||||
sField = pane.field(null, text -> {
|
||||
rebuild();
|
||||
}).grow().pad(8).get();
|
||||
sField.setMaxLength(maxNameLength);
|
||||
@@ -57,9 +57,9 @@ public class PlayerListFragment extends Fragment{
|
||||
pane.table(menu -> {
|
||||
menu.defaults().growX().height(50f).fillY();
|
||||
|
||||
menu.addButton("$server.bans", ui.bans::show).disabled(b -> net.client());
|
||||
menu.addButton("$server.admins", ui.admins::show).disabled(b -> net.client());
|
||||
menu.addButton("$close", this::toggle);
|
||||
menu.button("$server.bans", ui.bans::show).disabled(b -> net.client());
|
||||
menu.button("$server.admins", ui.admins::show).disabled(b -> net.client());
|
||||
menu.button("$close", this::toggle);
|
||||
}).margin(0f).pad(10f).growX();
|
||||
|
||||
}).touchable(Touchable.enabled).margin(14f);
|
||||
@@ -105,7 +105,7 @@ public class PlayerListFragment extends Fragment{
|
||||
button.labelWrap("[#" + user.color().toString().toUpperCase() + "]" + user.name()).width(170f).pad(10);
|
||||
button.add().grow();
|
||||
|
||||
button.addImage(Icon.admin).visible(() -> user.admin() && !(!user.isLocal() && net.server())).padRight(5).get().updateVisibility();
|
||||
button.image(Icon.admin).visible(() -> user.admin() && !(!user.isLocal() && net.server())).padRight(5).get().updateVisibility();
|
||||
|
||||
if((net.server() || player.admin()) && !user.isLocal() && (!user.admin() || net.server())){
|
||||
button.add().growY();
|
||||
@@ -115,14 +115,14 @@ public class PlayerListFragment extends Fragment{
|
||||
button.table(t -> {
|
||||
t.defaults().size(bs);
|
||||
|
||||
t.addImageButton(Icon.hammer, Styles.clearPartiali,
|
||||
t.button(Icon.hammer, Styles.clearPartiali,
|
||||
() -> ui.showConfirm("$confirm", Core.bundle.format("confirmban", user.name()), () -> Call.onAdminRequest(user, AdminAction.ban)));
|
||||
t.addImageButton(Icon.cancel, Styles.clearPartiali,
|
||||
t.button(Icon.cancel, Styles.clearPartiali,
|
||||
() -> ui.showConfirm("$confirm", Core.bundle.format("confirmkick", user.name()), () -> Call.onAdminRequest(user, AdminAction.kick)));
|
||||
|
||||
t.row();
|
||||
|
||||
t.addImageButton(Icon.admin, Styles.clearTogglePartiali, () -> {
|
||||
t.button(Icon.admin, Styles.clearTogglePartiali, () -> {
|
||||
if(net.client()) return;
|
||||
|
||||
String id = user.uuid();
|
||||
@@ -137,19 +137,19 @@ public class PlayerListFragment extends Fragment{
|
||||
.touchable(() -> net.client() ? Touchable.disabled : Touchable.enabled)
|
||||
.checked(user.admin());
|
||||
|
||||
t.addImageButton(Icon.zoom, Styles.clearPartiali, () -> Call.onAdminRequest(user, AdminAction.trace));
|
||||
t.button(Icon.zoom, Styles.clearPartiali, () -> Call.onAdminRequest(user, AdminAction.trace));
|
||||
|
||||
}).padRight(12).size(bs + 10f, bs);
|
||||
}else if(!user.isLocal() && !user.admin() && net.client() && Groups.player.size() >= 3 && player.team() == user.team()){ //votekick
|
||||
button.add().growY();
|
||||
|
||||
button.addImageButton(Icon.hammer, Styles.clearPartiali,
|
||||
button.button(Icon.hammer, Styles.clearPartiali,
|
||||
() -> ui.showConfirm("$confirm", Core.bundle.format("confirmvotekick", user.name()), () -> Call.sendChatMessage("/votekick " + user.name()))).size(h);
|
||||
}
|
||||
|
||||
content.add(button).padBottom(-6).width(350f).maxHeight(h + 14);
|
||||
content.row();
|
||||
content.addImage().height(4f).color(state.rules.pvp ? user.team().color : Pal.gray).growX();
|
||||
content.image().height(4f).color(state.rules.pvp ? user.team().color : Pal.gray).growX();
|
||||
content.row();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user