use of io.anuke.ucore.scene.ui.TextButton 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);
}
Aggregations