use of io.anuke.ucore.scene.ui.ScrollPane in project Mindustry by Anuken.
the class LanguageDialog method setup.
private void setup() {
Table langs = new Table();
langs.marginRight(24f).marginLeft(24f);
ScrollPane pane = new ScrollPane(langs, "clear");
pane.setFadeScrollBars(false);
ButtonGroup<TextButton> group = new ButtonGroup<>();
for (Locale loc : locales) {
TextButton button = new TextButton(Platform.instance.getLocaleName(loc), "toggle");
button.setChecked(ui.getLocale().equals(loc));
button.clicked(() -> {
if (ui.getLocale().equals(loc))
return;
Settings.putString("locale", loc.toString());
Settings.save();
Log.info("Setting locale: {0}", loc.toString());
ui.showInfo("$text.language.restart");
});
langs.add(button).group(group).update(t -> {
t.setChecked(loc.equals(ui.getLocale()));
}).size(400f, 60f).row();
}
content().add(pane);
}
use of io.anuke.ucore.scene.ui.ScrollPane in project Mindustry by Anuken.
the class DebugFragment method build.
@Override
public void build() {
new table() {
{
visible(() -> debug);
atop().aright();
new table("pane") {
{
defaults().fillX();
new label("Debug");
row();
new button("noclip", "toggle", () -> noclip = !noclip);
row();
new button("hideplayer", "toggle", () -> showPlayer = !showPlayer);
row();
new button("blocks", "toggle", () -> showBlockDebug = !showBlockDebug);
row();
new button("paths", "toggle", () -> showPaths = !showPaths);
row();
new button("wave", () -> state.wavetime = 0f);
row();
new button("time 0", () -> Timers.resetTime(0f));
row();
new button("time max", () -> Timers.resetTime(1080000 - 60 * 10));
row();
new button("clear", () -> {
enemyGroup.clear();
state.enemies = 0;
netClient.clearRecieved();
});
row();
new button("spawn", () -> {
new Enemy(EnemyTypes.healer).set(player.x, player.y).add();
});
row();
}
}.end();
row();
}
}.end();
new table() {
{
visible(() -> console);
atop().aleft();
new table("pane") {
{
defaults().fillX();
ScrollPane pane = new ScrollPane(new Label(DebugFragment::debugInfo), "clear");
add(pane);
row();
new button("dump", () -> {
try {
FileHandle file = Gdx.files.local("packet-dump.txt");
file.writeString("--INFO--\n", false);
file.writeString(debugInfo(), true);
file.writeString("--LOG--\n\n", true);
file.writeString(log.toString(), true);
} catch (Exception e) {
ui.showError("Error dumping log.");
}
});
}
}.end();
}
}.end();
new table() {
{
visible(() -> console);
atop();
Table table = new Table("pane");
table.label(() -> log.toString());
ScrollPane pane = new ScrollPane(table, "clear");
get().add(pane);
}
}.end();
}
use of io.anuke.ucore.scene.ui.ScrollPane in project Mindustry by Anuken.
the class MapLoadDialog method rebuild.
public void rebuild() {
content().clear();
selected = world.maps().getMap(0);
ButtonGroup<TextButton> group = new ButtonGroup<>();
int maxcol = 3;
int i = 0;
Table table = new Table();
table.defaults().size(200f, 90f).pad(4f);
table.margin(10f);
ScrollPane pane = new ScrollPane(table, "horizontal");
pane.setFadeScrollBars(false);
for (Map map : world.maps().list()) {
if (!map.visible)
continue;
TextButton button = new TextButton(map.localized(), "toggle");
button.add(new BorderImage(map.texture, 2f)).size(16 * 4f);
button.getCells().reverse();
button.clicked(() -> selected = map);
button.getLabelCell().grow().left().padLeft(5f);
group.add(button);
table.add(button);
if (++i % maxcol == 0)
table.row();
}
content().add("$text.editor.loadmap");
content().row();
content().add(pane);
}
use of io.anuke.ucore.scene.ui.ScrollPane in project Mindustry by Anuken.
the class AdminsDialog method setup.
private void setup() {
content().clear();
if (gwt)
return;
float w = 400f, h = 80f;
Table table = new Table();
ScrollPane pane = new ScrollPane(table, "clear");
pane.setFadeScrollBars(false);
if (netServer.admins.getAdmins().size == 0) {
table.add("$text.server.admins.none");
}
for (PlayerInfo info : netServer.admins.getAdmins()) {
Table res = new Table("button");
res.margin(14f);
res.labelWrap("[LIGHT_GRAY]" + info.lastName).width(w - h - 24f);
res.add().growX();
res.addImageButton("icon-cancel", 14 * 3, () -> {
ui.showConfirm("$text.confirm", "$text.confirmunadmin", () -> {
netServer.admins.unAdminPlayer(info.id);
for (Player player : playerGroup.all()) {
NetConnection c = Net.getConnection(player.clientid);
if (c != null) {
NetEvents.handleAdminSet(player, false);
break;
}
}
setup();
});
}).size(h).pad(-14f);
table.add(res).width(w).height(h);
table.row();
}
content().add(pane);
}
Aggregations