WIP style refactoring

This commit is contained in:
Anuken 2022-05-04 20:24:59 -04:00
parent 705b419799
commit 93d299716c
19 changed files with 48 additions and 32 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 B

After

Width:  |  Height:  |  Size: 969 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 701 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

View File

@ -1330,7 +1330,7 @@ public class Blocks{
//TODO should have a useful turret ammo byproduct? scrap?
//TODO surge being removed I think
surgeCrucible = new HeatCrafter("surge-crucible"){{
requirements(Category.crafting, with(Items.silicon, 100, Items.graphite, 80, Items.carbide, 60, Items.thorium, 90));
requirements(Category.crafting, with(Items.silicon, 100, Items.graphite, 80, Items.carbide, 60, Items.thorium, 120, Items.phaseFabric, 80));
size = 3;

View File

@ -642,14 +642,14 @@ public class MapEditorDialog extends Dialog implements Disposable{
if(!mobile){
mid.table(t -> {
t.button("@editor.center", Icon.move, Styles.cleart, view::center).growX().margin(9f);
t.button("@editor.center", Icon.move, Styles.flatt, view::center).growX().margin(9f);
}).growX().top();
}
mid.row();
mid.table(t -> {
t.button("@editor.cliffs", Icon.terrain, Styles.cleart, editor::addCliffs).growX().margin(9f);
t.button("@editor.cliffs", Icon.terrain, Styles.flatt, editor::addCliffs).growX().margin(9f);
}).growX().top();
}).margin(0).left().growY();

View File

@ -63,7 +63,7 @@ public class MapGenerateDialog extends BaseDialog{
shown(this::setup);
addCloseListener();
var style = Styles.cleart;
var style = Styles.flatt;
buttons.defaults().size(180f, 64f).pad(2f);
buttons.button("@back", Icon.left, this::hide);
@ -334,7 +334,7 @@ public class MapGenerateDialog extends BaseDialog{
if(filter.isPost() && applied) continue;
p.button((icon == '\0' ? "" : icon + " ") + filter.name(), Styles.cleart, () -> {
p.button((icon == '\0' ? "" : icon + " ") + filter.name(), Styles.flatt, () -> {
filter.randomize();
filters.add(filter);
rebuildFilters();
@ -344,7 +344,7 @@ public class MapGenerateDialog extends BaseDialog{
if(++i % 3 == 0) p.row();
}
p.button(Iconc.refresh + " " + Core.bundle.get("filter.defaultores"), Styles.cleart, () -> {
p.button(Iconc.refresh + " " + Core.bundle.get("filter.defaultores"), Styles.flatt, () -> {
maps.addDefaultOres(filters);
rebuildFilters();
update();

View File

@ -181,7 +181,7 @@ public class WaveGraph extends Table{
colors.clear();
colors.left();
colors.button("@waves.units.hide", Styles.cleart, () -> {
colors.button("@waves.units.hide", Styles.flatt, () -> {
if(hidden.size == usedCopy.size){
hidden.clear();
}else{

View File

@ -80,7 +80,7 @@ public class WaveInfoDialog extends BaseDialog{
dialog.addCloseButton();
dialog.setFillParent(false);
dialog.cont.table(Tex.button, t -> {
var style = Styles.cleart;
var style = Styles.flatt;
t.defaults().size(210f, 58f);
t.button("@waves.copy", Icon.copy, style, () -> {

View File

@ -516,7 +516,7 @@ public class LStatements{
//sensors
new Table(i -> {
for(LAccess sensor : LAccess.senseable){
i.button(sensor.name(), Styles.cleart, () -> {
i.button(sensor.name(), Styles.flatt, () -> {
stype("@" + sensor.name());
hide.run();
}).size(240f, 40f).self(c -> tooltip(c, sensor)).row();

View File

@ -43,7 +43,7 @@ public class LogicDialog extends BaseDialog{
dialog.cont.pane(p -> {
p.margin(10f);
p.table(Tex.button, t -> {
TextButtonStyle style = Styles.cleart;
TextButtonStyle style = Styles.flatt;
t.defaults().size(280f, 60f).left();
t.button("@schematic.copy", Icon.copy, style, () -> {
@ -159,7 +159,7 @@ public class LogicDialog extends BaseDialog{
LStatement example = prov.get();
if(example instanceof InvalidStatement || example.hidden() || (example.privileged() && !privileged) || (example.nonPrivileged() && privileged)) continue;
TextButtonStyle style = new TextButtonStyle(Styles.cleart);
TextButtonStyle style = new TextButtonStyle(Styles.flatt);
style.fontColor = example.color();
style.font = Fonts.outline;

View File

@ -28,8 +28,23 @@ public class Styles{
public static ButtonStyle defaultb, underlineb;
public static TextButtonStyle defaultt, nodet, cleart, nonet, clearPartialt, clearTogglet, logicTogglet, clearToggleMenut, togglet, transt, fullTogglet, squareTogglet, logict;
/** Default text button style - gray corners at 45 degrees. */
public static TextButtonStyle defaultt,
/** Flat, square, opaque. */
flatt,
/** No background whatsoever, only text. */
nonet,
clearPartialt,
clearTogglet,
logicTogglet,
clearToggleMenut,
togglet, transt,
fullTogglet,
squareTogglet,
logict;
public static ImageButtonStyle defaulti, nodei, emptyi, emptytogglei, selecti, logici, geni, colori, accenti, cleari, clearFulli, clearPartiali, clearTogglei, clearTransi, clearToggleTransi, clearTogglePartiali;
public static ScrollPaneStyle defaultPane, horizontalPane, smallPane, noBarPane;
public static SliderStyle defaultSlider;
public static LabelStyle defaultLabel, outlineLabel, techLabel;
@ -75,14 +90,6 @@ public class Styles{
down = buttonDown;
up = button;
}};
nodet = new TextButtonStyle(){{
disabled = button;
font = Fonts.def;
fontColor = Color.white;
disabledFontColor = Color.gray;
up = buttonOver;
over = buttonDown;
}};
nonet = new TextButtonStyle(){{
font = Fonts.outline;
fontColor = Color.lightGray;
@ -90,7 +97,7 @@ public class Styles{
disabledFontColor = Color.gray;
up = none;
}};
cleart = new TextButtonStyle(){{
flatt = new TextButtonStyle(){{
over = flatOver;
font = Fonts.def;
fontColor = Color.white;

View File

@ -445,7 +445,7 @@ public class CustomRulesDialog extends BaseDialog{
for(Weather weather : content.<Weather>getBy(ContentType.weather)){
if(weather.hidden) continue;
t.button(weather.localizedName, Styles.cleart, () -> {
t.button(weather.localizedName, Styles.flatt, () -> {
rules.weather.add(new WeatherEntry(weather));
rebuild[0].run();

View File

@ -103,7 +103,7 @@ public class LoadDialog extends BaseDialog{
any = true;
TextButton button = new TextButton("", Styles.cleart);
TextButton button = new TextButton("", Styles.flatt);
button.getLabel().remove();
button.clearChildren();

View File

@ -89,12 +89,12 @@ public class LoadoutDialog extends BaseDialog{
for(ItemStack stack : stacks){
items.table(Tex.pane, t -> {
t.margin(4).marginRight(8).left();
t.button("-", Styles.cleart, () -> {
t.button("-", Styles.flatt, () -> {
stack.amount = Math.max(stack.amount - step(stack.amount), 0);
updater.run();
}).size(bsize);
t.button("+", Styles.cleart, () -> {
t.button("+", Styles.flatt, () -> {
stack.amount = Math.min(stack.amount + step(stack.amount), capacity);
updater.run();
}).size(bsize);

View File

@ -180,7 +180,7 @@ public class MapsDialog extends BaseDialog{
mapTable.row();
}
TextButton button = mapTable.button("", Styles.cleart, () -> showMapInfo(map)).width(mapsize).pad(8).get();
TextButton button = mapTable.button("", Styles.flatt, () -> showMapInfo(map)).width(mapsize).pad(8).get();
button.clearChildren();
button.margin(9);
button.add(map.name()).width(mapsize - 18f).center().get().setEllipsis(true);

View File

@ -160,7 +160,7 @@ public class ModsDialog extends BaseDialog{
buttons.button("@mod.import", Icon.add, style, () -> {
BaseDialog dialog = new BaseDialog("@mod.import");
TextButtonStyle bstyle = Styles.cleart;
TextButtonStyle bstyle = Styles.flatt;
dialog.cont.table(Tex.button, t -> {
t.defaults().size(300f, 70f);

View File

@ -11,6 +11,7 @@ import arc.scene.actions.*;
import arc.scene.event.*;
import arc.scene.style.*;
import arc.scene.ui.*;
import arc.scene.ui.TextButton.*;
import arc.scene.ui.layout.*;
import arc.struct.*;
import arc.util.*;
@ -30,6 +31,7 @@ import mindustry.ui.layout.TreeLayout.*;
import java.util.*;
import static mindustry.Vars.*;
import static mindustry.gen.Tex.*;
public class ResearchDialog extends BaseDialog{
public static boolean debugShowRequirements = false;
@ -667,7 +669,14 @@ public class ResearchDialog extends BaseDialog{
if(mobile && locked(node)){
b.row();
b.button("@research", Icon.ok, Styles.nodet, () -> spend(node))
b.button("@research", Icon.ok, new TextButtonStyle(){{
disabled = Tex.button;
font = Fonts.def;
fontColor = Color.white;
disabledFontColor = Color.gray;
up = buttonOver;
over = buttonDown;
}}, () -> spend(node))
.disabled(i -> !canSpend(node)).growX().height(44f).colspan(3);
}
});

View File

@ -258,7 +258,7 @@ public class SchematicsDialog extends BaseDialog{
dialog.cont.pane(p -> {
p.margin(10f);
p.table(Tex.button, t -> {
TextButtonStyle style = Styles.cleart;
TextButtonStyle style = Styles.flatt;
t.defaults().size(280f, 60f).left();
t.row();
t.button("@schematic.copy.import", Icon.copy, style, () -> {
@ -309,7 +309,7 @@ public class SchematicsDialog extends BaseDialog{
dialog.cont.pane(p -> {
p.margin(10f);
p.table(Tex.button, t -> {
TextButtonStyle style = Styles.cleart;
TextButtonStyle style = Styles.flatt;
t.defaults().size(280f, 60f).left();
if(steam && !s.hasSteamID()){
t.button("@schematic.shareworkshop", Icon.book, style,

View File

@ -85,7 +85,7 @@ public class SettingsMenuDialog extends BaseDialog{
dataDialog.cont.table(Tex.button, t -> {
t.defaults().size(280f, 60f).left();
TextButtonStyle style = Styles.cleart;
TextButtonStyle style = Styles.flatt;
t.button("@settings.cleardata", Icon.trash, style, () -> ui.showConfirm("@confirm", "@settings.clearall.confirm", () -> {
ObjectMap<String, Object> map = new ObjectMap<>();
@ -248,7 +248,7 @@ public class SettingsMenuDialog extends BaseDialog{
void rebuildMenu(){
menu.clearChildren();
TextButtonStyle style = Styles.cleart;
TextButtonStyle style = Styles.flatt;
menu.defaults().size(300f, 60f);
menu.button("@settings.game", style, () -> visible(0));