New UI
This commit is contained in:
@@ -22,7 +22,7 @@ public class MenuButton extends TextButton{
|
||||
|
||||
table(t -> {
|
||||
t.addImage(icon).size(14 * 3);
|
||||
t.update(() -> t.setBackground(getClickListener().isOver() || getClickListener().isVisualPressed() ? "button-over" : "button"));
|
||||
t.update(() -> t.setBackground(getClickListener().isVisualPressed() ? "button-down" : getClickListener().isOver() ? "button-over" : "button"));
|
||||
}).size(s - 5, s);
|
||||
|
||||
|
||||
|
||||
@@ -16,10 +16,9 @@ import static io.anuke.mindustry.Vars.*;
|
||||
public class Minimap extends Table{
|
||||
|
||||
public Minimap(){
|
||||
super("button");
|
||||
super("pane");
|
||||
|
||||
margin(5);
|
||||
marginBottom(10);
|
||||
|
||||
TextureRegion r = new TextureRegion();
|
||||
|
||||
|
||||
@@ -42,14 +42,14 @@ public class AboutDialog extends FloatingDialog{
|
||||
float w = UIUtils.portrait() ? 330f : 600f;
|
||||
|
||||
Table in = new Table();
|
||||
ScrollPane pane = new ScrollPane(in, "clear");
|
||||
ScrollPane pane = new ScrollPane(in);
|
||||
|
||||
for(LinkEntry link : Links.getLinks()){
|
||||
if((ios || OS.isMac) && bannedItems.contains(link.name)){ //because Apple doesn't like me mentioning things
|
||||
continue;
|
||||
}
|
||||
|
||||
Table table = new Table("button");
|
||||
Table table = new Table("underline-2");
|
||||
table.margin(0);
|
||||
table.table(img -> {
|
||||
img.addImage("white").height(h - 5).width(40f).color(link.color);
|
||||
@@ -58,7 +58,7 @@ public class AboutDialog extends FloatingDialog{
|
||||
}).expandY();
|
||||
|
||||
table.table(i -> {
|
||||
i.background("button");
|
||||
i.background("button-edge-3");
|
||||
i.addImage("icon-" + link.name).size(14 * 3f);
|
||||
}).size(h - 5, h);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class AdminsDialog extends FloatingDialog{
|
||||
|
||||
Table table = new Table();
|
||||
|
||||
ScrollPane pane = new ScrollPane(table, "clear");
|
||||
ScrollPane pane = new ScrollPane(table);
|
||||
pane.setFadeScrollBars(false);
|
||||
|
||||
if(netServer.admins.getAdmins().size == 0){
|
||||
|
||||
@@ -25,7 +25,7 @@ public class BansDialog extends FloatingDialog{
|
||||
|
||||
Table table = new Table();
|
||||
|
||||
ScrollPane pane = new ScrollPane(table, "clear");
|
||||
ScrollPane pane = new ScrollPane(table);
|
||||
pane.setFadeScrollBars(false);
|
||||
|
||||
if(netServer.admins.getBanned().size == 0){
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ChangelogDialog extends FloatingDialog{
|
||||
|
||||
void setup(){
|
||||
Table table = new Table();
|
||||
ScrollPane pane = new ScrollPane(table, "clear");
|
||||
ScrollPane pane = new ScrollPane(table);
|
||||
|
||||
content().clear();
|
||||
content().add(pane).grow();
|
||||
@@ -60,7 +60,7 @@ public class ChangelogDialog extends FloatingDialog{
|
||||
|
||||
desc = desc.replace("Android", "Mobile");
|
||||
|
||||
Table in = new Table("clear");
|
||||
Table in = new Table("underline");
|
||||
in.top().left().margin(10);
|
||||
|
||||
in.add("[accent]" + info.name + "[LIGHT_GRAY] | " + info.date);
|
||||
|
||||
@@ -25,10 +25,10 @@ public class ColorPickDialog extends Dialog{
|
||||
for(int i = 0; i < playerColors.length; i++){
|
||||
Color color = playerColors[i];
|
||||
|
||||
ImageButton button = table.addImageButton("white", "toggle", 34, () -> {
|
||||
ImageButton button = table.addImageButton("white", "clear-toggle", 34, () -> {
|
||||
cons.accept(color);
|
||||
hide();
|
||||
}).size(44, 48).pad(0).padBottom(-5.1f).get();
|
||||
}).size(48).get();
|
||||
button.setChecked(players[0].color.equals(color));
|
||||
button.getStyle().imageUpColor = color;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ContentInfoDialog extends FloatingDialog{
|
||||
|
||||
content.displayInfo(table);
|
||||
|
||||
ScrollPane pane = new ScrollPane(table, "clear-black");
|
||||
ScrollPane pane = new ScrollPane(table);
|
||||
content().add(pane);
|
||||
|
||||
show();
|
||||
|
||||
@@ -23,7 +23,7 @@ import static io.anuke.mindustry.Vars.*;
|
||||
public class CustomGameDialog extends FloatingDialog{
|
||||
|
||||
public CustomGameDialog(){
|
||||
super("$text.level.select");
|
||||
super("$text.customgame");
|
||||
addCloseButton();
|
||||
shown(this::setup);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class CustomGameDialog extends FloatingDialog{
|
||||
|
||||
Table maps = new Table();
|
||||
maps.marginRight(14);
|
||||
ScrollPane pane = new ScrollPane(maps, "clear-black");
|
||||
ScrollPane pane = new ScrollPane(maps);
|
||||
pane.setFadeScrollBars(false);
|
||||
|
||||
int maxwidth = (Gdx.graphics.getHeight() > Gdx.graphics.getHeight() ? 2 : 4);
|
||||
@@ -52,7 +52,7 @@ public class CustomGameDialog extends FloatingDialog{
|
||||
if(mode.hidden) continue;
|
||||
|
||||
modes.addButton("$mode." + mode.name() + ".name", "toggle", () -> state.mode = mode)
|
||||
.update(b -> b.setChecked(state.mode == mode)).group(group).size(140f, 54f).padBottom(-5);
|
||||
.update(b -> b.setChecked(state.mode == mode)).group(group).size(140f, 54f);
|
||||
if(i++ % 2 == 1) modes.row();
|
||||
}
|
||||
selmode.add(modes);
|
||||
@@ -139,7 +139,7 @@ public class CustomGameDialog extends FloatingDialog{
|
||||
d.setFillParent(false);
|
||||
Table table = new Table();
|
||||
table.defaults().pad(1f);
|
||||
ScrollPane pane = new ScrollPane(table, "clear");
|
||||
ScrollPane pane = new ScrollPane(table);
|
||||
pane.setFadeScrollBars(false);
|
||||
table.row();
|
||||
for(GameMode mode : GameMode.values()){
|
||||
|
||||
@@ -34,13 +34,13 @@ public class HostDialog extends FloatingDialog{
|
||||
ui.listfrag.rebuild();
|
||||
}).grow().pad(8).get().setMaxLength(40);
|
||||
|
||||
ImageButton button = t.addImageButton("white", 40, () -> {
|
||||
ImageButton button = t.addImageButton("white", "clear-full", 40, () -> {
|
||||
new ColorPickDialog().show(color -> {
|
||||
player.color.set(color);
|
||||
Settings.putInt("color-0", Color.rgba8888(color));
|
||||
Settings.save();
|
||||
});
|
||||
}).size(50f, 54f).get();
|
||||
}).size(54f).get();
|
||||
button.update(() -> button.getStyle().imageUpColor = player.color);
|
||||
}).width(w).height(70f).pad(4).colspan(3);
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
//why are java lambdas this bad
|
||||
TextButton[] buttons = {null};
|
||||
|
||||
TextButton button = buttons[0] = remote.addButton("[accent]" + server.displayIP(), "clear", () -> {
|
||||
TextButton button = buttons[0] = remote.addButton("[accent]" + server.displayIP(), () -> {
|
||||
if(!buttons[0].childrenPressed()){
|
||||
connect(server.ip, server.port);
|
||||
}
|
||||
@@ -194,7 +194,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
hosts.row();
|
||||
hosts.add(local).width(w);
|
||||
|
||||
ScrollPane pane = new ScrollPane(hosts, "clear");
|
||||
ScrollPane pane = new ScrollPane(hosts);
|
||||
pane.setFadeScrollBars(false);
|
||||
pane.setScrollingDisabled(true, false);
|
||||
|
||||
@@ -210,19 +210,19 @@ public class JoinDialog extends FloatingDialog{
|
||||
Settings.save();
|
||||
}).grow().pad(8).get().setMaxLength(maxNameLength);
|
||||
|
||||
ImageButton button = t.addImageButton("white", 40, () -> {
|
||||
ImageButton button = t.addImageButton("white", "clear-full", 40, () -> {
|
||||
new ColorPickDialog().show(color -> {
|
||||
player.color.set(color);
|
||||
Settings.putInt("color-0", Color.rgba8888(color));
|
||||
Settings.save();
|
||||
});
|
||||
}).size(50f, 54f).get();
|
||||
}).size(54f).get();
|
||||
button.update(() -> button.getStyle().imageUpColor = player.color);
|
||||
}).width(w).height(70f).pad(4);
|
||||
content().row();
|
||||
content().add(pane).width(w + 38).pad(0);
|
||||
content().row();
|
||||
content().addCenteredImageTextButton("$text.server.add", "icon-add", "clear", 14 * 3, () -> {
|
||||
content().addCenteredImageTextButton("$text.server.add", "icon-add", 14 * 3, () -> {
|
||||
renaming = null;
|
||||
add.show();
|
||||
}).marginLeft(6).width(w).height(80f).update(button -> {
|
||||
@@ -273,7 +273,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
|
||||
local.row();
|
||||
|
||||
TextButton button = local.addButton("[accent]" + host.name, "clear", () -> connect(host.address, port))
|
||||
TextButton button = local.addButton("[accent]" + host.name, () -> connect(host.address, port))
|
||||
.width(w).height(80f).pad(4f).get();
|
||||
button.left();
|
||||
button.row();
|
||||
|
||||
@@ -24,7 +24,7 @@ public class LanguageDialog extends FloatingDialog{
|
||||
private void setup(){
|
||||
Table langs = new Table();
|
||||
langs.marginRight(24f).marginLeft(24f);
|
||||
ScrollPane pane = new ScrollPane(langs, "clear");
|
||||
ScrollPane pane = new ScrollPane(langs);
|
||||
pane.setFadeScrollBars(false);
|
||||
|
||||
ButtonGroup<TextButton> group = new ButtonGroup<>();
|
||||
@@ -38,7 +38,7 @@ public class LanguageDialog extends FloatingDialog{
|
||||
Log.info("Setting locale: {0}", loc.toString());
|
||||
ui.showInfo("$text.language.restart");
|
||||
});
|
||||
langs.add(button).group(group).update(t -> t.setChecked(loc.equals(getLocale()))).size(400f, 50f).row();
|
||||
langs.add(button).group(group).update(t -> t.setChecked(loc.equals(getLocale()))).size(400f, 50f).pad(2).row();
|
||||
}
|
||||
|
||||
content().add(pane);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class LoadDialog extends FloatingDialog{
|
||||
content().clear();
|
||||
|
||||
slots = new Table();
|
||||
pane = new ScrollPane(slots, "clear-black");
|
||||
pane = new ScrollPane(slots);
|
||||
pane.setFadeScrollBars(false);
|
||||
pane.setScrollingDisabled(true, false);
|
||||
|
||||
@@ -146,7 +146,7 @@ public class LoadDialog extends FloatingDialog{
|
||||
if(!valids){
|
||||
|
||||
slots.row();
|
||||
slots.addButton("$text.save.none", "clear", () -> {
|
||||
slots.addButton("$text.save.none", () -> {
|
||||
}).disabled(true).fillX().margin(20f).minWidth(340f).height(80f).pad(4f);
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public class LoadDialog extends FloatingDialog{
|
||||
|
||||
if(ios) return;
|
||||
|
||||
slots.addImageTextButton("$text.save.import", "icon-add", "clear", 14 * 3, () -> {
|
||||
slots.addImageTextButton("$text.save.import", "icon-add", 14 * 3, () -> {
|
||||
Platform.instance.showFileChooser(Bundles.get("text.save.import"), "Mindustry Save", file -> {
|
||||
if(SaveIO.isSaveValid(file)){
|
||||
try{
|
||||
|
||||
@@ -4,8 +4,8 @@ import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.Scaling;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.mindustry.maps.Map;
|
||||
import io.anuke.mindustry.io.MapIO;
|
||||
import io.anuke.mindustry.maps.Map;
|
||||
import io.anuke.mindustry.maps.MapMeta;
|
||||
import io.anuke.mindustry.maps.MapTileData;
|
||||
import io.anuke.mindustry.ui.BorderImage;
|
||||
@@ -73,7 +73,7 @@ public class MapsDialog extends FloatingDialog{
|
||||
Table maps = new Table();
|
||||
maps.marginRight(24);
|
||||
|
||||
ScrollPane pane = new ScrollPane(maps, "clear-black");
|
||||
ScrollPane pane = new ScrollPane(maps);
|
||||
pane.setFadeScrollBars(false);
|
||||
|
||||
int maxwidth = 4;
|
||||
@@ -88,7 +88,7 @@ public class MapsDialog extends FloatingDialog{
|
||||
|
||||
TextButton button = maps.addButton("", "clear", () -> showMapInfo(map)).width(mapsize).pad(8).get();
|
||||
button.clearChildren();
|
||||
button.margin(6);
|
||||
button.margin(9);
|
||||
button.add(map.meta.tags.get("name", map.name)).growX().center().get().setEllipsis(true);
|
||||
button.row();
|
||||
button.addImage("white").growX().pad(4).color(Color.GRAY);
|
||||
@@ -121,7 +121,7 @@ public class MapsDialog extends FloatingDialog{
|
||||
Table t = new Table();
|
||||
t.margin(6);
|
||||
|
||||
ScrollPane pane = new ScrollPane(t, "clear-black");
|
||||
ScrollPane pane = new ScrollPane(t);
|
||||
desc.add(pane).grow();
|
||||
|
||||
t.top();
|
||||
@@ -146,7 +146,7 @@ public class MapsDialog extends FloatingDialog{
|
||||
|
||||
table.row();
|
||||
|
||||
table.addImageTextButton("$text.editor.openin", "icon-load-map", "clear", 16 * 2, () -> {
|
||||
table.addImageTextButton("$text.editor.openin", "icon-load-map", 16 * 2, () -> {
|
||||
try{
|
||||
Vars.ui.editor.beginEditMap(map.stream.get());
|
||||
dialog.hide();
|
||||
@@ -155,15 +155,15 @@ public class MapsDialog extends FloatingDialog{
|
||||
e.printStackTrace();
|
||||
ui.showError("$text.error.mapnotfound");
|
||||
}
|
||||
}).fillX().height(50f).marginLeft(6);
|
||||
}).fillX().height(54f).marginLeft(10);
|
||||
|
||||
table.addImageTextButton("$text.delete", "icon-trash-16", "clear", 16 * 2, () -> {
|
||||
table.addImageTextButton("$text.delete", "icon-trash-16", 16 * 2, () -> {
|
||||
ui.showConfirm("$text.confirm", Bundles.format("text.map.delete", map.name), () -> {
|
||||
world.maps.removeMap(map);
|
||||
dialog.hide();
|
||||
setup();
|
||||
});
|
||||
}).fillX().height(50f).marginLeft(6).disabled(!map.custom).touchable(map.custom ? Touchable.enabled : Touchable.disabled);
|
||||
}).fillX().height(54f).marginLeft(10).disabled(!map.custom).touchable(map.custom ? Touchable.enabled : Touchable.disabled);
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class SaveDialog extends LoadDialog{
|
||||
|
||||
public void addSetup(){
|
||||
slots.row();
|
||||
slots.addImageTextButton("$text.save.new", "icon-add", "clear", 14 * 3, () ->
|
||||
slots.addImageTextButton("$text.save.new", "icon-add",14 * 3, () ->
|
||||
ui.showTextInput("$text.save", "$text.save.newslot", "", text -> {
|
||||
ui.loadGraphics("$text.saving", () -> {
|
||||
control.saves.addSave(text);
|
||||
|
||||
@@ -95,7 +95,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
prefs.clearChildren();
|
||||
prefs.add(menu);
|
||||
|
||||
ScrollPane pane = new ScrollPane(prefs, "clear");
|
||||
ScrollPane pane = new ScrollPane(prefs);
|
||||
pane.addCaptureListener(new InputListener(){
|
||||
@Override
|
||||
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button){
|
||||
@@ -148,21 +148,21 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
dialog.setFillParent(false);
|
||||
dialog.content().defaults().size(230f, 60f).pad(3);
|
||||
dialog.addCloseButton();
|
||||
dialog.content().addButton("$text.settings.clearsectors", "clear", () -> {
|
||||
dialog.content().addButton("$text.settings.clearsectors", () -> {
|
||||
ui.showConfirm("$text.confirm", "$text.settings.clear.confirm", () -> {
|
||||
world.sectors.clear();
|
||||
dialog.hide();
|
||||
});
|
||||
});
|
||||
dialog.content().row();
|
||||
dialog.content().addButton("$text.settings.clearunlocks", "clear", () -> {
|
||||
dialog.content().addButton("$text.settings.clearunlocks", () -> {
|
||||
ui.showConfirm("$text.confirm", "$text.settings.clear.confirm", () -> {
|
||||
control.unlocks.reset();
|
||||
dialog.hide();
|
||||
});
|
||||
});
|
||||
dialog.content().row();
|
||||
dialog.content().addButton("$text.settings.clearall", "clear", () -> {
|
||||
dialog.content().addButton("$text.settings.clearall", () -> {
|
||||
ui.showConfirm("$text.confirm", "$text.settings.clearall.confirm", () -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
for(String value : Settings.prefs().get().keySet()){
|
||||
@@ -208,6 +208,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
}
|
||||
|
||||
graphics.checkPref("fps", false);
|
||||
graphics.checkPref("indicators", true);
|
||||
graphics.checkPref("lasers", true);
|
||||
graphics.checkPref("minimap", !mobile); //minimap is disabled by default on mobile devices
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class UnlocksDialog extends FloatingDialog{
|
||||
|
||||
Table table = new Table();
|
||||
table.margin(20);
|
||||
ScrollPane pane = new ScrollPane(table, "clear-black");
|
||||
ScrollPane pane = new ScrollPane(table);
|
||||
|
||||
Array<Content>[] allContent = content.getContentMap();
|
||||
|
||||
@@ -65,9 +65,8 @@ public class UnlocksDialog extends FloatingDialog{
|
||||
|
||||
if(control.unlocks.isUnlocked(unlock)){
|
||||
image.clicked(() -> Vars.ui.content.show(unlock));
|
||||
image.addListener(new Tooltip<>(new Table("clear"){{
|
||||
image.addListener(new Tooltip<>(new Table("button"){{
|
||||
add(unlock.localizedName());
|
||||
margin(4);
|
||||
}}));
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ public class PlacementFragment extends Fragment{
|
||||
};
|
||||
|
||||
//top table with hover info
|
||||
frame.table("clear", top -> {
|
||||
frame.table("button-edge-2", top -> {
|
||||
topTable = top;
|
||||
top.add(new Table()).growX().update(topTable -> {
|
||||
if((tileDisplayBlock() == null && lastDisplay == getSelected()) ||
|
||||
@@ -160,16 +160,15 @@ public class PlacementFragment extends Fragment{
|
||||
topTable.labelWrap(lastDisplay.getDisplayName(hoverTile)).left().width(190f).padLeft(5);
|
||||
}
|
||||
});
|
||||
top.row();
|
||||
top.addImage("blank").growX().color(Palette.accent).height(3f);
|
||||
}).colspan(3).fillX().visible(() -> getSelected() != null || tileDisplayBlock() != null).touchable(Touchable.enabled);
|
||||
frame.row();
|
||||
frame.table("clear", blocksSelect -> {
|
||||
frame.addImage("blank").color(Palette.accent).colspan(3).height(3*2).growX();
|
||||
frame.row();
|
||||
frame.table("pane-2", blocksSelect -> {
|
||||
blocksSelect.table(blocks -> blockTable = blocks).grow();
|
||||
blocksSelect.row();
|
||||
blocksSelect.table(input::buildUI).growX();
|
||||
}).fillY().bottom().touchable(Touchable.enabled);
|
||||
frame.addImage("blank").width(3f).fillY().color(Palette.accent);
|
||||
frame.table(categories -> {
|
||||
categories.defaults().size(50f);
|
||||
|
||||
|
||||
@@ -45,10 +45,10 @@ public class PlayerListFragment extends Fragment{
|
||||
}
|
||||
});
|
||||
|
||||
cont.table("pane", pane -> {
|
||||
cont.table("clear", pane -> {
|
||||
pane.label(() -> Bundles.format(playerGroup.size() == 1 ? "text.players.single" : "text.players", playerGroup.size()));
|
||||
pane.row();
|
||||
pane.pane("clear", content).grow().get().setScrollingDisabled(true, false);
|
||||
pane.pane(content).grow().get().setScrollingDisabled(true, false);
|
||||
pane.row();
|
||||
|
||||
pane.table("pane", menu -> {
|
||||
|
||||
Reference in New Issue
Block a user