it is gone

This commit is contained in:
Anuken
2019-09-08 22:32:47 -04:00
parent c9f0a59339
commit d981bb95b9
68 changed files with 2580 additions and 1368 deletions

View File

@@ -49,7 +49,9 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
UI.loadDefaultFont();
assets.load(new AssetDescriptor<>("sprites/sprites.atlas", TextureAtlas.class)).loaded = t -> atlas = (TextureAtlas)t;
assets.load(new AssetDescriptor<>("sprites/sprites.atlas", TextureAtlas.class)).loaded = t -> {
atlas = (TextureAtlas)t;
};
assets.loadRun("maps", Map.class, () -> maps.loadPreviews());

View File

@@ -62,14 +62,6 @@ public class Vars implements Loadable{
public static final float itemSize = 5f;
/** extra padding around the world; units outside this bound will begin to self-destruct. */
public static final float worldBounds = 100f;
/** default size of UI icons.*/
public static final int iconsize = 48;
/** size of UI icons (small)*/
public static final int iconsizesmall = 32;
/** size of UI icons (medium)*/
public static final int iconsizemed = 30;
/** size of UI icons (medium)*/
public static final int iconsizetiny = 16;
/** units outside of this bound will simply die instantly */
public static final float finalWorldBounds = worldBounds + 500;
/** ticks spent out of bound until self destruct. */

View File

@@ -14,13 +14,11 @@ import io.anuke.arc.freetype.FreetypeFontLoader.*;
import io.anuke.arc.function.*;
import io.anuke.arc.graphics.*;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.graphics.g2d.TextureAtlas.*;
import io.anuke.arc.input.*;
import io.anuke.arc.math.*;
import io.anuke.arc.scene.*;
import io.anuke.arc.scene.actions.*;
import io.anuke.arc.scene.event.*;
import io.anuke.arc.scene.style.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.TextField.*;
import io.anuke.arc.scene.ui.Tooltip.*;
@@ -31,6 +29,7 @@ import io.anuke.mindustry.editor.*;
import io.anuke.mindustry.game.EventType.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.ui.*;
import io.anuke.mindustry.ui.dialogs.*;
import io.anuke.mindustry.ui.fragments.*;
@@ -38,8 +37,6 @@ import static io.anuke.arc.scene.actions.Actions.*;
import static io.anuke.mindustry.Vars.*;
public class UI implements ApplicationListener, Loadable{
private Skin skin;
public MenuFragment menufrag;
public HudFragment hudfrag;
public ChatFragment chatfrag;
@@ -73,7 +70,6 @@ public class UI implements ApplicationListener, Loadable{
public Cursor drillCursor, unloadCursor;
public UI(){
skin = new Skin();
setupFonts();
}
@@ -84,22 +80,17 @@ public class UI implements ApplicationListener, Loadable{
@Override
public void loadSync(){
//TODO type-safe skin files
skin.addRegions(Core.atlas);
loadExtraStyle(skin);
skin.add("outline", Core.assets.get("outline"));
skin.getFont("outline").getData().markupEnabled = true;
skin.getFont("default").getData().markupEnabled = true;
skin.getFont("default").setOwnsTexture(false);
skin.load(Core.files.internal("sprites/uiskin.json"));
Fonts.outline.getData().markupEnabled = true;
Fonts.def.getData().markupEnabled = true;
Fonts.def.setOwnsTexture(false);
for(BitmapFont font : skin.getAll(BitmapFont.class).values()){
font.setUseIntegerPositions(true);
}
Core.scene = new Scene(skin);
Core.assets.getAll(BitmapFont.class, new Array<>()).each(font -> font.setUseIntegerPositions(true));
Core.scene = new Scene();
Core.input.addProcessor(Core.scene);
Tex.load();
Icon.load();
Dialog.setShowAction(() -> sequence(alpha(0f), fadeIn(0.1f)));
Dialog.setHideAction(() -> sequence(fadeOut(0.1f)));
@@ -153,26 +144,7 @@ public class UI implements ApplicationListener, Loadable{
incremental = true;
}};
Core.assets.load("outline", BitmapFont.class, new FreeTypeFontLoaderParameter("fonts/font.ttf", param));
}
void loadExtraStyle(Skin skin){
AtlasRegion region = Core.atlas.find("flat-down-base");
int[] splits = region.splits;
ScaledNinePatchDrawable copy = new ScaledNinePatchDrawable(new NinePatch(region, splits[0], splits[1], splits[2], splits[3])){
public float getLeftWidth(){ return 0; }
public float getRightWidth(){ return 0; }
public float getTopHeight(){ return 0; }
public float getBottomHeight(){ return 0; }
};
copy.setMinWidth(0);
copy.setMinHeight(0);
copy.setTopHeight(0);
copy.setRightWidth(0);
copy.setBottomHeight(0);
copy.setLeftWidth(0);
skin.add("flat-down", copy, Drawable.class);
Core.assets.load("outline", BitmapFont.class, new FreeTypeFontLoaderParameter("fonts/font.ttf", param)).loaded = t -> Fonts.outline = (BitmapFont)t;
}
void loadExtraCursors(){
@@ -185,8 +157,8 @@ public class UI implements ApplicationListener, Loadable{
FreeTypeFontParameter param = fontParameter();
Core.assets.load("default", BitmapFont.class, new FreeTypeFontLoaderParameter(fontName, param)).loaded = f -> skin.add("default", f);
Core.assets.load("chat", BitmapFont.class, new FreeTypeFontLoaderParameter(fontName, param)).loaded = f -> skin.add("chat", f);
Core.assets.load("default", BitmapFont.class, new FreeTypeFontLoaderParameter(fontName, param)).loaded = f -> Fonts.def = (BitmapFont)f;
Core.assets.load("chat", BitmapFont.class, new FreeTypeFontLoaderParameter(fontName, param)).loaded = f -> Fonts.chat = (BitmapFont)f;
}
static FreeTypeFontParameter fontParameter(){
@@ -291,7 +263,7 @@ public class UI implements ApplicationListener, Loadable{
}
public void showTextInput(String titleText, String text, int textLength, String def, TextFieldFilter filter, Consumer<String> confirmed){
new Dialog(titleText, "dialog"){{
new Dialog(titleText){{
cont.margin(30).add(text).padRight(6f);
TextField field = cont.addField(def, t -> {
}).size(170f, 50f).get();
@@ -323,7 +295,7 @@ public class UI implements ApplicationListener, Loadable{
}
public void showInfo(String info){
new Dialog("", "dialog"){{
new Dialog(""){{
getCell(cont).growX();
cont.margin(15).add(info).width(400f).wrap().get().setAlignment(Align.center, Align.center);
buttons.addButton("$ok", this::hide).size(90, 50).pad(4);
@@ -331,12 +303,12 @@ public class UI implements ApplicationListener, Loadable{
}
public void showErrorMessage(String text){
new Dialog("", "dialog"){{
new Dialog(""){{
setFillParent(false);
cont.margin(15f);
cont.add("$error.title");
cont.row();
cont.addImage("whiteui").fillX().pad(2).height(4f).color(Color.SCARLET);
cont.addImage().fillX().pad(2).height(4f).color(Color.SCARLET);
cont.row();
cont.add(text).pad(2f);
buttons.addButton("$ok", this::hide).size(120, 50).pad(4);
@@ -348,21 +320,21 @@ public class UI implements ApplicationListener, Loadable{
}
public void showException(String text, Throwable exc){
new Dialog("", "dialog"){{
new Dialog(""){{
String message = Strings.getFinalMesage(exc);
setFillParent(true);
cont.margin(15);
cont.add("$error.title").colspan(2);
cont.row();
cont.addImage("whiteui").fillX().pad(2).colspan(2).height(4f).color(Color.SCARLET);
cont.addImage().fillX().pad(2).colspan(2).height(4f).color(Color.SCARLET);
cont.row();
cont.add((text.startsWith("$") ? Core.bundle.get(text.substring(1)) : text) + (message == null ? "" : "\n[lightgray](" + message + ")")).colspan(2).center().get().setAlignment(Align.center);
cont.row();
Collapser col = new Collapser(base -> base.pane(t -> t.margin(14f).add(Strings.parseException(exc, true)).color(Color.LIGHT_GRAY).left()), true);
cont.addButton("$details", "toggle", col::toggle).size(180f, 50f).checked(b -> !col.isCollapsed()).fillX().right();
cont.addButton("$details", Style.toggleTbutton, col::toggle).size(180f, 50f).checked(b -> !col.isCollapsed()).fillX().right();
cont.addButton("$ok", this::hide).size(100, 50).fillX().left();
cont.row();
cont.add(col).colspan(2).pad(2);
@@ -370,24 +342,24 @@ public class UI implements ApplicationListener, Loadable{
}
public void showText(String titleText, String text){
new Dialog(titleText, "dialog"){{
new Dialog(titleText){{
cont.margin(15).add(text).width(400f).wrap().get().setAlignment(Align.center, Align.center);
buttons.addButton("$ok", this::hide).size(90, 50).pad(4);
}}.show();
}
public void showInfoText(String titleText, String text){
new Dialog(titleText, "dialog"){{
new Dialog(titleText){{
cont.margin(15).add(text).width(400f).wrap().left().get().setAlignment(Align.left, Align.left);
buttons.addButton("$ok", this::hide).size(90, 50).pad(4);
}}.show();
}
public void showSmall(String titleText, String text){
new Dialog(titleText, "dialog"){{
new Dialog(titleText){{
cont.margin(10).add(text);
titleTable.row();
titleTable.addImage("whiteui").color(Pal.accent).height(3f).growX().pad(2f);
titleTable.addImage().color(Pal.accent).height(3f).growX().pad(2f);
buttons.addButton("$ok", this::hide).size(90, 50).pad(4);
}}.show();
}

View File

@@ -13,19 +13,19 @@ import io.anuke.arc.scene.actions.*;
import io.anuke.arc.scene.event.*;
import io.anuke.arc.scene.style.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.TextButton.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.*;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.core.GameState.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.io.*;
import io.anuke.mindustry.maps.*;
import io.anuke.mindustry.ui.Style;
import io.anuke.mindustry.ui.dialogs.*;
import io.anuke.mindustry.world.*;
import io.anuke.mindustry.world.Block.*;
import io.anuke.mindustry.world.blocks.*;
import io.anuke.mindustry.world.blocks.storage.*;
@@ -47,9 +47,9 @@ public class MapEditorDialog extends Dialog implements Disposable{
private Array<Block> blocksOut = new Array<>();
public MapEditorDialog(){
super("", "dialog");
super("");
background("dark");
background(Style.dark);
editor = new MapEditor();
view = new MapView(editor);
@@ -59,27 +59,26 @@ public class MapEditorDialog extends Dialog implements Disposable{
menu = new FloatingDialog("$menu");
menu.addCloseButton();
float isize = iconsize;
float swidth = 180f;
menu.cont.table(t -> {
t.defaults().size(swidth, 60f).padBottom(5).padRight(5).padLeft(5);
t.addImageTextButton("$editor.savemap", "icon-floppy-16", isize, this::save);
t.addImageTextButton("$editor.savemap", Icon.floppy16Small, this::save);
t.addImageTextButton("$editor.mapinfo", "icon-pencil", isize, () -> {
t.addImageTextButton("$editor.mapinfo", Icon.pencilSmall, () -> {
infoDialog.show();
menu.hide();
});
t.row();
t.addImageTextButton("$editor.generate", "icon-editor", isize, () -> {
t.addImageTextButton("$editor.generate", Icon.editorSmall, () -> {
generateDialog.show(generateDialog::applyToEditor);
menu.hide();
});
t.addImageTextButton("$editor.resize", "icon-resize", isize, () -> {
t.addImageTextButton("$editor.resize", Icon.resizeSmall, () -> {
resizeDialog.show();
menu.hide();
});
@@ -87,10 +86,10 @@ public class MapEditorDialog extends Dialog implements Disposable{
t.row();
if(!ios){
t.addImageTextButton("$editor.import", "icon-load-map", isize, () ->
t.addImageTextButton("$editor.import", Icon.loadMapSmall, () ->
createDialog("$editor.import",
"$editor.importmap", "$editor.importmap.description", "icon-load-map", (Runnable)loadDialog::show,
"$editor.importfile", "$editor.importfile.description", "icon-file", (Runnable)() ->
"$editor.importmap", "$editor.importmap.description", Icon.loadMap, (Runnable)loadDialog::show,
"$editor.importfile", "$editor.importfile.description", Icon.file, (Runnable)() ->
platform.showFileChooser(true, mapExtension, file -> ui.loadAnd(() -> {
maps.tryCatchMapError(() -> {
if(MapIO.isImage(file)){
@@ -101,7 +100,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
});
})),
"$editor.importimage", "$editor.importimage.description", "icon-file-image", (Runnable)() ->
"$editor.importimage", "$editor.importimage.description", Icon.fileImage, (Runnable)() ->
platform.showFileChooser(true, "png", file ->
ui.loadAnd(() -> {
try{
@@ -116,7 +115,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
);
}
Cell cell = t.addImageTextButton("$editor.export", "icon-save-map", isize, () -> {
Cell cell = t.addImageTextButton("$editor.export", Icon.saveMapSmall, () -> {
if(!ios){
platform.showFileChooser(false, mapExtension, file -> {
ui.loadAnd(() -> {
@@ -152,11 +151,11 @@ public class MapEditorDialog extends Dialog implements Disposable{
menu.cont.row();
menu.cont.addImageTextButton("$editor.ingame", "icon-arrow", isize, this::playtest).padTop(-5).size(swidth * 2f + 10, 60f);
menu.cont.addImageTextButton("$editor.ingame", Icon.arrowSmall, this::playtest).padTop(-5).size(swidth * 2f + 10, 60f);
menu.cont.row();
menu.cont.addImageTextButton("$quit", "icon-back", isize, () -> {
menu.cont.addImageTextButton("$quit", Icon.backSmall, () -> {
tryExit();
menu.hide();
}).size(swidth * 2f + 10, 60f);
@@ -312,7 +311,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
for(int i = 0; i < arguments.length; i += 4){
String name = (String)arguments[i];
String description = (String)arguments[i + 1];
String iconname = (String)arguments[i + 2];
Drawable iconname = (Drawable)arguments[i + 2];
Runnable listenable = (Runnable)arguments[i + 3];
TextButton button = dialog.cont.addButton(name, () -> {
@@ -322,7 +321,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
}).left().margin(0).get();
button.clearChildren();
button.addImage(iconname).size(iconsize).padLeft(10);
button.addImage(iconname).padLeft(10);
button.table(t -> {
t.add(name).growX().wrap();
t.row();
@@ -399,14 +398,13 @@ public class MapEditorDialog extends Dialog implements Disposable{
Consumer<EditorTool> addTool = tool -> {
ImageButton button = new ImageButton("icon-" + tool.name() + "-small", "clear-toggle");
ImageButton button = new ImageButton(Core.atlas.drawable("icon-" + tool.name() + "-small"), Style.clearToggleIbutton);
button.clicked(() -> {
view.setTool(tool);
if(lastTable[0] != null){
lastTable[0].remove();
}
});
button.resizeImage(iconsizesmall);
button.update(() -> button.setChecked(view.getTool() == tool));
group.add(button);
@@ -426,7 +424,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
lastTable[0].remove();
}
Table table = new Table("dialogDim");
Table table = new Table(Style.dialogDim);
table.defaults().size(300f, 70f);
for(int i = 0; i < tool.altModes.length; i++){
@@ -436,7 +434,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
table.addButton(b -> {
b.left();
b.marginLeft(6);
b.setStyle(Core.scene.skin.get("clear-toggle", TextButtonStyle.class));
b.setStyle(Style.clearToggleTbutton);
b.add(Core.bundle.get("toolmode." + name)).left();
b.row();
b.add(Core.bundle.get("toolmode." + name + ".description")).color(Color.LIGHT_GRAY).left();
@@ -476,16 +474,16 @@ public class MapEditorDialog extends Dialog implements Disposable{
tools.defaults().size(size, size);
tools.addImageButton("icon-menu-large-small", "clear", iconsizesmall, menu::show);
tools.addImageButton(Icon.menuLargeSmall, Style.clearIbutton, menu::show);
ImageButton grid = tools.addImageButton("icon-grid-small", "clear-toggle", iconsizesmall, () -> view.setGrid(!view.isGrid())).get();
ImageButton grid = tools.addImageButton(Icon.gridSmall, Style.clearToggleIbutton, () -> view.setGrid(!view.isGrid())).get();
addTool.accept(EditorTool.zoom);
tools.row();
ImageButton undo = tools.addImageButton("icon-undo-small", "clear", iconsizesmall, editor::undo).get();
ImageButton redo = tools.addImageButton("icon-redo-small", "clear", iconsizesmall, editor::redo).get();
ImageButton undo = tools.addImageButton(Icon.undoSmall, Style.clearIbutton, editor::undo).get();
ImageButton redo = tools.addImageButton(Icon.redoSmall, Style.clearIbutton, editor::redo).get();
addTool.accept(EditorTool.pick);
@@ -507,7 +505,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
addTool.accept(EditorTool.fill);
addTool.accept(EditorTool.spray);
ImageButton rotate = tools.addImageButton("icon-arrow-16-small", "clear", iconsizesmall, () -> editor.rotation = (editor.rotation + 1) % 4).get();
ImageButton rotate = tools.addImageButton(Icon.arrow16Small, Style.clearIbutton, () -> editor.rotation = (editor.rotation + 1) % 4).get();
rotate.getImage().update(() -> {
rotate.getImage().setRotation(editor.rotation * 90);
rotate.getImage().setOrigin(Align.center);
@@ -515,7 +513,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
tools.row();
tools.table("underline", t -> t.add("$editor.teams"))
tools.table(Tex.underline, t -> t.add("$editor.teams"))
.colspan(3).height(40).width(size * 3f + 3f).padBottom(3);
tools.row();
@@ -525,7 +523,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
int i = 0;
for(Team team : Team.all){
ImageButton button = new ImageButton("whiteui", "clear-toggle-partial");
ImageButton button = new ImageButton(Tex.whiteui, Style.clearTogglePartialIbutton);
button.margin(4f);
button.getImageCell().grow();
button.getStyle().imageUpColor = team.color;
@@ -541,7 +539,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
mid.row();
mid.table("underline", t -> {
mid.table(Tex.underline, t -> {
Slider slider = new Slider(0, MapEditor.brushSizes.length - 1, 1, false);
slider.moved(f -> editor.brushSize = MapEditor.brushSizes[(int)(float)f]);
for(int j = 0; j < MapEditor.brushSizes.length; j++){
@@ -673,11 +671,11 @@ public class MapEditorDialog extends Dialog implements Disposable{
});
for(Block block : blocksOut){
TextureRegion region = block.icon(Icon.medium);
TextureRegion region = block.icon(Block.Icon.medium);
if(!Core.atlas.isFound(region)) continue;
ImageButton button = new ImageButton("whiteui", "clear-toggle");
ImageButton button = new ImageButton(Tex.whiteui, Style.clearToggleIbutton);
button.getStyle().imageUp = new TextureRegionDrawable(region);
button.clicked(() -> editor.drawBlock = block);
button.resizeImage(8 * 4f);
@@ -692,7 +690,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
group.getButtons().get(2).setChecked(true);
table.table("underline", extra -> extra.labelWrap(() -> editor.drawBlock.localizedName).width(200f).center()).growX();
table.table(Tex.underline, extra -> extra.labelWrap(() -> editor.drawBlock.localizedName).width(200f).center()).growX();
table.row();
table.add(pane).growY().fillX();
}

View File

@@ -8,10 +8,12 @@ import io.anuke.arc.graphics.Pixmap.*;
import io.anuke.arc.math.*;
import io.anuke.arc.math.geom.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.ImageButton.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.arc.util.async.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.io.*;
import io.anuke.mindustry.maps.filters.*;
@@ -84,7 +86,7 @@ public class MapGenerateDialog extends FloatingDialog{
update();
}).size(160f, 64f);
buttons.addImageTextButton("$add", "icon-add", iconsize, this::showAdd).height(64f).width(140f);
buttons.addImageTextButton("$add", Icon.add, this::showAdd).height(64f).width(140f);
if(!applied){
hidden(this::apply);
@@ -176,10 +178,8 @@ public class MapGenerateDialog extends FloatingDialog{
}
}
}, new Stack(){{
add(new Image("loadDim"));
add(new Image("icon-refresh"){{
setScaling(Scaling.none);
}});
add(new Image(Style.loadDim));
add(new Image(Icon.refresh, Scaling.none));
visible(() -> generating && !updateEditorOnChange);
}}).grow().padRight(10);
t.pane(p -> filterTable = p.marginRight(6)).update(pane -> {
@@ -224,7 +224,7 @@ public class MapGenerateDialog extends FloatingDialog{
for(GenerateFilter filter : filters){
//main container
filterTable.table("button", c -> {
filterTable.table(Tex.button, c -> {
//icons to perform actions
c.table(t -> {
t.top();
@@ -233,26 +233,26 @@ public class MapGenerateDialog extends FloatingDialog{
t.row();
t.table(b -> {
String style = "clear";
ImageButtonStyle style = Style.clearIbutton;
b.defaults().size(50f);
b.addImageButton("icon-refresh-small", style, iconsizesmall, () -> {
b.addImageButton(Icon.refreshSmall, style, () -> {
filter.randomize();
update();
});
b.addImageButton("icon-arrow-up-small", style, iconsizesmall, () -> {
b.addImageButton(Icon.arrowUpSmall, style, () -> {
int idx = filters.indexOf(filter);
filters.swap(idx, Math.max(0, idx - 1));
rebuildFilters();
update();
});
b.addImageButton("icon-arrow-down-small",style, iconsizesmall, () -> {
b.addImageButton(Icon.arrowDownSmall, style, () -> {
int idx = filters.indexOf(filter);
filters.swap(idx, Math.min(filters.size - 1, idx + 1));
rebuildFilters();
update();
});
b.addImageButton("icon-trash-small", style, iconsizesmall, () -> {
b.addImageButton(Icon.trashSmall, style, () -> {
filters.remove(filter);
rebuildFilters();
update();

View File

@@ -6,6 +6,7 @@ import io.anuke.arc.scene.ui.*;
import io.anuke.mindustry.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.io.*;
import io.anuke.mindustry.ui.*;
import io.anuke.mindustry.ui.dialogs.*;
public class MapInfoDialog extends FloatingDialog{
@@ -42,7 +43,7 @@ public class MapInfoDialog extends FloatingDialog{
t.row();
t.add("$editor.description").padRight(8).left();
TextArea description = t.addArea(tags.get("description", ""), "textarea", text -> {
TextArea description = t.addArea(tags.get("description", ""), Style.textareaField, text -> {
tags.put("description", text);
}).size(400f, 140f).get();

View File

@@ -48,12 +48,12 @@ public class MapLoadDialog extends FloatingDialog{
table.defaults().size(200f, 90f).pad(4f);
table.margin(10f);
ScrollPane pane = new ScrollPane(table, "horizontal");
ScrollPane pane = new ScrollPane(table, Style.horizontalPane);
pane.setFadeScrollBars(false);
for(Map map : maps.all()){
TextButton button = new TextButton(map.name(), "toggle");
TextButton button = new TextButton(map.name(), Style.toggleTbutton);
button.add(new BorderImage(map.texture, 2f).setScaling(Scaling.fit)).size(16 * 4f);
button.getCells().reverse();
button.clicked(() -> selected = map);

View File

@@ -1,9 +1,10 @@
package io.anuke.mindustry.editor;
import io.anuke.arc.function.IntPositionConsumer;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import io.anuke.arc.function.*;
import io.anuke.arc.math.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.ui.dialogs.*;
public class MapResizeDialog extends FloatingDialog{
private static final int minSize = 50, maxSize = 500, increment = 50;
@@ -28,7 +29,7 @@ public class MapResizeDialog extends FloatingDialog{
height = move(height, -1);
}).size(60f);
table.table("button", t -> t.label(() -> (w ? width : height) + "")).width(200);
table.table(Tex.button, t -> t.label(() -> (w ? width : height) + "")).width(200);
table.addButton(">", () -> {
if(w)

View File

@@ -1,22 +1,23 @@
package io.anuke.mindustry.editor;
import io.anuke.arc.Core;
import io.anuke.arc.collection.Array;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.input.KeyCode;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.scene.event.Touchable;
import io.anuke.arc.scene.ui.Label;
import io.anuke.arc.scene.ui.TextField.TextFieldFilter;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.*;
import io.anuke.arc.collection.*;
import io.anuke.arc.graphics.*;
import io.anuke.arc.input.*;
import io.anuke.arc.math.*;
import io.anuke.arc.scene.event.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.TextField.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.*;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.io.JsonIO;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.io.*;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import io.anuke.mindustry.ui.dialogs.*;
import static io.anuke.mindustry.Vars.*;
import static io.anuke.mindustry.game.SpawnGroup.never;
@@ -79,7 +80,7 @@ public class WaveInfoDialog extends FloatingDialog{
groups = JsonIO.copy(state.rules.spawns.isEmpty() ? defaultWaves.get() : state.rules.spawns);
cont.clear();
cont.stack(new Table("clear", main -> {
cont.stack(new Table(Tex.clear, main -> {
main.pane(t -> table = t).growX().growY().padRight(8f).get().setScrollingDisabled(true, false);
main.row();
main.addButton("$add", () -> {
@@ -94,7 +95,7 @@ public class WaveInfoDialog extends FloatingDialog{
setAlignment(Align.center, Align.center);
}}).width(390f).growY();
cont.table("clear", m -> {
cont.table(Tex.clear, m -> {
m.add("$waves.preview").color(Color.LIGHT_GRAY).growX().center().get().setAlignment(Align.center, Align.center);
m.row();
m.addButton("-", () -> {
@@ -134,7 +135,7 @@ public class WaveInfoDialog extends FloatingDialog{
if(groups != null){
for(SpawnGroup group : groups){
table.table("button", t -> {
table.table(Tex.button, t -> {
t.margin(0).defaults().pad(3).padLeft(5f).growX().left();
t.addButton(b -> {
b.left();
@@ -238,7 +239,7 @@ public class WaveInfoDialog extends FloatingDialog{
for(int i = start; i < displayed + start; i++){
int wave = i;
preview.table("underline", table -> {
preview.table(Tex.underline, table -> {
table.add((wave + 1) + "").color(Pal.accent).center().colspan(2).get().setAlignment(Align.center, Align.center);
table.row();

View File

@@ -24,6 +24,7 @@ import io.anuke.mindustry.io.*;
import io.anuke.mindustry.net.Administration.*;
import io.anuke.mindustry.net.*;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.ui.*;
import io.anuke.mindustry.world.*;
import io.anuke.mindustry.world.blocks.*;
@@ -372,7 +373,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
}
public void drawName(){
BitmapFont font = Core.scene.skin.getFont("default");
BitmapFont font = Fonts.def;
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
final float nameHeight = 11;
final float textHeight = 15;
@@ -391,9 +392,9 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
if(isAdmin){
float s = 3f;
Draw.color(color.r * 0.5f, color.g * 0.5f, color.b * 0.5f, 1f);
Draw.rect(Core.atlas.find("icon-admin-small"), x + layout.width / 2f + 2 + 1, y + nameHeight - 1.5f, s, s);
Draw.rect(Core.atlas.find("icon-admin-badge"), x + layout.width / 2f + 2 + 1, y + nameHeight - 1.5f, s, s);
Draw.color(color);
Draw.rect(Core.atlas.find("icon-admin-small"), x + layout.width / 2f + 2 + 1, y + nameHeight - 1f, s, s);
Draw.rect(Core.atlas.find("icon-admin-badge"), x + layout.width / 2f + 2 + 1, y + nameHeight - 1f, s, s);
}
if(Core.settings.getBool("playerchat") && ((textFadeTime > 0 && lastText != null) || isTyping)){

View File

@@ -19,9 +19,9 @@ import io.anuke.mindustry.game.*;
import io.anuke.mindustry.game.Teams.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.net.*;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.ui.*;
import io.anuke.mindustry.world.*;
import io.anuke.mindustry.world.blocks.*;
@@ -400,7 +400,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
(3f + Mathf.absin(Time.time(), 5f, 1f)) * itemtime);
if(number){
Core.scene.skin.getFont("outline").draw(item.amount + "",
Fonts.outline.draw(item.amount + "",
x + Angles.trnsx(rotation + 180f, backTrns),
y + Angles.trnsy(rotation + 180f, backTrns) - 3,
Pal.accent, 0.25f * itemtime / UnitScl.dp.scl(1f), false, Align.center

View File

@@ -17,8 +17,10 @@ import io.anuke.mindustry.entities.traits.BuilderTrait.*;
import io.anuke.mindustry.entities.traits.*;
import io.anuke.mindustry.entities.type.*;
import io.anuke.mindustry.game.EventType.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.input.PlaceUtils.*;
import io.anuke.mindustry.ui.*;
import io.anuke.mindustry.world.*;
import static io.anuke.mindustry.Vars.*;
@@ -249,27 +251,27 @@ public class MobileInput extends InputHandler implements GestureListener{
@Override
public void buildUI(Table table){
table.addImage("whiteui").color(Pal.gray).height(4f).colspan(4).growX();
table.addImage().color(Pal.gray).height(4f).colspan(4).growX();
table.row();
table.left().margin(0f).defaults().size(48f);
table.addImageButton("icon-break-small", "clear-toggle-partial", iconsizesmall, () -> {
table.addImageButton(Icon.breakSmall, Style.clearTogglePartialIbutton, () -> {
mode = mode == breaking ? block == null ? none : placing : breaking;
lastBlock = block;
}).update(l -> l.setChecked(mode == breaking)).name("breakmode");
//diagonal swap button
table.addImageButton("icon-diagonal-small", "clear-toggle-partial", iconsizesmall, () -> {
table.addImageButton(Icon.diagonalSmall, Style.clearTogglePartialIbutton, () -> {
Core.settings.put("swapdiagonal", !Core.settings.getBool("swapdiagonal"));
Core.settings.save();
}).update(l -> l.setChecked(Core.settings.getBool("swapdiagonal")));
//rotate button
table.addImageButton("icon-arrow-small", "clear-partial", iconsizesmall, () -> rotation = Mathf.mod(rotation + 1, 4))
table.addImageButton(Icon.arrowSmall, Style.clearPartialIbutton,() -> rotation = Mathf.mod(rotation + 1, 4))
.update(i -> i.getImage().setRotationOrigin(rotation * 90, Align.center)).visible(() -> block != null && block.rotate);
//confirm button
table.addImageButton("icon-check-small", "clear-partial", iconsizesmall, () -> {
table.addImageButton(Icon.checkSmall, Style.clearPartialIbutton, () -> {
for(PlaceRequest request : selection){
Tile tile = request.tile();
@@ -295,7 +297,7 @@ public class MobileInput extends InputHandler implements GestureListener{
Core.scene.table(t -> {
t.bottom().left().visible(() -> (player.isBuilding() || block != null || mode == breaking) && !state.is(State.menu));
t.addImageTextButton("$cancel", "icon-cancel", 16*2, () -> {
t.addImageTextButton("$cancel", Icon.cancelSmall, () -> {
player.clearBuilding();
mode = none;
block = null;

View File

@@ -1,15 +1,15 @@
package io.anuke.mindustry.ui;
import io.anuke.arc.Core;
import io.anuke.arc.function.FloatProvider;
import io.anuke.arc.function.Supplier;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.*;
import io.anuke.arc.function.*;
import io.anuke.arc.graphics.*;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Rectangle;
import io.anuke.arc.scene.Element;
import io.anuke.arc.scene.style.Drawable;
import io.anuke.arc.util.pooling.Pools;
import io.anuke.arc.math.*;
import io.anuke.arc.math.geom.*;
import io.anuke.arc.scene.*;
import io.anuke.arc.scene.style.*;
import io.anuke.arc.util.pooling.*;
import io.anuke.mindustry.gen.*;
public class Bar extends Element{
private static Rectangle scissor = new Rectangle();
@@ -53,11 +53,13 @@ public class Bar extends Element{
blink = Mathf.lerpDelta(blink, 0f, 0.2f);
value = Mathf.lerpDelta(value, computed, 0.15f);
Drawable bar = Tex.bar;
Draw.colorl(0.1f);
Draw.drawable("bar", x, y, width, height);
bar.draw(x, y, width, height);
Draw.color(color, blinkColor, blink);
Drawable top = Core.scene.skin.getDrawable("bar-top");
Drawable top = Tex.barTop;
float topWidth = width * value;
if(topWidth > Core.atlas.find("bar-top").getWidth()){
@@ -71,7 +73,7 @@ public class Bar extends Element{
Draw.color();
BitmapFont font = Core.scene.skin.getFont("default");
BitmapFont font = Fonts.def;
GlyphLayout lay = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
lay.setText(font, name);

View File

@@ -25,7 +25,7 @@ public class ContentDisplay{
table.row();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(8).padLeft(0).padRight(0).fillX();
table.addImage().height(3).color(Color.LIGHT_GRAY).pad(8).padLeft(0).padRight(0).fillX();
table.row();
@@ -33,7 +33,7 @@ public class ContentDisplay{
table.add(block.description).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(8).padLeft(0).padRight(0).fillX();
table.addImage().height(3).color(Color.LIGHT_GRAY).pad(8).padLeft(0).padRight(0).fillX();
table.row();
}
@@ -73,7 +73,7 @@ public class ContentDisplay{
table.row();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage().height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
@@ -81,7 +81,7 @@ public class ContentDisplay{
table.add(item.description).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage().height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
}
@@ -104,7 +104,7 @@ public class ContentDisplay{
table.row();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage().height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
@@ -112,7 +112,7 @@ public class ContentDisplay{
table.add(liquid.description).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage().height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
}
@@ -139,7 +139,7 @@ public class ContentDisplay{
table.row();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage().height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
@@ -147,7 +147,7 @@ public class ContentDisplay{
table.add(mech.description).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage().height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
}
@@ -186,7 +186,7 @@ public class ContentDisplay{
table.row();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage().height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
@@ -194,7 +194,7 @@ public class ContentDisplay{
table.add(unit.description).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage().height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
}

View File

@@ -0,0 +1,9 @@
package io.anuke.mindustry.ui;
import io.anuke.arc.graphics.g2d.*;
public class Fonts{
public static BitmapFont def;
public static BitmapFont outline;
public static BitmapFont chat;
}

View File

@@ -0,0 +1,14 @@
package io.anuke.mindustry.ui;
public enum IconSize{
def(48),
small(32),
smaller(30),
tiny(16);
public final int size;
IconSize(int size){
this.size = size;
}
}

View File

@@ -3,6 +3,7 @@ package io.anuke.mindustry.ui;
import io.anuke.arc.collection.ObjectIntMap;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.Item.Icon;
import io.anuke.mindustry.type.ItemType;
@@ -26,7 +27,7 @@ public class ItemsDisplay extends Table{
top().left();
margin(0);
table("button", t -> {
table(Tex.button,t -> {
t.margin(10).marginLeft(15).marginTop(15f);
t.add("$launcheditems").colspan(3).left().padBottom(5);
t.row();

View File

@@ -6,13 +6,14 @@ import io.anuke.arc.input.KeyCode;
import io.anuke.arc.scene.Element;
import io.anuke.arc.scene.event.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.mindustry.gen.*;
import static io.anuke.mindustry.Vars.*;
public class Minimap extends Table{
public Minimap(){
background("pane");
background(Tex.pane);
float margin = 5f;
touchable(Touchable.enabled);

View File

@@ -1,13 +1,13 @@
package io.anuke.mindustry.ui;
import io.anuke.arc.scene.style.*;
import io.anuke.arc.scene.ui.ImageButton;
import io.anuke.arc.util.Align;
public class MobileButton extends ImageButton{
public MobileButton(String icon, float isize, String text, Runnable listener){
public MobileButton(Drawable icon, String text, Runnable listener){
super(icon);
resizeImage(isize);
clicked(listener);
row();
add(text).growX().wrap().center().get().setAlignment(Align.center, Align.center);

View File

@@ -0,0 +1,365 @@
package io.anuke.mindustry.ui;
import io.anuke.annotations.Annotations.*;
import io.anuke.arc.*;
import io.anuke.arc.graphics.*;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.graphics.g2d.TextureAtlas.*;
import io.anuke.arc.scene.style.*;
import io.anuke.arc.scene.ui.Button.*;
import io.anuke.arc.scene.ui.CheckBox.*;
import io.anuke.arc.scene.ui.Dialog.*;
import io.anuke.arc.scene.ui.ImageButton.*;
import io.anuke.arc.scene.ui.KeybindDialog.*;
import io.anuke.arc.scene.ui.Label.*;
import io.anuke.arc.scene.ui.ScrollPane.*;
import io.anuke.arc.scene.ui.Slider.*;
import io.anuke.arc.scene.ui.TextButton.*;
import io.anuke.arc.scene.ui.TextField.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import static io.anuke.mindustry.gen.Tex.*;
@StyleDefaults
public class Style{
public static Drawable
dialogDim = whiteui.tint(0f, 0f, 0f, 0.9f),
loadDim = whiteui.tint(0f, 0f, 0f, 0.8f),
guideDim = whiteui.tint(0f, 0f, 0f, 0.3f),
chatfield = whiteui.tint(0f, 0f, 0f, 0.2f),
dark = whiteui.tint(0f, 0f, 0f, 1f),
none = whiteui.tint(0f, 0f, 0f, 0.1f),
flatTrans = whiteui.tint(0f, 0f, 0f, 0.6f),
flat = whiteui.tint(0f, 0f, 0f, 1f),
flatDown = createFlatDown(),
flatOver = whiteui.tint(Color.valueOf("454545"));
public static ButtonStyle
defaultButton = new ButtonStyle(){{
down = buttonDown;
up = button;
over = buttonOver;
disabled = buttonDisabled;
}},
squareButton = new ButtonStyle(){{
over = buttonSquareOver;
disabled = buttonDisabled;
down = buttonSquareDown;
up = buttonSquare;
}},
toggleButton = new ButtonStyle(){{
checked = buttonDown;
down = buttonDown;
up = button;
}},
waveButton = new ButtonStyle(){{
up = buttonEdge4;
over = buttonEdgeOver4;
disabled = buttonEdge4;
}};
public static TextButtonStyle
defaultTbutton = new TextButtonStyle(){{
over = buttonOver;
disabled = buttonDisabled;
font = Fonts.def;
fontColor = Color.WHITE;
disabledFontColor = Color.GRAY;
down = buttonDown;
up = button;
}},
squareTbutton = new TextButtonStyle(){{
font = Fonts.def;
fontColor = Color.WHITE;
disabledFontColor = Color.GRAY;
over = buttonSquareOver;
disabled = buttonDisabled;
down = buttonSquareDown;
up = buttonSquare;
}},
nodeTbutton = new TextButtonStyle(){{
disabled = button;
font = Fonts.def;
fontColor = Color.WHITE;
disabledFontColor = Color.GRAY;
up = buttonOver;
over = buttonDown;
}},
rightTbutton = new TextButtonStyle(){{
over = buttonRightOver;
font = Fonts.def;
fontColor = Color.WHITE;
disabledFontColor = Color.GRAY;
down = buttonRightDown;
up = buttonRight;
}},
waveTbutton = new TextButtonStyle(){{
font = Fonts.def;
fontColor = Color.WHITE;
disabledFontColor = Color.GRAY;
up = buttonEdge4;
}},
clearTbutton = new TextButtonStyle(){{
over = flatOver;
font = Fonts.def;
fontColor = Color.WHITE;
disabledFontColor = Color.GRAY;
down = flatOver;
up = flat;
}},
discordTbutton = new TextButtonStyle(){{
font = Fonts.def;
fontColor = Color.WHITE;
up = discordBanner;
}},
infoTbutton = new TextButtonStyle(){{
font = Fonts.def;
fontColor = Color.WHITE;
up = infoBanner;
}},
clearPartialTbutton = new TextButtonStyle(){{
down = whiteui;
up = pane;
over = flatDown;
font = Fonts.def;
fontColor = Color.WHITE;
disabledFontColor = Color.GRAY;
}},
clearPartial2Tbutton = new TextButtonStyle(){{
down = flatOver;
up = none;
over = flatOver;
font = Fonts.def;
fontColor = Color.WHITE;
disabledFontColor = Color.GRAY;
}},
emptyTbutton = new TextButtonStyle(){{
font = Fonts.def;
}},
clearToggleTbutton = new TextButtonStyle(){{
font = Fonts.def;
fontColor = Color.WHITE;
checked = flatDown;
down = flatDown;
up = flat;
over = flatOver;
disabled = flat;
disabledFontColor = Color.GRAY;
}},
clearToggleMenuTbutton = new TextButtonStyle(){{
font = Fonts.def;
fontColor = Color.WHITE;
checked = flatDown;
down = flatDown;
up = clear;
over = flatOver;
disabled = flat;
disabledFontColor = Color.GRAY;
}},
toggleTbutton = new TextButtonStyle(){{
font = Fonts.def;
fontColor = Color.WHITE;
checked = buttonDown;
down = buttonDown;
up = button;
over = buttonOver;
disabled = buttonDisabled;
disabledFontColor = Color.GRAY;
}};
public static ImageButtonStyle
defaultIbutton = new ImageButtonStyle(){{
down = buttonDown;
up = button;
over = buttonOver;
imageDisabledColor = Color.GRAY;
imageUpColor = Color.WHITE;
disabled = buttonDisabled;
}},
nodeIbutton = new ImageButtonStyle(){{
up = buttonOver;
over = buttonDown;
}},
rightIbutton = new ImageButtonStyle(){{
over = buttonRightOver;
down = buttonRightDown;
up = buttonRight;
}},
emptyIbutton = new ImageButtonStyle(){{
imageDownColor = Pal.accent;
imageUpColor = Color.WHITE;
}},
emptytoggleIbutton = new ImageButtonStyle(){{
imageCheckedColor = Color.WHITE;
imageDownColor = Color.WHITE;
imageUpColor = Color.GRAY;
}},
staticIbutton = new ImageButtonStyle(){{
up = button;
}},
staticDownIbutton = new ImageButtonStyle(){{
up = buttonDown;
}},
toggleIbutton = new ImageButtonStyle(){{
checked = buttonDown;
down = buttonDown;
up = button;
imageDisabledColor = Color.GRAY;
imageUpColor = Color.WHITE;
}},
selectIbutton = new ImageButtonStyle(){{
checked = buttonSelect;
up = none;
}},
clearIbutton = new ImageButtonStyle(){{
down = flatOver;
up = flat;
over = flatOver;
}},
clearFullIbutton = new ImageButtonStyle(){{
down = whiteui;
up = pane;
over = flatDown;
}},
clearPartialIbutton = new ImageButtonStyle(){{
down = flatDown;
up = none;
over = flatOver;
}},
clearToggleIbutton = new ImageButtonStyle(){{
down = flatDown;
checked = flatDown;
up = flat;
over = flatOver;
}},
clearTransIbutton = new ImageButtonStyle(){{
down = flatDown;
up = flatTrans;
over = flatOver;
}},
clearToggleTransIbutton = new ImageButtonStyle(){{
down = flatDown;
checked = flatDown;
up = flatTrans;
over = flatOver;
}},
clearTogglePartialIbutton = new ImageButtonStyle(){{
down = flatDown;
checked = flatDown;
up = none;
over = flatOver;
}};
public static ScrollPaneStyle
defaultPane = new ScrollPaneStyle(){{
vScroll = scroll;
vScrollKnob = scrollKnobVerticalBlack;
}},
horizontalPane = new ScrollPaneStyle(){{
vScroll = scroll;
vScrollKnob = scrollKnobVerticalBlack;
hScroll = scrollHorizontal;
hScrollKnob = scrollKnobHorizontalBlack;
}};
public static KeybindDialogStyle
defaultKeybindDialog = new KeybindDialogStyle(){{
keyColor = Pal.accent;
keyNameColor = Color.WHITE;
controllerColor = Color.LIGHT_GRAY;
}};
public static SliderStyle
defaultHorizontalSlider = new SliderStyle(){{
background = slider;
knob = sliderKnob;
knobOver = sliderKnobOver;
knobDown = sliderKnobDown;
}},
defaultVerticalSlider = new SliderStyle(){{
background = sliderVertical;
knob = sliderKnob;
knobOver = sliderKnobOver;
knobDown = sliderKnobDown;
}};
public static LabelStyle
defaultLabel = new LabelStyle(){{
font = Fonts.def;
fontColor = Color.WHITE;
}},
outlineLabel = new LabelStyle(){{
font = Fonts.outline;
fontColor = Color.WHITE;
}};
public static TextFieldStyle
defaultField = new TextFieldStyle(){{
font = Fonts.chat;
fontColor = Color.WHITE;
disabledFontColor = Color.GRAY;
disabledBackground = underlineDisabled;
selection = Tex.selection;
background = underline;
invalidBackground = underlineRed;
cursor = Tex.cursor;
messageFont = Fonts.def;
messageFontColor = Color.GRAY;
}},
textareaField = new TextFieldStyle(){{
font = Fonts.chat;
fontColor = Color.WHITE;
disabledFontColor = Color.GRAY;
selection = Tex.selection;
background = underline;
cursor = Tex.cursor;
messageFont = Fonts.def;
messageFontColor = Color.GRAY;
}};
public static CheckBoxStyle
defaultCheck = new CheckBoxStyle(){{
checkboxOn = checkOn;
checkboxOff = checkOff;
checkboxOnOver = checkOnOver;
checkboxOver = checkOver;
checkboxOnDisabled = checkOnDisabled;
checkboxOffDisabled = checkDisabled;
font = Fonts.def;
fontColor = Color.WHITE;
disabledFontColor = Color.GRAY;
}};
public static DialogStyle
defaultWindow = new DialogStyle(){{
stageBackground = dialogDim;
titleFont = Fonts.def;
background = windowEmpty;
titleFontColor = Pal.accent;
}},
fulldialogWindow = new DialogStyle(){{
stageBackground = dark;
titleFont = Fonts.def;
background = windowEmpty;
titleFontColor = Pal.accent;
}};
private static Drawable createFlatDown(){
AtlasRegion region = Core.atlas.find("flat-down-base");
int[] splits = region.splits;
ScaledNinePatchDrawable copy = new ScaledNinePatchDrawable(new NinePatch(region, splits[0], splits[1], splits[2], splits[3])){
public float getLeftWidth(){ return 0; }
public float getRightWidth(){ return 0; }
public float getTopHeight(){ return 0; }
public float getBottomHeight(){ return 0; }
};
copy.setMinWidth(0);
copy.setMinHeight(0);
copy.setTopHeight(0);
copy.setRightWidth(0);
copy.setBottomHeight(0);
copy.setLeftWidth(0);
return copy;
}
}

View File

@@ -1,14 +1,15 @@
package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.Core;
import io.anuke.arc.*;
import io.anuke.arc.collection.*;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.scene.ui.ScrollPane;
import io.anuke.arc.graphics.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.ui.Links;
import io.anuke.mindustry.ui.Links.LinkEntry;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.ui.*;
import io.anuke.mindustry.ui.Links.*;
import static io.anuke.mindustry.Vars.*;
@@ -47,17 +48,17 @@ public class AboutDialog extends FloatingDialog{
continue;
}
Table table = new Table("underline");
Table table = new Table(Tex.underline);
table.margin(0);
table.table(img -> {
img.addImage("whiteui").height(h - 5).width(40f).color(link.color);
img.addImage().height(h - 5).width(40f).color(link.color);
img.row();
img.addImage("whiteui").height(5).width(40f).color(link.color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
img.addImage().height(5).width(40f).color(link.color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
}).expandY();
table.table(i -> {
i.background("button-edge-3");
i.addImage("icon-" + link.name).size(iconsize);
i.background(Tex.buttonEdge3);
i.addImage(Core.atlas.drawable("icon-" + link.name));
}).size(h - 5, h);
table.table(inset -> {
@@ -66,7 +67,7 @@ public class AboutDialog extends FloatingDialog{
inset.labelWrap(link.description).width(w - 100f).color(Color.LIGHT_GRAY).growX();
}).padLeft(8);
table.addImageButton("icon-link", iconsize, () -> {
table.addImageButton(Icon.link, () -> {
if(!Core.net.openURI(link.link)){
ui.showErrorMessage("$linkfail");
Core.app.setClipboardText(link.link);
@@ -98,7 +99,7 @@ public class AboutDialog extends FloatingDialog{
dialog.cont.add("$credits.text");
dialog.cont.row();
if(!contributors.isEmpty()){
dialog.cont.addImage("whiteui").color(Pal.accent).fillX().height(3f).pad(3f);
dialog.cont.addImage().color(Pal.accent).fillX().height(3f).pad(3f);
dialog.cont.row();
dialog.cont.add("$contributors");
dialog.cont.row();

View File

@@ -1,8 +1,9 @@
package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.scene.ui.ScrollPane;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.mindustry.net.Administration.PlayerInfo;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.net.Administration.*;
import static io.anuke.mindustry.Vars.*;
@@ -32,12 +33,12 @@ public class AdminsDialog extends FloatingDialog{
}
for(PlayerInfo info : netServer.admins.getAdmins()){
Table res = new Table("button");
Table res = new Table(Tex.button);
res.margin(14f);
res.labelWrap("[LIGHT_GRAY]" + info.lastName).width(w - h - 24f);
res.add().growX();
res.addImageButton("icon-cancel", iconsize, () -> {
res.addImageButton(Icon.cancel, () -> {
ui.showConfirm("$confirm", "$confirmunadmin", () -> {
netServer.admins.unAdminPlayer(info.id);
playerGroup.all().each(player -> {

View File

@@ -1,8 +1,9 @@
package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.scene.ui.ScrollPane;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.mindustry.net.Administration.PlayerInfo;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.net.Administration.*;
import static io.anuke.mindustry.Vars.*;
@@ -33,12 +34,12 @@ public class BansDialog extends FloatingDialog{
}
for(PlayerInfo info : netServer.admins.getBanned()){
Table res = new Table("button");
Table res = new Table(Tex.button);
res.margin(14f);
res.labelWrap("IP: [LIGHT_GRAY]" + info.lastIP + "\n[]Name: [LIGHT_GRAY]" + info.lastName).width(w - h - 24f);
res.add().growX();
res.addImageButton("icon-cancel", iconsize, () -> {
res.addImageButton(Icon.cancel, () -> {
ui.showConfirm("$confirm", "$confirmunban", () -> {
netServer.admins.unbanPlayerID(info.id);
setup();

View File

@@ -1,20 +1,20 @@
package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.function.Consumer;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.input.KeyCode;
import io.anuke.arc.scene.ui.Dialog;
import io.anuke.arc.scene.ui.ImageButton;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.function.*;
import io.anuke.arc.graphics.*;
import io.anuke.arc.input.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.ui.*;
import static io.anuke.mindustry.Vars.player;
import static io.anuke.mindustry.Vars.playerColors;
import static io.anuke.mindustry.Vars.*;
public class ColorPickDialog extends Dialog{
private Consumer<Color> cons;
public ColorPickDialog(){
super("", "dialog");
super("");
build();
}
@@ -25,7 +25,7 @@ public class ColorPickDialog extends Dialog{
for(int i = 0; i < playerColors.length; i++){
Color color = playerColors[i];
ImageButton button = table.addImageButton("whiteui", "clear-toggle", 34, () -> {
ImageButton button = table.addImageButton(Tex.whiteui, Style.clearToggleIbutton, 34, () -> {
cons.accept(color);
hide();
}).size(48).get();

View File

@@ -1,21 +1,19 @@
package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.Core;
import io.anuke.arc.input.KeyCode;
import io.anuke.arc.input.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.util.Align;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.arc.util.*;
import io.anuke.mindustry.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
public class ControlsDialog extends KeybindDialog{
public ControlsDialog(){
setStyle(Core.scene.skin.get("dialog", WindowStyle.class));
setFillParent(true);
title.setAlignment(Align.center);
titleTable.row();
titleTable.add(new Image("whiteui"))
titleTable.add(new Image())
.growX().height(3f).pad(4f).get().setColor(Pal.accent);
if(Vars.mobile){
cont.row();
@@ -26,7 +24,7 @@ public class ControlsDialog extends KeybindDialog{
@Override
public void addCloseButton(){
buttons.addImageTextButton("$back", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
buttons.addImageTextButton("$back", Icon.arrowLeftSmall, this::hide).size(230f, 64f);
keyDown(key -> {
if(key == KeyCode.ESCAPE || key == KeyCode.BACK)

View File

@@ -8,6 +8,7 @@ import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.maps.*;
import io.anuke.mindustry.ui.*;
@@ -47,7 +48,7 @@ public class CustomGameDialog extends FloatingDialog{
maps.row();
}
ImageButton image = new ImageButton(new TextureRegion(map.texture), "clear");
ImageButton image = new ImageButton(new TextureRegion(map.texture), Style.clearIbutton);
image.margin(5);
image.top();
@@ -59,14 +60,14 @@ public class CustomGameDialog extends FloatingDialog{
t.left();
for(Gamemode mode : Gamemode.all){
if(mode.valid(map) && Core.atlas.has("icon-mode-" + mode.name())){
t.addImage("icon-mode-" + mode.name()).size(16f).pad(4f);
t.addImage(Core.atlas.drawable("icon-mode-" + mode.name())).size(16f).pad(4f);
}
}
}).left();
image.row();
image.add(map.name()).pad(1f).growX().wrap().left().get().setEllipsis(true);
image.row();
image.addImage("whiteui", Pal.gray).growX().pad(3).height(4f);
image.addImage(Tex.whiteui, Pal.gray).growX().pad(3).height(4f);
image.row();
image.add(img).size(images);

View File

@@ -12,6 +12,7 @@ import io.anuke.mindustry.Vars;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.game.UnlockableContent;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.type.ContentType;
@@ -43,7 +44,7 @@ public class DatabaseDialog extends FloatingDialog{
table.add("$content." + type.name() + ".name").growX().left().color(Pal.accent);
table.row();
table.addImage("whiteui").growX().pad(5).padLeft(0).padRight(0).height(3).color(Pal.accent);
table.addImage().growX().pad(5).padLeft(0).padRight(0).height(3).color(Pal.accent);
table.row();
table.table(list -> {
list.left();
@@ -55,8 +56,8 @@ public class DatabaseDialog extends FloatingDialog{
for(int i = 0; i < array.size; i++){
UnlockableContent unlock = (UnlockableContent)array.get(i);
Image image = unlocked(unlock) ? new Image(unlock.getContentIcon()) : new Image("icon-locked", Pal.gray);
list.add(image).size(unlocked(unlock) ? 8*4 : Vars.iconsize).pad(3);
Image image = unlocked(unlock) ? new Image(unlock.getContentIcon()) : new Image(Icon.lockedSmall, Pal.gray);
list.add(image).size(8*4).pad(3);
ClickListener listener = new ClickListener();
image.addListener(listener);
if(!Vars.mobile && unlocked(unlock)){
@@ -66,7 +67,7 @@ public class DatabaseDialog extends FloatingDialog{
if(unlocked(unlock)){
image.clicked(() -> Vars.ui.content.show(unlock));
image.addListener(new Tooltip(t -> t.background("button").add(unlock.localizedName())));
image.addListener(new Tooltip(t -> t.background(Tex.button).add(unlock.localizedName())));
}
if((++count) % maxWidth == 0){

View File

@@ -17,11 +17,13 @@ import io.anuke.arc.util.*;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.core.GameState.*;
import io.anuke.mindustry.game.Saves.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.io.SaveIO.*;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.type.Zone.*;
import io.anuke.mindustry.ui.*;
import io.anuke.mindustry.ui.Style;
import io.anuke.mindustry.ui.TreeLayout.*;
import static io.anuke.mindustry.Vars.*;
@@ -33,7 +35,7 @@ public class DeployDialog extends FloatingDialog{
private Rectangle bounds = new Rectangle();
public DeployDialog(){
super("", "fulldialog");
super("", Style.fulldialogWindow);
ZoneNode root = new ZoneNode(Zones.groundZero, null);
@@ -45,7 +47,7 @@ public class DeployDialog extends FloatingDialog{
bounds.y += nodeSize*0.4f;
addCloseButton();
buttons.addImageTextButton("$techtree", "icon-tree", iconsize, () -> ui.tech.show()).size(230f, 64f);
buttons.addImageTextButton("$techtree", Icon.tree, () -> ui.tech.show()).size(230f, 64f);
shown(this::setup);
}
@@ -85,7 +87,7 @@ public class DeployDialog extends FloatingDialog{
Stack sub = new Stack();
if(slot.getZone() != null){
sub.add(new Table(f -> f.margin(4f).add(new Image("whiteui")).color(Color.fromGray(0.1f)).grow()));
sub.add(new Table(f -> f.margin(4f).add(new Image()).color(Color.fromGray(0.1f)).grow()));
sub.add(new Table(f -> f.margin(4f).add(new Image(slot.getZone().preview).setScaling(Scaling.fit)).update(img -> {
TextureRegionDrawable draw = (TextureRegionDrawable)img.getDrawable();
@@ -100,7 +102,7 @@ public class DeployDialog extends FloatingDialog{
}).color(Color.DARK_GRAY).grow()));
}
TextButton button = Elements.newButton(Core.bundle.format("resume", slot.getZone().localizedName()), "square", () -> {
TextButton button = Elements.newButton(Core.bundle.format("resume", slot.getZone().localizedName()), Style.squareTbutton, () -> {
hide();
ui.loadAnd(() -> {
logic.reset();
@@ -173,10 +175,10 @@ public class DeployDialog extends FloatingDialog{
button.clicked(() -> info.show(zone));
if(zone.unlocked() && !hidden(zone)){
button.labelWrap(zone.localizedName()).style("outline").width(140).growX().get().setAlignment(Align.center);
button.labelWrap(zone.localizedName()).style(Style.outlineLabel).width(140).growX().get().setAlignment(Align.center);
}else{
Consumer<Element> flasher = zone.canUnlock() && !hidden(zone) ? e -> e.update(() -> e.getColor().set(Color.WHITE).lerp(Pal.accent, Mathf.absin(3f, 1f))) : e -> {};
flasher.accept(button.addImage("icon-locked").get());
flasher.accept(button.addImage(Icon.locked).get());
button.row();
flasher.accept(button.add("$locked").get());
}
@@ -199,7 +201,7 @@ public class DeployDialog extends FloatingDialog{
stack.add(new Table(t -> t.margin(4f).add(new Image(node.zone.preview).setScaling(Scaling.stretch)).color(node.zone.unlocked() ? Color.DARK_GRAY : Color.fromGray(0.2f)).grow()));
stack.update(() -> stack.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f, Align.center));
Button button = new Button("square");
Button button = new Button(Tex.buttonSquare);
buildButton(node.zone, button);
stack.add(button);
addChild(stack);

View File

@@ -3,6 +3,7 @@ package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.Core;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.scene.ui.Dialog;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.Pal;
import static io.anuke.mindustry.Vars.*;
@@ -10,7 +11,7 @@ import static io.anuke.mindustry.Vars.*;
public class DiscordDialog extends Dialog{
public DiscordDialog(){
super("", "dialog");
super("");
float h = 70f;
@@ -19,17 +20,17 @@ public class DiscordDialog extends Dialog{
Color color = Color.valueOf("7289da");
cont.table(t -> {
t.background("button").margin(0);
t.background(Tex.button).margin(0);
t.table(img -> {
img.addImage("whiteui").height(h - 5).width(40f).color(color);
img.addImage().height(h - 5).width(40f).color(color);
img.row();
img.addImage("whiteui").height(5).width(40f).color(color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
img.addImage().height(5).width(40f).color(color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
}).expandY();
t.table(i -> {
i.background("button");
i.addImage("icon-discord").size(iconsize);
i.background(Tex.button);
i.addImage(Icon.discord);
}).size(h).left();
t.add("$discord").color(Pal.accent).growX().padLeft(10f);

View File

@@ -10,10 +10,12 @@ import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.arc.util.pooling.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.ui.*;
import java.util.*;
import static io.anuke.mindustry.Vars.*;
import static io.anuke.mindustry.Vars.platform;
public class FileChooser extends FloatingDialog{
private static final FileHandle homeDirectory = Core.files.absolute(OS.isMac ? OS.getProperty("user.home") + "/Downloads/" : Core.files.getExternalStoragePath());
@@ -90,10 +92,7 @@ public class FileChooser extends FloatingDialog{
Table icontable = new Table();
float isize = iconsize;
ImageButton up = new ImageButton("icon-folder-parent");
up.resizeImage(isize);
ImageButton up = new ImageButton(Icon.folderParent);
up.clicked(() -> {
directory = directory.parent();
updateFiles(true);
@@ -104,19 +103,15 @@ public class FileChooser extends FloatingDialog{
up.setDisabled(true);
}
ImageButton back = new ImageButton("icon-arrow-left");
back.resizeImage(isize);
ImageButton forward = new ImageButton("icon-arrow-right");
forward.resizeImage(isize);
ImageButton back = new ImageButton(Icon.arrowLeft);
ImageButton forward = new ImageButton(Icon.arrowRight);
forward.clicked(() -> stack.forward());
back.clicked(() -> stack.back());
forward.setDisabled(() -> !stack.canForward());
back.setDisabled(() -> !stack.canBack());
ImageButton home = new ImageButton("icon-home");
home.resizeImage(isize);
ImageButton home = new ImageButton(Icon.home);
home.clicked(() -> {
directory = homeDirectory;
lastDirectory = directory;
@@ -181,7 +176,7 @@ public class FileChooser extends FloatingDialog{
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
layout.setText(Core.scene.skin.getFont("default"), navigation.getText());
layout.setText(Fonts.def, navigation.getText());
if(layout.width < navigation.getWidth()){
navigation.setCursorPosition(0);
@@ -197,15 +192,15 @@ public class FileChooser extends FloatingDialog{
//macs are confined to the Downloads/ directory
if(!OS.isMac){
Image upimage = new Image("icon-folder-parent-small");
TextButton upbutton = new TextButton(".." + directory.toString(), "clear-toggle");
Image upimage = new Image(Icon.folderParentSmall);
TextButton upbutton = new TextButton(".." + directory.toString(), Style.clearToggleTbutton);
upbutton.clicked(() -> {
directory = directory.parent();
lastDirectory = directory;
updateFiles(true);
});
upbutton.left().add(upimage).padRight(4f).size(iconsizesmall).padLeft(4);
upbutton.left().add(upimage).padRight(4f).padLeft(4);
upbutton.getLabel().setAlignment(Align.left);
upbutton.getCells().reverse();
@@ -221,7 +216,7 @@ public class FileChooser extends FloatingDialog{
String filename = file.name();
TextButton button = new TextButton(shorten(filename), "clear-toggle");
TextButton button = new TextButton(shorten(filename), Style.clearToggleTbutton);
group.add(button);
button.clicked(() -> {
@@ -239,9 +234,9 @@ public class FileChooser extends FloatingDialog{
button.setChecked(filename.equals(filefield.getText()));
});
Image image = new Image(file.isDirectory() ? "icon-folder-small" : "icon-file-text-small");
Image image = new Image(file.isDirectory() ? Icon.folderSmall : Icon.fileTextSmall);
button.add(image).padRight(4f).padLeft(4).size(iconsizesmall);
button.add(image).padRight(4f).padLeft(4);
button.getCells().reverse();
files.top().left().add(button).align(Align.topLeft).fillX().expandX()
.height(50).pad(2).padTop(0).padBottom(0).colspan(2);

View File

@@ -8,7 +8,6 @@ import io.anuke.mindustry.core.GameState.*;
import io.anuke.mindustry.game.EventType.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.net.Net;
import static io.anuke.mindustry.Vars.*;
@@ -16,12 +15,12 @@ public class FloatingDialog extends Dialog{
private boolean wasPaused;
protected boolean shouldPause;
public FloatingDialog(String title, String style){
public FloatingDialog(String title, DialogStyle style){
super(title, style);
setFillParent(true);
this.title.setAlignment(Align.center);
titleTable.row();
titleTable.addImage("whiteui", Pal.accent)
titleTable.addImage(Tex.whiteui, Pal.accent)
.growX().height(3f).pad(4f);
hidden(() -> {
@@ -42,7 +41,7 @@ public class FloatingDialog extends Dialog{
}
public FloatingDialog(String title){
this(title, "dialog");
this(title, Core.scene.getStyle(DialogStyle.class));
}
protected void onResize(Runnable run){
@@ -56,7 +55,7 @@ public class FloatingDialog extends Dialog{
@Override
public void addCloseButton(){
buttons.addImageTextButton("$back", "icon-arrow-left", iconsize, this::hide).size(210f, 64f);
buttons.addImageTextButton("$back", Icon.arrowLeft, this::hide).size(210f, 64f);
keyDown(key -> {
if(key == KeyCode.ESCAPE || key == KeyCode.BACK){

View File

@@ -5,6 +5,8 @@ import io.anuke.arc.graphics.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.ui.*;
import java.io.*;
@@ -27,7 +29,7 @@ public class HostDialog extends FloatingDialog{
ui.listfrag.rebuild();
}).grow().pad(8).get().setMaxLength(40);
ImageButton button = t.addImageButton("whiteui", "clear-full", 40, () -> {
ImageButton button = t.addImageButton(Tex.whiteui, Style.clearFullIbutton, 40, () -> {
new ColorPickDialog().show(color -> {
player.color.set(color);
Core.settings.put("color-0", Color.rgba8888(color));

View File

@@ -6,14 +6,15 @@ import io.anuke.arc.collection.*;
import io.anuke.arc.graphics.*;
import io.anuke.arc.input.*;
import io.anuke.arc.math.*;
import io.anuke.arc.scene.style.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.net.*;
import io.anuke.mindustry.net.Packets.*;
import io.anuke.mindustry.ui.*;
import static io.anuke.mindustry.Vars.*;
@@ -98,7 +99,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(), Style.clearTbutton, () -> {
if(!buttons[0].childrenPressed()){
if(server.lastHost != null && server.lastHost.version != Version.build && Version.build != -1 && server.lastHost.version != -1){
ui.showInfo("[scarlet]" + (server.lastHost.version > Version.build ? KickReason.clientOutdated : KickReason.serverOutdated).toString() + "\n[]" +
@@ -117,7 +118,7 @@ public class JoinDialog extends FloatingDialog{
inner.add(button.getLabel()).growX();
inner.addImageButton("icon-arrow-up-small", "empty", iconsizesmall, () -> {
inner.addImageButton(Icon.arrowUpSmall, Style.emptyIbutton, () -> {
int index = servers.indexOf(server);
if(index > 0){
servers.remove(index);
@@ -136,16 +137,16 @@ public class JoinDialog extends FloatingDialog{
}).margin(3f).padTop(6f).top().right();
inner.addImageButton("icon-loading-small", "empty", iconsizesmall, () -> {
inner.addImageButton(Icon.loadingSmall, Style.emptyIbutton, () -> {
refreshServer(server);
}).margin(3f).padTop(6f).top().right();
inner.addImageButton("icon-pencil-small", "empty", iconsizesmall, () -> {
inner.addImageButton(Icon.pencilSmall, Style.emptyIbutton, () -> {
renaming = server;
add.show();
}).margin(3f).padTop(6f).top().right();
inner.addImageButton("icon-trash-16-small", "empty", iconsizesmall, () -> {
inner.addImageButton(Icon.trash16Small, Style.emptyIbutton, () -> {
ui.showConfirm("$confirm", "$server.delete", () -> {
servers.removeValue(server, true);
saveServers();
@@ -236,7 +237,7 @@ public class JoinDialog extends FloatingDialog{
Core.settings.save();
}).grow().pad(8).get().setMaxLength(maxNameLength);
ImageButton button = t.addImageButton("whiteui", "clear-full", 40, () -> {
ImageButton button = t.addImageButton(Tex.whiteui, Style.clearFullIbutton, 40, () -> {
new ColorPickDialog().show(color -> {
player.color.set(color);
Core.settings.put("color-0", Color.rgba8888(color));
@@ -248,7 +249,7 @@ public class JoinDialog extends FloatingDialog{
cont.row();
cont.add(pane).width(w + 38).pad(0);
cont.row();
cont.addCenteredImageTextButton("$server.add", "icon-add", iconsize, () -> {
cont.addCenteredImageTextButton("$server.add", Icon.add, () -> {
renaming = null;
add.show();
}).marginLeft(6).width(w).height(80f).update(button -> {
@@ -273,8 +274,8 @@ public class JoinDialog extends FloatingDialog{
totalHosts = 0;
local.clear();
local.background((Drawable)null);
local.table("button", t -> t.label(() -> "[accent]" + Core.bundle.get("hosts.discovering.any") + Strings.animated(Time.time(), 4, 10f, ".")).pad(10f)).growX();
local.background(null);
local.table(Tex.button, t -> t.label(() -> "[accent]" + Core.bundle.get("hosts.discovering.any") + Strings.animated(Time.time(), 4, 10f, ".")).pad(10f)).growX();
net.discoverServers(this::addLocalHost, this::finishLocalHosts);
for(String host : defaultServers){
net.pingHost(host, port, this::addLocalHost, e -> {});
@@ -284,12 +285,12 @@ public class JoinDialog extends FloatingDialog{
void finishLocalHosts(){
if(totalHosts == 0){
local.clear();
local.background("button");
local.background(Tex.button);
local.add("$hosts.none").pad(10f);
local.add().growX();
local.addImageButton("icon-loading", iconsize, this::refreshLocal).pad(-12f).padLeft(0).size(70f);
local.addImageButton(Icon.loading, this::refreshLocal).pad(-12f).padLeft(0).size(70f);
}else{
local.background((Drawable)null);
local.background(null);
}
}
@@ -297,13 +298,13 @@ public class JoinDialog extends FloatingDialog{
if(totalHosts == 0){
local.clear();
}
local.background((Drawable)null);
local.background(null);
totalHosts++;
float w = targetWidth();
local.row();
TextButton button = local.addButton("", "clear", () -> connect(host.address, port))
TextButton button = local.addButton("", Style.clearTbutton, () -> connect(host.address, port))
.width(w).pad(5f).get();
button.clearChildren();
buildServer(host, button);

View File

@@ -5,6 +5,7 @@ import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.util.Log;
import io.anuke.arc.util.Strings;
import io.anuke.mindustry.ui.*;
import java.util.Locale;
@@ -29,7 +30,7 @@ public class LanguageDialog extends FloatingDialog{
ButtonGroup<TextButton> group = new ButtonGroup<>();
for(Locale loc : locales){
TextButton button = new TextButton(Strings.capitalize(loc.getDisplayName(loc)), "clear-toggle");
TextButton button = new TextButton(Strings.capitalize(loc.getDisplayName(loc)), Style.clearToggleTbutton);
button.clicked(() -> {
if(getLocale().equals(loc)) return;
Core.settings.put("locale", loc.toString());

View File

@@ -11,9 +11,11 @@ import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.core.GameState.*;
import io.anuke.mindustry.game.Saves.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.io.*;
import io.anuke.mindustry.io.SaveIO.*;
import io.anuke.mindustry.ui.*;
import io.anuke.mindustry.ui.Style;
import java.io.*;
@@ -57,7 +59,7 @@ public class LoadDialog extends FloatingDialog{
for(SaveSlot slot : array){
if(slot.isHidden()) continue;
TextButton button = new TextButton("", "clear");
TextButton button = new TextButton("", Style.clearTbutton);
button.getLabel().remove();
button.clearChildren();
@@ -69,45 +71,44 @@ public class LoadDialog extends FloatingDialog{
title.table(t -> {
t.right();
t.addImageButton("icon-floppy", "emptytoggle", iconsize, () -> {
t.addImageButton(Icon.floppy, Style.emptytoggleIbutton, () -> {
slot.setAutosave(!slot.isAutosave());
}).checked(slot.isAutosave()).right();
t.addImageButton("icon-trash", "empty", iconsize, () -> {
t.addImageButton(Icon.trash, Style.emptyIbutton, () -> {
ui.showConfirm("$confirm", "$save.delete.confirm", () -> {
slot.delete();
setup();
});
}).size(iconsize).right();
}).right();
t.addImageButton("icon-pencil", "empty", iconsize, () -> {
t.addImageButton(Icon.pencil, Style.emptyIbutton, () -> {
ui.showTextInput("$save.rename", "$save.rename.text", slot.getName(), text -> {
slot.setName(text);
setup();
});
}).size(iconsize).right();
}).right();
t.addImageButton("icon-save", "empty", iconsize, () -> {
if(!ios){
platform.showFileChooser(false, saveExtension, file -> {
t.addImageButton(Icon.save, Style.emptyIbutton, () -> {
if(!ios){
platform.showFileChooser(false, saveExtension, file -> {
try{
slot.exportFile(file);
setup();
}catch(IOException e){
ui.showException("save.export.fail", e);
}
});
}else{
try{
FileHandle file = Core.files.local("save-" + slot.getName() + "." + saveExtension);
slot.exportFile(file);
setup();
}catch(IOException e){
platform.shareFile(file);
}catch(Exception e){
ui.showException("save.export.fail", e);
}
});
}else{
try{
FileHandle file = Core.files.local("save-" + slot.getName() + "." + saveExtension);
slot.exportFile(file);
platform.shareFile(file);
}catch(Exception e){
ui.showException("save.export.fail", e);
}
}
}).size(iconsize).right();
}).right();
}).padRight(-10).growX();
}).growX().colspan(2);
@@ -169,7 +170,7 @@ public class LoadDialog extends FloatingDialog{
if(ios) return;
slots.addImageTextButton("$save.import", "icon-add", iconsize, () -> {
slots.addImageTextButton("$save.import", Icon.add, () -> {
platform.showFileChooser(true, saveExtension, file -> {
if(SaveIO.isSaveValid(file)){
try{

View File

@@ -6,7 +6,9 @@ import io.anuke.arc.function.*;
import io.anuke.arc.input.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.ui.*;
import static io.anuke.mindustry.Vars.*;
@@ -44,7 +46,7 @@ public class LoadoutDialog extends FloatingDialog{
FloatingDialog dialog = new FloatingDialog("");
dialog.setFillParent(false);
for(Item item : content.items().select(item -> filter.test(item) && item.type == ItemType.material && supplier.get().find(stack -> stack.item == item) == null)){
TextButton button = dialog.cont.addButton("", "clear", () -> {
TextButton button = dialog.cont.addButton("", Style.clearTbutton, () -> {
dialog.hide();
supplier.get().add(new ItemStack(item, 0));
updater.run();
@@ -67,7 +69,7 @@ public class LoadoutDialog extends FloatingDialog{
}).size(210f, 64f);
cont.row();
cont.addImageTextButton("$back", "icon-arrow-left", iconsize, this::hide).size(210f, 64f);
cont.addImageTextButton("$back", Icon.arrowLeft, this::hide).size(210f, 64f);
}
public void show(int capacity, Supplier<Array<ItemStack>> supplier, Runnable reseter, Runnable updater, Runnable hider, Predicate<Item> filter){
@@ -87,17 +89,17 @@ public class LoadoutDialog extends FloatingDialog{
int step = 50;
for(ItemStack stack : supplier.get()){
items.addButton("x", "clear-partial", () -> {
items.addButton("x", Style.clearPartialTbutton, () -> {
supplier.get().remove(stack);
updater.run();
setup();
}).size(bsize);
items.addButton("-", "clear-partial", () -> {
items.addButton("-", Style.clearPartialTbutton, () -> {
stack.amount = Math.max(stack.amount - step, 0);
updater.run();
}).size(bsize);
items.addButton("+", "clear-partial", () -> {
items.addButton("+", Style.clearPartialTbutton, () -> {
stack.amount = Math.min(stack.amount + step, capacity);
updater.run();
}).size(bsize);

View File

@@ -6,6 +6,7 @@ import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.maps.*;
import io.anuke.mindustry.ui.*;
@@ -55,7 +56,7 @@ public class MapPlayDialog extends FloatingDialog{
for(Gamemode mode : Gamemode.values()){
if(mode.hidden) continue;
modes.addButton(mode.toString(), "toggle", () -> {
modes.addButton(mode.toString(), Style.toggleTbutton, () -> {
selectedGamemode = mode;
rules = map.applyRules(mode);
}).update(b -> b.setChecked(selectedGamemode == mode)).size(140f, 54f).disabled(!mode.valid(map));
@@ -66,7 +67,7 @@ public class MapPlayDialog extends FloatingDialog{
cont.add(selmode);
cont.row();
cont.addImageTextButton("$customize", "icon-tools-small", iconsizesmall, () -> dialog.show(rules, () -> rules = map.applyRules(selectedGamemode))).width(230);
cont.addImageTextButton("$customize", Icon.toolsSmall, () -> dialog.show(rules, () -> rules = map.applyRules(selectedGamemode))).width(230);
cont.row();
cont.add(new BorderImage(map.texture, 3f)).size(mobile && !Core.graphics.isPortrait() ? 150f : 250f).get().setScaling(Scaling.fit);
//only maps with survival are valid for high scores
@@ -78,7 +79,7 @@ public class MapPlayDialog extends FloatingDialog{
buttons.clearChildren();
addCloseButton();
buttons.addImageTextButton("$play", "icon-play", iconsize, () -> {
buttons.addImageTextButton("$play", Icon.play, () -> {
control.playMap(map, rules);
hide();
ui.custom.hide();

View File

@@ -9,6 +9,7 @@ import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.io.*;
import io.anuke.mindustry.maps.*;
@@ -43,13 +44,13 @@ public class MapsDialog extends FloatingDialog{
buttons.clearChildren();
if(Core.graphics.isPortrait() && !ios){
buttons.addImageTextButton("$back", "icon-arrow-left", iconsize, this::hide).size(210f*2f, 64f).colspan(2);
buttons.addImageTextButton("$back", Icon.arrowLeft, this::hide).size(210f*2f, 64f).colspan(2);
buttons.row();
}else{
buttons.addImageTextButton("$back", "icon-arrow-left", iconsize, this::hide).size(210f, 64f);
buttons.addImageTextButton("$back", Icon.arrowLeft, this::hide).size(210f, 64f);
}
buttons.addImageTextButton("$editor.newmap", "icon-add", iconsize, () -> {
buttons.addImageTextButton("$editor.newmap", Icon.add, () -> {
ui.showTextInput("$editor.newmap", "$name", "", text -> {
ui.loadAnd(() -> {
hide();
@@ -60,7 +61,7 @@ public class MapsDialog extends FloatingDialog{
}).size(210f, 64f);
if(!ios){
buttons.addImageTextButton("$editor.importmap", "icon-load", iconsize, () -> {
buttons.addImageTextButton("$editor.importmap", Icon.load, () -> {
platform.showFileChooser(true, mapExtension, file -> {
ui.loadAnd(() -> {
maps.tryCatchMapError(() -> {
@@ -127,12 +128,12 @@ public class MapsDialog extends FloatingDialog{
maps.row();
}
TextButton button = maps.addButton("", "clear", () -> showMapInfo(map)).width(mapsize).pad(8).get();
TextButton button = maps.addButton("", Style.clearTbutton, () -> 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("whiteui").growX().pad(4).color(Pal.gray);
button.addImage().growX().pad(4).color(Pal.gray);
button.row();
button.stack(new Image(map.texture).setScaling(Scaling.fit), new BorderImage(map.texture).setScaling(Scaling.fit)).size(mapsize - 20f);
button.row();
@@ -159,7 +160,7 @@ public class MapsDialog extends FloatingDialog{
table.stack(new Image(map.texture).setScaling(Scaling.fit), new BorderImage(map.texture).setScaling(Scaling.fit)).size(mapsize);
table.table("flat", desc -> {
table.table(Style.flat, desc -> {
desc.top();
Table t = new Table();
t.margin(6);
@@ -185,7 +186,7 @@ public class MapsDialog extends FloatingDialog{
table.row();
table.addImageTextButton("$editor.openin", "icon-load-map-small", iconsizesmall, () -> {
table.addImageTextButton("$editor.openin", Icon.loadMapSmall, () -> {
try{
Vars.ui.editor.beginEditMap(map.file);
dialog.hide();
@@ -196,7 +197,7 @@ public class MapsDialog extends FloatingDialog{
}
}).fillX().height(54f).marginLeft(10);
table.addImageTextButton("$delete", "icon-trash-16-small", iconsizesmall, () -> {
table.addImageTextButton("$delete", Icon.trash16Small, () -> {
ui.showConfirm("$confirm", Core.bundle.format("map.delete", map.name()), () -> {
maps.removeMap(map);
dialog.hide();

View File

@@ -6,6 +6,7 @@ import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.input.*;
import io.anuke.arc.scene.event.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.mindustry.gen.*;
import static io.anuke.mindustry.Vars.renderer;
@@ -26,7 +27,7 @@ public class MinimapDialog extends FloatingDialog{
void setup(){
cont.clearChildren();
cont.table("pane", t -> {
cont.table(Tex.pane,t -> {
t.addRect((x, y, width, height) -> {
if(renderer.minimap.getRegion() == null) return;
Draw.color(Color.WHITE);

View File

@@ -3,6 +3,7 @@ package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.*;
import io.anuke.arc.input.*;
import io.anuke.mindustry.core.GameState.*;
import io.anuke.mindustry.gen.*;
import static io.anuke.mindustry.Vars.*;
@@ -71,24 +72,22 @@ public class PausedDialog extends FloatingDialog{
}else{
cont.defaults().size(120f).pad(5);
float isize = iconsize;
cont.addRowImageTextButton("$back", "icon-play-2", isize, this::hide);
cont.addRowImageTextButton("$settings", "icon-tools", isize, ui.settings::show);
cont.addRowImageTextButton("$back", Icon.play2, this::hide);
cont.addRowImageTextButton("$settings", Icon.tools, ui.settings::show);
if(!world.isZone() && !state.isEditor()){
cont.addRowImageTextButton("$save", "icon-save", isize, save::show);
cont.addRowImageTextButton("$save", Icon.save, save::show);
cont.row();
cont.addRowImageTextButton("$load", "icon-load", isize, load::show).disabled(b -> net.active());
cont.addRowImageTextButton("$load", Icon.load, load::show).disabled(b -> net.active());
}else{
cont.row();
}
cont.addRowImageTextButton("$hostserver.mobile", "icon-host", isize, ui.host::show).disabled(b -> net.active());
cont.addRowImageTextButton("$hostserver.mobile", Icon.host, ui.host::show).disabled(b -> net.active());
cont.addRowImageTextButton("$quit", "icon-quit", isize, this::showQuitConfirm);
cont.addRowImageTextButton("$quit", Icon.quit, this::showQuitConfirm);
}
}

View File

@@ -5,6 +5,7 @@ import io.anuke.arc.scene.ui.TextButton;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.game.Saves.SaveSlot;
import io.anuke.mindustry.gen.*;
import static io.anuke.mindustry.Vars.*;
@@ -22,7 +23,7 @@ public class SaveDialog extends LoadDialog{
public void addSetup(){
slots.row();
slots.addImageTextButton("$save.new", "icon-add", 14 * 3, () ->
slots.addImageTextButton("$save.new", Icon.add, () ->
ui.showTextInput("$save", "$save.newslot", 30, "", text -> {
ui.loadAnd("$saving", () -> {
control.saves.addSave(text);

View File

@@ -10,11 +10,13 @@ import io.anuke.arc.scene.*;
import io.anuke.arc.scene.event.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.SettingsDialog.SettingsTable.*;
import io.anuke.arc.scene.ui.TextButton.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.core.GameState.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.ui.*;
import static io.anuke.arc.Core.bundle;
import static io.anuke.mindustry.Vars.*;
@@ -30,8 +32,6 @@ public class SettingsMenuDialog extends SettingsDialog{
private boolean wasPaused;
public SettingsMenuDialog(){
setStyle(Core.scene.skin.get("dialog", WindowStyle.class));
hidden(() -> {
Sounds.back.play();
if(!state.is(State.menu)){
@@ -53,13 +53,13 @@ public class SettingsMenuDialog extends SettingsDialog{
setFillParent(true);
title.setAlignment(Align.center);
titleTable.row();
titleTable.add(new Image("whiteui")).growX().height(3f).pad(4f).get().setColor(Pal.accent);
titleTable.add(new Image()).growX().height(3f).pad(4f).get().setColor(Pal.accent);
cont.clearChildren();
cont.remove();
buttons.remove();
menu = new Table("button");
menu = new Table(Tex.button);
game = new SettingsTable();
graphics = new SettingsTable();
@@ -77,9 +77,9 @@ public class SettingsMenuDialog extends SettingsDialog{
dataDialog = new FloatingDialog("$settings.data");
dataDialog.addCloseButton();
dataDialog.cont.table("button", t -> {
dataDialog.cont.table(Tex.button, t -> {
t.defaults().size(240f, 60f).left();
String style = "clear";
TextButtonStyle style = Style.clearTbutton;
t.addButton("$settings.cleardata", style, () -> ui.showConfirm("$confirm", "$settings.clearall.confirm", () -> {
ObjectMap<String, Object> map = new ObjectMap<>();
@@ -177,7 +177,7 @@ public class SettingsMenuDialog extends SettingsDialog{
void rebuildMenu(){
menu.clearChildren();
String style = "clear";
TextButtonStyle style = Style.clearTbutton;
menu.defaults().size(300f, 60f);
menu.addButton("$settings.game", style, () -> visible(0));
@@ -317,7 +317,7 @@ public class SettingsMenuDialog extends SettingsDialog{
@Override
public void addCloseButton(){
buttons.addImageTextButton("$back", "icon-arrow-left", 30f, () -> {
buttons.addImageTextButton("$back", Icon.arrowLeftSmaller, () -> {
if(prefs.getChildren().first() != menu){
back();
}else{

View File

@@ -19,8 +19,9 @@ import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.ui.*;
import io.anuke.mindustry.ui.Style;
import io.anuke.mindustry.ui.TreeLayout.*;
import io.anuke.mindustry.world.Block.*;
import io.anuke.mindustry.world.*;
import static io.anuke.mindustry.Vars.*;
@@ -47,7 +48,7 @@ public class TechTreeDialog extends FloatingDialog{
addCloseButton();
buttons.addImageTextButton("$database", "icon-database", iconsize, () -> {
buttons.addImageTextButton("$database", Icon.database, () -> {
hide();
ui.database.show();
}).size(210f, 64f);
@@ -142,7 +143,7 @@ public class TechTreeDialog extends FloatingDialog{
infoTable.touchable(Touchable.enabled);
for(TechTreeNode node : nodes){
ImageButton button = new ImageButton(node.node.block.icon(Icon.medium), "node");
ImageButton button = new ImageButton(node.node.block.icon(Block.Icon.medium), Style.nodeIbutton);
button.visible(() -> node.visible);
button.clicked(() -> {
if(mobile){
@@ -186,9 +187,9 @@ public class TechTreeDialog extends FloatingDialog{
button.update(() -> {
float offset = (Core.graphics.getHeight() % 2) / 2f;
button.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f + offset, Align.center);
button.getStyle().up = Core.scene.skin.getDrawable(!locked(node.node) ? "button-over" : !data.hasItems(node.node.requirements) ? "button-red" : "button");
button.getStyle().up = !locked(node.node) ? Tex.buttonOver : !data.hasItems(node.node.requirements) ? Tex.buttonRed : Tex.button;
((TextureRegionDrawable)button.getStyle().imageUp)
.setRegion(node.visible ? node.node.block.icon(Icon.medium) : Core.atlas.find("icon-locked"));
.setRegion(node.visible ? node.node.block.icon(Block.Icon.medium) : Core.atlas.find("icon-locked"));
button.getImage().setColor(!locked(node.node) ? Color.WHITE : Color.GRAY);
});
addChild(button);
@@ -257,12 +258,12 @@ public class TechTreeDialog extends FloatingDialog{
infoTable.update(() -> infoTable.setPosition(button.getX() + button.getWidth(), button.getY() + button.getHeight(), Align.topLeft));
infoTable.left();
infoTable.background("button").margin(8f);
infoTable.background(Tex.button).margin(8f);
infoTable.table(b -> {
b.margin(0).left().defaults().left();
b.addImageButton("icon-info-small", "clear", iconsizesmall, () -> ui.content.show(node.block)).growY().width(50f);
b.addImageButton(Icon.infoSmall, Style.clearIbutton, () -> ui.content.show(node.block)).growY().width(50f);
b.add().grow();
b.table(desc -> {
desc.left().defaults().left();
@@ -289,7 +290,7 @@ public class TechTreeDialog extends FloatingDialog{
if(mobile && locked(node)){
b.row();
b.addImageTextButton("$research", "icon-check-small", "node", iconsizesmall, () -> unlock(node))
b.addImageTextButton("$research", Icon.checkSmall, Style.nodeTbutton, () -> unlock(node))
.disabled(i -> !data.hasItems(node.requirements)).growX().height(44f).colspan(3);
}
});

View File

@@ -3,6 +3,7 @@ package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.Core;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.mindustry.entities.type.Player;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.net.Administration.TraceInfo;
public class TraceDialog extends FloatingDialog{
@@ -17,7 +18,7 @@ public class TraceDialog extends FloatingDialog{
public void show(Player player, TraceInfo info){
cont.clear();
Table table = new Table("clear");
Table table = new Table(Tex.clear);
table.margin(14);
table.defaults().pad(1);

View File

@@ -10,7 +10,6 @@ import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.type.Zone.*;
import io.anuke.mindustry.world.*;
import io.anuke.mindustry.world.Block.*;
import static io.anuke.mindustry.Vars.*;
@@ -55,7 +54,7 @@ public class ZoneInfoDialog extends FloatingDialog{
cont.pane(cont -> {
if(zone.locked()){
cont.addImage("icon-locked");
cont.addImage(Icon.locked);
cont.row();
cont.add("$locked").padBottom(6);
cont.row();
@@ -68,9 +67,9 @@ public class ZoneInfoDialog extends FloatingDialog{
r.add("$complete").colspan(2).left();
r.row();
for(ZoneRequirement other : zone.zoneRequirements){
r.addImage("icon-terrain").padRight(4);
r.addImage(Icon.terrain).padRight(4);
r.add(Core.bundle.format("zone.requirement", other.wave, other.zone.localizedName())).color(Color.LIGHT_GRAY);
r.addImage(other.zone.bestWave() >= other.wave ? "icon-check-small" : "icon-cancel-small", other.zone.bestWave() >= other.wave ? Color.LIGHT_GRAY : Color.SCARLET).padLeft(3);
r.addImage(other.zone.bestWave() >= other.wave ? Icon.checkSmall : Icon.cancelSmall, other.zone.bestWave() >= other.wave ? Color.LIGHT_GRAY : Color.SCARLET).padLeft(3);
r.row();
}
});
@@ -83,9 +82,9 @@ public class ZoneInfoDialog extends FloatingDialog{
r.add("$research.list").colspan(2).left();
r.row();
for(Block block : zone.blockRequirements){
r.addImage(block.icon(Icon.small)).size(8 * 3).padRight(4);
r.addImage(block.icon(Block.Icon.small)).size(8 * 3).padRight(4);
r.add(block.localizedName).color(Color.LIGHT_GRAY);
r.addImage(data.isUnlocked(block) ? "icon-check-small" : "icon-cancel-small", data.isUnlocked(block) ? Color.LIGHT_GRAY : Color.SCARLET).padLeft(3);
r.addImage(data.isUnlocked(block) ? Icon.checkSmall : Icon.cancelSmall, data.isUnlocked(block) ? Color.LIGHT_GRAY : Color.SCARLET).padLeft(3);
r.row();
}
@@ -96,7 +95,7 @@ public class ZoneInfoDialog extends FloatingDialog{
}else{
cont.add(zone.localizedName()).color(Pal.accent).growX().center();
cont.row();
cont.addImage("whiteui").color(Pal.accent).height(3).pad(6).growX();
cont.addImage().color(Pal.accent).height(3).pad(6).growX();
cont.row();
cont.table(desc -> {
desc.left().defaults().left().width(Core.graphics.isPortrait() ? 350f : 500f);

View File

@@ -22,7 +22,7 @@ import io.anuke.arc.util.*;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.type.Player;
import io.anuke.mindustry.game.EventType.*;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.Item.Icon;
import io.anuke.mindustry.world.Tile;
@@ -88,7 +88,7 @@ public class BlockInventoryFragment extends Fragment{
table.clearChildren();
table.clearActions();
table.background("inventory");
table.background(Tex.inventory);
table.touchable(Touchable.enabled);
table.update(() -> {

View File

@@ -14,6 +14,7 @@ import io.anuke.arc.util.*;
import io.anuke.mindustry.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.input.*;
import io.anuke.mindustry.ui.*;
import static io.anuke.arc.Core.*;
import static io.anuke.mindustry.Vars.net;
@@ -45,7 +46,7 @@ public class ChatFragment extends Table{
super();
setFillParent(true);
font = scene.skin.getFont("default");
font = Fonts.def;
visible(() -> {
if(!net.active() && messages.size > 0){
@@ -98,10 +99,10 @@ public class ChatFragment extends Table{
fieldlabel.getStyle().font = font;
fieldlabel.setStyle(fieldlabel.getStyle());
chatfield = new TextField("", new TextField.TextFieldStyle(scene.skin.get(TextField.TextFieldStyle.class)));
chatfield = new TextField("", new TextField.TextFieldStyle(scene.getStyle(TextField.TextFieldStyle.class)));
chatfield.setFilter((field, c) -> field.getText().length() < Vars.maxTextLength);
chatfield.getStyle().background = null;
chatfield.getStyle().font = scene.skin.getFont("chat");
chatfield.getStyle().font = Fonts.chat;
chatfield.getStyle().fontColor = Color.WHITE;
chatfield.setStyle(chatfield.getStyle());

View File

@@ -13,6 +13,7 @@ import io.anuke.arc.scene.actions.*;
import io.anuke.arc.scene.event.*;
import io.anuke.arc.scene.style.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.ImageButton.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.core.GameState.*;
@@ -26,6 +27,7 @@ import io.anuke.mindustry.input.*;
import io.anuke.mindustry.net.Packets.*;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.ui.*;
import io.anuke.mindustry.ui.Style;
import io.anuke.mindustry.ui.dialogs.*;
import static io.anuke.mindustry.Vars.*;
@@ -59,12 +61,12 @@ public class HudFragment extends Fragment{
select.left();
select.defaults().size(dsize).left();
String style = "clear-trans";
ImageButtonStyle style = Style.clearTransIbutton;
select.addImageButton("icon-menu-large", style, iconsize, ui.paused::show);
flip = select.addImageButton("icon-arrow-up", style, iconsize, this::toggleMenus).get();
select.addImageButton(Icon.menuLarge, style, ui.paused::show);
flip = select.addImageButton(Icon.arrowUp, style, this::toggleMenus).get();
select.addImageButton("icon-pause", style, iconsize, () -> {
select.addImageButton(Icon.pause, style, () -> {
if(net.active()){
ui.listfrag.toggle();
}else{
@@ -72,14 +74,14 @@ public class HudFragment extends Fragment{
}
}).name("pause").update(i -> {
if(net.active()){
i.getStyle().imageUp = Core.scene.skin.getDrawable("icon-players");
i.getStyle().imageUp = Icon.players;
}else{
i.setDisabled(false);
i.getStyle().imageUp = Core.scene.skin.getDrawable(state.is(State.paused) ? "icon-play" : "icon-pause");
i.getStyle().imageUp = state.is(State.paused) ? Icon.play : Icon.pause;
}
}).get();
select.addImageButton("icon-settings", style, iconsize, () -> {
select.addImageButton(Icon.settings, style,() -> {
if(net.active() && mobile){
if(ui.chatfrag.chatOpen()){
ui.chatfrag.hide();
@@ -93,13 +95,13 @@ public class HudFragment extends Fragment{
}
}).update(i -> {
if(net.active() && mobile){
i.getStyle().imageUp = Core.scene.skin.getDrawable("icon-chat");
i.getStyle().imageUp = Icon.chat;
}else{
i.getStyle().imageUp = Core.scene.skin.getDrawable("icon-database");
i.getStyle().imageUp = Icon.database;
}
}).get();
select.addImage("whiteui").color(Pal.gray).width(4f).fillY();
select.addImage().color(Pal.gray).width(4f).fillY();
float size = UnitScl.dp.scl(dsize);
Array<Element> children = new Array<>(select.getChildren());
@@ -124,7 +126,7 @@ public class HudFragment extends Fragment{
}
cont.row();
cont.addImage("whiteui").height(4f).color(Pal.gray).fillX();
cont.addImage().height(4f).color(Pal.gray).fillX();
cont.row();
}
@@ -142,7 +144,7 @@ public class HudFragment extends Fragment{
wavesMain.visible(() -> shown && !state.isEditor());
wavesMain.top().left();
Stack stack = new Stack();
Button waves = new Button("wave");
Button waves = new Button(Style.waveButton);
Table btable = new Table().margin(0);
stack.add(waves);
@@ -152,13 +154,13 @@ public class HudFragment extends Fragment{
addPlayButton(btable);
wavesMain.add(stack).width(dsize * 4 + 4f);
wavesMain.row();
wavesMain.table("button", t -> t.margin(10f).add(new Bar("boss.health", Pal.health, () -> state.boss() == null ? 0f : state.boss().healthf()).blink(Color.WHITE))
wavesMain.table(Tex.button, t -> t.margin(10f).add(new Bar("boss.health", Pal.health, () -> state.boss() == null ? 0f : state.boss().healthf()).blink(Color.WHITE))
.grow()).fillX().visible(() -> state.rules.waves && state.boss() != null).height(60f).get();
wavesMain.row();
}
{
editorMain.table("button-edge-4", t -> {
editorMain.table(Tex.buttonEdge4, t -> {
//t.margin(0f);
t.add("$editor.teams").growX().left();
t.row();
@@ -166,7 +168,7 @@ public class HudFragment extends Fragment{
teams.left();
int i = 0;
for(Team team : Team.all){
ImageButton button = teams.addImageButton("white", "clear-toggle-partial", 40f, () -> Call.setPlayerTeamEditor(player, team))
ImageButton button = teams.addImageButton(Tex.whiteui, Style.clearTogglePartialIbutton, 40f, () -> Call.setPlayerTeamEditor(player, team))
.size(50f).margin(6f).get();
button.getImageCell().grow();
button.getStyle().imageUpColor = team.color;
@@ -181,11 +183,11 @@ public class HudFragment extends Fragment{
if(enableUnitEditing){
t.row();
t.addImageTextButton("$editor.spawn", "icon-add", iconsize, () -> {
t.addImageTextButton("$editor.spawn", Icon.add, () -> {
FloatingDialog dialog = new FloatingDialog("$editor.spawn");
int i = 0;
for(UnitType type : content.<UnitType>getBy(ContentType.unit)){
dialog.cont.addImageButton("white", 48, () -> {
dialog.cont.addImageButton(Tex.whiteui, 48, () -> {
Call.spawnUnitEditor(player, type);
dialog.hide();
}).get().getStyle().imageUp = new TextureRegionDrawable(type.iconRegion);
@@ -200,7 +202,7 @@ public class HudFragment extends Fragment{
float[] position = {0, 0};
t.row();
t.addImageTextButton("$editor.removeunit", "icon-quit", "toggle", iconsize, () -> {}).fillX().update(b -> {
t.addImageTextButton("$editor.removeunit", Icon.quit, Style.toggleTbutton, () -> {}).fillX().update(b -> {
boolean[] found = {false};
if(b.isChecked()){
Element e = Core.scene.hit(Core.input.mouseX(), Core.input.mouseY(), true);
@@ -241,9 +243,9 @@ public class HudFragment extends Fragment{
IntFormat fps = new IntFormat("fps");
IntFormat ping = new IntFormat("ping");
info.label(() -> fps.get(Core.graphics.getFramesPerSecond())).left().style("outline");
info.label(() -> fps.get(Core.graphics.getFramesPerSecond())).left().style(Style.outlineLabel);
info.row();
info.label(() -> ping.get(netClient.getPing())).visible(net::client).left().style("outline");
info.label(() -> ping.get(netClient.getPing())).visible(net::client).left().style(Style.outlineLabel);
}).top().left();
});
@@ -253,7 +255,7 @@ public class HudFragment extends Fragment{
//spawner warning
parent.fill(t -> {
t.touchable(Touchable.disabled);
t.table("flat", c -> c.add("$nearpoint")
t.table(Style.flat, c -> c.add("$nearpoint")
.update(l -> l.setColor(Tmp.c1.set(Color.WHITE).lerp(Color.SCARLET, Mathf.absin(Time.time(), 10f, 1f))))
.get().setAlignment(Align.center, Align.center))
.margin(6).update(u -> u.color.a = Mathf.lerpDelta(u.color.a, Mathf.num(spawner.playerNear()), 0.1f)).get().color.a = 0f;
@@ -261,7 +263,7 @@ public class HudFragment extends Fragment{
parent.fill(t -> {
t.visible(() -> netServer.isWaitingForPlayers());
t.table("button", c -> c.add("$waiting.players"));
t.table(Tex.button, c -> c.add("$waiting.players"));
});
//'core is under attack' table
@@ -307,7 +309,7 @@ public class HudFragment extends Fragment{
return coreAttackOpacity > 0;
});
t.table("button", top -> top.add("$coreattack").pad(2)
t.table(Tex.button, top -> top.add("$coreattack").pad(2)
.update(label -> label.getColor().set(Color.ORANGE).lerp(Color.SCARLET, Mathf.absin(Time.time(), 2f, 1f)))).touchable(Touchable.disabled);
});
@@ -316,14 +318,14 @@ public class HudFragment extends Fragment{
Runnable resize = () -> {
t.clearChildren();
t.top().right().visible(() -> state.rules.tutorial);
t.stack(new Button("default"){{
t.stack(new Button(){{
marginLeft(48f);
labelWrap(() -> control.tutorial.stage.text() + (control.tutorial.canNext() ? "\n\n" + Core.bundle.get("tutorial.next") : "")).width(!Core.graphics.isPortrait() ? 400f : 160f).pad(2f);
clicked(() -> control.tutorial.nextSentence());
setDisabled(() -> !control.tutorial.canNext());
}},
new Table(f -> {
f.left().addImageButton("icon-arrow-left-small", "empty", iconsizesmall, () -> {
f.left().addImageButton(Icon.arrowLeftSmall, Style.emptyIbutton, () -> {
control.tutorial.prevSentence();
}).width(44f).growY().visible(() -> control.tutorial.canPrev());
}));
@@ -336,13 +338,13 @@ public class HudFragment extends Fragment{
//paused table
parent.fill(t -> {
t.top().visible(() -> state.isPaused()).touchable(Touchable.disabled);
t.table("button-trans", top -> top.add("$paused").pad(5f));
t.table(Tex.buttonTrans, top -> top.add("$paused").pad(5f));
});
//'saving' indicator
parent.fill(t -> {
t.bottom().visible(() -> control.saves.isSaving());
t.add("$saveload").style("outline");
t.add("$saveload").style(Style.outlineLabel);
});
blockfrag.build(parent);
@@ -390,14 +392,14 @@ public class HudFragment extends Fragment{
scheduleToast(() -> {
Sounds.message.play();
Table table = new Table("button");
Table table = new Table(Tex.button);
table.update(() -> {
if(state.is(State.menu)){
table.remove();
}
});
table.margin(12);
table.addImage("icon-check").size(iconsize).pad(3);
table.addImage(Icon.check).pad(3);
table.add(text).wrap().width(280f).get().setAlignment(Align.center, Align.center);
table.pack();
@@ -426,7 +428,7 @@ public class HudFragment extends Fragment{
//if there's currently no unlock notification...
if(lastUnlockTable == null){
scheduleToast(() -> {
Table table = new Table("button");
Table table = new Table(Tex.button);
table.update(() -> {
if(state.is(State.menu)){
table.remove();
@@ -498,7 +500,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.addImage(Icon.add);
}
lastUnlockLayout.pack();
@@ -506,7 +508,7 @@ public class HudFragment extends Fragment{
}
public void showLaunch(){
Image image = new Image("whiteui");
Image image = new Image();
image.getColor().a = 0f;
image.setFillParent(true);
image.actions(Actions.fadeIn(40f / 60f));
@@ -551,7 +553,7 @@ public class HudFragment extends Fragment{
private void toggleMenus(){
if(flip != null){
flip.getStyle().imageUp = Core.scene.skin.getDrawable(shown ? "icon-arrow-down" : "icon-arrow-up");
flip.getStyle().imageUp = shown ? Icon.arrowDown : Icon.arrowUp;
}
shown = !shown;
@@ -642,7 +644,7 @@ public class HudFragment extends Fragment{
}
private void addPlayButton(Table table){
table.right().addImageButton("icon-play", "right", 30f, () -> {
table.right().addImageButton(Icon.playSmaller, Style.rightIbutton, 30f, () -> {
if(net.client() && player.isAdmin){
Call.onAdminRequest(player, AdminAction.wave);
}else if(inLaunchWave()){

View File

@@ -7,6 +7,7 @@ import io.anuke.arc.scene.ui.Label;
import io.anuke.arc.scene.ui.TextButton;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.ui.*;
public class LoadingFragment extends Fragment{
private Table table;
@@ -14,16 +15,16 @@ public class LoadingFragment extends Fragment{
@Override
public void build(Group parent){
parent.fill("loadDim", t -> {
parent.fill(Style.loadDim,t -> {
t.visible(false);
t.touchable(Touchable.enabled);
t.add().height(70f).row();
t.addImage("whiteui").growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
t.addImage().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
t.row();
t.add("$loading").name("namelabel").pad(10f);
t.row();
t.addImage("whiteui").growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
t.addImage().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
t.row();
button = t.addButton("$cancel", () -> {

View File

@@ -1,22 +1,22 @@
package io.anuke.mindustry.ui.fragments;
import io.anuke.arc.Core;
import io.anuke.arc.Events;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.Texture;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.math.Interpolation;
import io.anuke.arc.scene.Group;
import io.anuke.arc.scene.actions.Actions;
import io.anuke.arc.scene.event.Touchable;
import io.anuke.arc.scene.ui.Button;
import io.anuke.arc.*;
import io.anuke.arc.graphics.*;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.*;
import io.anuke.arc.scene.*;
import io.anuke.arc.scene.actions.*;
import io.anuke.arc.scene.event.*;
import io.anuke.arc.scene.style.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.Align;
import io.anuke.mindustry.game.EventType.DisposeEvent;
import io.anuke.mindustry.game.EventType.ResizeEvent;
import io.anuke.mindustry.game.Version;
import io.anuke.mindustry.graphics.MenuRenderer;
import io.anuke.mindustry.ui.MobileButton;
import io.anuke.arc.util.*;
import io.anuke.mindustry.game.EventType.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.ui.*;
import io.anuke.mindustry.ui.Style;
import static io.anuke.arc.Core.assets;
import static io.anuke.mindustry.Vars.*;
@@ -61,8 +61,8 @@ public class MenuFragment extends Fragment{
//info icon
if(mobile){
parent.fill(c -> c.bottom().left().addButton("", "info", ui.about::show).size(84, 45));
parent.fill(c -> c.bottom().right().addButton("", "discord", ui.discord::show).size(84, 45));
parent.fill(c -> c.bottom().left().addButton("", Style.infoTbutton, ui.about::show).size(84, 45));
parent.fill(c -> c.bottom().right().addButton("", Style.discordTbutton, ui.discord::show).size(84, 45));
}
String versionText = "[#ffffffba]" + ((Version.build == -1) ? "[#fc8140aa]custom build" : (Version.type.equals("official") ? Version.modifier : Version.type) + " build " + Version.build);
@@ -79,8 +79,8 @@ public class MenuFragment extends Fragment{
Draw.color();
Draw.rect(Draw.wrap(logo), fx, fy, logow, logoh);
Core.scene.skin.font().setColor(Color.WHITE);
Core.scene.skin.font().draw(versionText, fx, fy - logoh/2f, Align.center);
Fonts.def.setColor(Color.WHITE);
Fonts.def.draw(versionText, fx, fy - logoh/2f, Align.center);
}).touchable(Touchable.disabled);
}
@@ -89,18 +89,17 @@ public class MenuFragment extends Fragment{
container.setSize(Core.graphics.getWidth(), Core.graphics.getHeight());
float size = 120f;
float isize = iconsize;
container.defaults().size(size).pad(5).padTop(4f);
MobileButton
play = new MobileButton("icon-play-2", isize, "$campaign", ui.deploy::show),
custom = new MobileButton("icon-play-custom", isize, "$customgame", ui.custom::show),
maps = new MobileButton("icon-load", isize, "$loadgame", ui.load::show),
join = new MobileButton("icon-add", isize, "$joingame", ui.join::show),
editor = new MobileButton("icon-editor", isize, "$editor", ui.maps::show),
tools = new MobileButton("icon-tools", isize, "$settings", ui.settings::show),
donate = new MobileButton("icon-link", isize, "$website", () -> Core.net.openURI("https://anuke.itch.io/mindustry")),
exit = new MobileButton("icon-exit", isize, "$quit", () -> Core.app.exit());
play = new MobileButton(Icon.play2, "$campaign", ui.deploy::show),
custom = new MobileButton(Icon.playCustom, "$customgame", ui.custom::show),
maps = new MobileButton(Icon.load, "$loadgame", ui.load::show),
join = new MobileButton(Icon.add, "$joingame", ui.join::show),
editor = new MobileButton(Icon.editor, "$editor", ui.maps::show),
tools = new MobileButton(Icon.tools, "$settings", ui.settings::show),
donate = new MobileButton(Icon.link, "$website", () -> Core.net.openURI("https://anuke.itch.io/mindustry")),
exit = new MobileButton(Icon.exit, "$quit", () -> Core.app.exit());
if(!Core.graphics.isPortrait()){
container.marginTop(60f);
@@ -147,25 +146,26 @@ public class MenuFragment extends Fragment{
float width = 230f;
String background = "flat-trans";
Drawable background = Style.flatTrans;
container.left();
container.add().width(Core.graphics.getWidth()/10f);
container.table(background, t -> {
t.defaults().width(width).height(70f);
//todo buttons should be small
buttons(t,
new Buttoni("$play", "icon-play-2",
new Buttoni("$campaign", "icon-play-2", ui.deploy::show),
new Buttoni("$joingame", "icon-add", ui.join::show),
new Buttoni("$customgame", "icon-editor", ui.custom::show),
new Buttoni("$loadgame", "icon-load", ui.load::show),
new Buttoni("$tutorial", "icon-info", control::playTutorial)
new Buttoni("$play", Icon.play2Small,
new Buttoni("$campaign", Icon.play2Small, ui.deploy::show),
new Buttoni("$joingame", Icon.addSmall, ui.join::show),
new Buttoni("$customgame", Icon.editorSmall, ui.custom::show),
new Buttoni("$loadgame", Icon.loadSmall, ui.load::show),
new Buttoni("$tutorial", Icon.infoSmall, control::playTutorial)
),
new Buttoni("$editor", "icon-editor", ui.maps::show),
new Buttoni("$settings", "icon-tools", ui.settings::show),
new Buttoni("$about.button", "icon-info", ui.about::show),
new Buttoni("$quit", "icon-exit", Core.app::exit)
new Buttoni("$editor", Icon.editorSmall, ui.maps::show),
new Buttoni("$settings", Icon.toolsSmall, ui.settings::show),
new Buttoni("$about.button", Icon.infoSmall, ui.about::show),
new Buttoni("$quit", Icon.exitSmall, Core.app::exit)
);
}).width(width).growY();
@@ -198,8 +198,7 @@ public class MenuFragment extends Fragment{
private void buttons(Table t, Buttoni... buttons){
for(Buttoni b : buttons){
Button[] out = {null};
out[0] = t.addImageTextButton(b.text, b.icon + "-small", "clear-toggle-menu",
iconsizesmall, () -> {
out[0] = t.addImageTextButton(b.text, b.icon, Style.clearToggleMenuTbutton, () -> {
if(currentMenu == out[0]){
currentMenu = null;
fadeOutMenu();
@@ -225,19 +224,19 @@ public class MenuFragment extends Fragment{
}
private class Buttoni{
final String icon;
final Drawable icon;
final String text;
final Runnable runnable;
final Buttoni[] submenu;
public Buttoni(String text, String icon, Runnable runnable){
public Buttoni(String text, Drawable icon, Runnable runnable){
this.icon = icon;
this.text = text;
this.runnable = runnable;
this.submenu = null;
}
public Buttoni(String text, String icon, Buttoni... buttons){
public Buttoni(String text, Drawable icon, Buttoni... buttons){
this.icon = icon;
this.text = text;
this.runnable = () -> {};

View File

@@ -12,11 +12,12 @@ import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.mindustry.entities.type.*;
import io.anuke.mindustry.game.EventType.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.input.*;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.ui.Style;
import io.anuke.mindustry.world.*;
import io.anuke.mindustry.world.Block.*;
import static io.anuke.mindustry.Vars.*;
@@ -137,13 +138,13 @@ public class PlacementFragment extends Fragment{
continue;
}
ImageButton button = blockTable.addImageButton("icon-locked", "select", 8 * 4, () -> {
ImageButton button = blockTable.addImageButton(Icon.lockedSmall, Style.selectIbutton, () -> {
if(unlocked(block)){
input.block = input.block == block ? null : block;
}
}).size(46f).group(group).name("block-" + block.name).get();
button.getStyle().imageUp = new TextureRegionDrawable(block.icon(Icon.medium));
button.getStyle().imageUp = new TextureRegionDrawable(block.icon(Block.Icon.medium));
button.update(() -> { //color unplacable things gray
TileEntity core = player.getClosestCore();
@@ -169,7 +170,7 @@ public class PlacementFragment extends Fragment{
};
//top table with hover info
frame.table("button-edge-2", top -> {
frame.table(Tex.buttonEdge2,top -> {
topTable = top;
top.add(new Table()).growX().update(topTable -> {
//don't refresh unnecessarily
@@ -189,12 +190,12 @@ public class PlacementFragment extends Fragment{
topTable.table(header -> {
header.left();
header.add(new Image(lastDisplay.icon(Icon.medium))).size(8 * 4);
header.add(new Image(lastDisplay.icon(Block.Icon.medium))).size(8 * 4);
header.labelWrap(() -> !unlocked(lastDisplay) ? Core.bundle.get("block.unknown") : lastDisplay.localizedName)
.left().width(190f).padLeft(5);
header.add().growX();
if(unlocked(lastDisplay)){
header.addButton("?", "clear-partial", () -> {
header.addButton("?", Style.clearPartialTbutton, () -> {
ui.content.show(lastDisplay);
Events.fire(new BlockInfoEvent());
}).size(8 * 5).padTop(-5).padRight(-5).right().grow().name("blockinfo");
@@ -243,9 +244,9 @@ public class PlacementFragment extends Fragment{
});
}).colspan(3).fillX().visible(() -> getSelected() != null || tileDisplayBlock() != null).touchable(Touchable.enabled);
frame.row();
frame.addImage("whiteui").color(Pal.gray).colspan(3).height(4).growX();
frame.addImage().color(Pal.gray).colspan(3).height(4).growX();
frame.row();
frame.table("pane-2", blocksSelect -> {
frame.table(Tex.pane2, blocksSelect -> {
blocksSelect.margin(4).marginTop(0);
blocksSelect.table(blocks -> blockTable = blocks).grow();
blocksSelect.row();
@@ -267,11 +268,11 @@ public class PlacementFragment extends Fragment{
if(f++ % 2 == 0) categories.row();
if(categoryEmpty[cat.ordinal()]){
categories.addImage("flat-trans");
categories.addImage(Style.flatTrans);
continue;
}
categories.addImageButton("icon-" + cat.name() + "-med", "clear-toggle-trans", iconsizemed, () -> {
categories.addImageButton(Core.atlas.drawable("icon-" + cat.name() + "-smaller"), Style.clearToggleTransIbutton, () -> {
currentCategory = cat;
rebuildCategory.run();
}).group(group).update(i -> i.setChecked(currentCategory == cat)).name("category-" + cat.name());

View File

@@ -1,21 +1,18 @@
package io.anuke.mindustry.ui.fragments;
import io.anuke.arc.Core;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.scene.Group;
import io.anuke.arc.scene.event.Touchable;
import io.anuke.arc.scene.ui.Image;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.scene.ui.layout.UnitScl;
import io.anuke.arc.util.Interval;
import io.anuke.arc.util.Scaling;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.net.NetConnection;
import io.anuke.mindustry.net.Packets.AdminAction;
import io.anuke.arc.*;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.scene.*;
import io.anuke.arc.scene.event.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.core.GameState.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.net.*;
import io.anuke.mindustry.net.Packets.*;
import io.anuke.mindustry.ui.*;
import static io.anuke.mindustry.Vars.*;
@@ -43,7 +40,7 @@ public class PlayerListFragment extends Fragment{
}
});
cont.table("button-trans", pane -> {
cont.table(Tex.buttonTrans, pane -> {
pane.label(() -> Core.bundle.format(playerGroup.size() == 1 ? "players.single" : "players", playerGroup.size()));
pane.row();
pane.pane(content).grow().get().setScrollingDisabled(true, false);
@@ -96,7 +93,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").size(iconsize).visible(() -> user.isAdmin && !(!user.isLocal && net.server())).padRight(5).get().updateVisibility();
button.addImage(Icon.admin).visible(() -> user.isAdmin && !(!user.isLocal && net.server())).padRight(5).get().updateVisibility();
if((net.server() || player.isAdmin) && !user.isLocal && (!user.isAdmin || net.server())){
button.add().growY();
@@ -106,14 +103,14 @@ public class PlayerListFragment extends Fragment{
button.table(t -> {
t.defaults().size(bs);
t.addImageButton("icon-ban-small", "clear-partial", iconsizesmall,
t.addImageButton(Icon.banSmall, Style.clearPartialIbutton,
() -> ui.showConfirm("$confirm", "$confirmban", () -> Call.onAdminRequest(user, AdminAction.ban)));
t.addImageButton("icon-cancel-small", "clear-partial", iconsizesmall,
t.addImageButton(Icon.cancelSmall, Style.clearPartialIbutton,
() -> ui.showConfirm("$confirm", "$confirmkick", () -> Call.onAdminRequest(user, AdminAction.kick)));
t.row();
t.addImageButton("icon-admin-small", "clear-toggle-partial", iconsizesmall, () -> {
t.addImageButton(Icon.adminSmall, Style.clearTogglePartialIbutton, () -> {
if(net.client()) return;
String id = user.uuid;
@@ -129,14 +126,14 @@ public class PlayerListFragment extends Fragment{
.touchable(() -> net.client() ? Touchable.disabled : Touchable.enabled)
.checked(user.isAdmin);
t.addImageButton("icon-zoom-small", "clear-partial", iconsizesmall, () -> Call.onAdminRequest(user, AdminAction.trace));
t.addImageButton(Icon.zoomSmall, Style.clearPartialIbutton, () -> Call.onAdminRequest(user, AdminAction.trace));
}).padRight(12).size(bs + 10f, bs);
}
content.add(button).padBottom(-6).width(350f).maxHeight(h + 14);
content.row();
content.addImage("whiteui").height(4f).color(state.rules.pvp ? user.getTeam().color : Pal.gray).growX();
content.addImage().height(4f).color(state.rules.pvp ? user.getTeam().color : Pal.gray).growX();
content.row();
});

View File

@@ -254,7 +254,7 @@ public class Block extends BlockStorage{
if(renderer.pixelator.enabled()) return 0;
Color color = valid ? Pal.accent : Pal.remove;
BitmapFont font = Core.scene.skin.getFont("outline");
BitmapFont font = Fonts.outline;
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
boolean ints = font.usesIntegerPositions();
font.setUseIntegerPositions(false);

View File

@@ -1,14 +1,13 @@
package io.anuke.mindustry.world.blocks;
import io.anuke.arc.collection.Array;
import io.anuke.arc.function.Consumer;
import io.anuke.arc.function.Supplier;
import io.anuke.arc.scene.style.TextureRegionDrawable;
import io.anuke.arc.scene.ui.ButtonGroup;
import io.anuke.arc.scene.ui.ImageButton;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.Item.Icon;
import io.anuke.arc.collection.*;
import io.anuke.arc.function.*;
import io.anuke.arc.scene.style.*;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.ui.Style;
import static io.anuke.mindustry.Vars.*;
@@ -28,9 +27,9 @@ public class ItemSelection{
for(Item item : items){
if(!data.isUnlocked(item) && world.isZone()) continue;
ImageButton button = cont.addImageButton("whiteui", "clear-toggle-trans", 24, () -> control.input.frag.config.hideConfig()).group(group).get();
ImageButton button = cont.addImageButton(Tex.whiteui, Style.clearToggleTransIbutton, 24, () -> control.input.frag.config.hideConfig()).group(group).get();
button.changed(() -> consumer.accept(button.isChecked() ? item : null));
button.getStyle().imageUp = new TextureRegionDrawable(item.icon(Icon.medium));
button.getStyle().imageUp = new TextureRegionDrawable(item.icon(Item.Icon.medium));
button.update(() -> button.setChecked(holder.get() == item));
if(i++ % 4 == 3){

View File

@@ -184,7 +184,7 @@ public class Drill extends Block{
for(int i = 0; i < list.size; i++){
Item item = list.get(i);
table.addImage(item.name + "1").size(8 * 3).padRight(2).padLeft(2).padTop(3).padBottom(3);
table.addImage(Core.atlas.find(item.name + "1")).size(8 * 3).padRight(2).padLeft(2).padTop(3).padBottom(3);
table.add(item.localizedName());
if(i != list.size - 1){
table.add("/").padLeft(5).padRight(5);

View File

@@ -11,8 +11,9 @@ import io.anuke.arc.scene.ui.ImageButton;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.mindustry.entities.type.Player;
import io.anuke.mindustry.entities.type.TileEntity;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.type.Liquid;
import io.anuke.mindustry.ui.*;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
@@ -83,7 +84,7 @@ public class LiquidSource extends Block{
for(int i = 0; i < items.size; i++){
final int f = i;
ImageButton button = cont.addImageButton("clear", "clear-toggle-trans", 24, () -> control.input.frag.config.hideConfig()).size(38).group(group).get();
ImageButton button = cont.addImageButton(Tex.clear, Style.clearToggleTransIbutton, 24, () -> control.input.frag.config.hideConfig()).size(38).group(group).get();
button.changed(() -> {
Call.setLiquidSourceLiquid(null, tile, button.isChecked() ? items.get(f) : null);
control.input.frag.config.hideConfig();

View File

@@ -16,6 +16,7 @@ import io.anuke.mindustry.entities.units.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.ui.*;
import io.anuke.mindustry.world.*;
import io.anuke.mindustry.world.meta.*;
@@ -64,7 +65,7 @@ public class CommandCenter extends Block{
CommandCenterEntity entity = tile.entity();
super.draw(tile);
float size = iconsizesmall/4f;
float size = IconSize.small.size/4f;
Draw.color(bottomColor);
Draw.rect(commandRegions[entity.command.ordinal()], tile.drawx(), tile.drawy() - 1, size, size);
@@ -80,12 +81,12 @@ public class CommandCenter extends Block{
Table buttons = new Table();
for(UnitCommand cmd : UnitCommand.all){
buttons.addImageButton("icon-command-" + cmd.name() + "-small", "clear-toggle-trans", iconsizesmall, () -> Call.onCommandCenterSet(player, tile, cmd))
buttons.addImageButton(Core.atlas.drawable("icon-command-" + cmd.name() + "-small"), Style.clearToggleTransIbutton, () -> Call.onCommandCenterSet(player, tile, cmd))
.size(44).group(group).update(b -> b.setChecked(entity.command == cmd));
}
table.add(buttons);
table.row();
table.label(() -> entity.command.localized()).style("outline").center().growX().get().setAlignment(Align.center);
table.label(() -> entity.command.localized()).style(Style.outlineLabel).center().growX().get().setAlignment(Align.center);
}
@Remote(called = Loc.server, forward = true, targets = Loc.both)

View File

@@ -1,17 +1,18 @@
package io.anuke.mindustry.world.meta.values;
import io.anuke.arc.Core;
import io.anuke.arc.collection.ObjectMap;
import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.util.Strings;
import io.anuke.mindustry.content.StatusEffects;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.game.UnlockableContent;
import io.anuke.mindustry.type.Item;
import io.anuke.arc.*;
import io.anuke.arc.collection.*;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.*;
import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.entities.bullet.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.type.Item.Icon;
import io.anuke.mindustry.world.meta.StatValue;
import io.anuke.mindustry.world.meta.*;
import static io.anuke.mindustry.Vars.tilesize;
@@ -30,7 +31,7 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
BulletType type = map.get(t);
table.addImage(icon(t)).size(3 * 8).padRight(4).right().top();
table.add(t.localizedName()).padRight(10).left().top();
table.table("underline", bt -> {
table.table(Tex.underline, bt -> {
bt.left().defaults().padRight(3).left();
if(type.damage > 0){