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.
+1 -1
View File
@@ -1330,7 +1330,7 @@ public class Blocks{
//TODO should have a useful turret ammo byproduct? scrap? //TODO should have a useful turret ammo byproduct? scrap?
//TODO surge being removed I think //TODO surge being removed I think
surgeCrucible = new HeatCrafter("surge-crucible"){{ 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; size = 3;
@@ -642,14 +642,14 @@ public class MapEditorDialog extends Dialog implements Disposable{
if(!mobile){ if(!mobile){
mid.table(t -> { 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(); }).growX().top();
} }
mid.row(); mid.row();
mid.table(t -> { 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(); }).growX().top();
}).margin(0).left().growY(); }).margin(0).left().growY();
@@ -63,7 +63,7 @@ public class MapGenerateDialog extends BaseDialog{
shown(this::setup); shown(this::setup);
addCloseListener(); addCloseListener();
var style = Styles.cleart; var style = Styles.flatt;
buttons.defaults().size(180f, 64f).pad(2f); buttons.defaults().size(180f, 64f).pad(2f);
buttons.button("@back", Icon.left, this::hide); buttons.button("@back", Icon.left, this::hide);
@@ -334,7 +334,7 @@ public class MapGenerateDialog extends BaseDialog{
if(filter.isPost() && applied) continue; 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(); filter.randomize();
filters.add(filter); filters.add(filter);
rebuildFilters(); rebuildFilters();
@@ -344,7 +344,7 @@ public class MapGenerateDialog extends BaseDialog{
if(++i % 3 == 0) p.row(); 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); maps.addDefaultOres(filters);
rebuildFilters(); rebuildFilters();
update(); update();
+1 -1
View File
@@ -181,7 +181,7 @@ public class WaveGraph extends Table{
colors.clear(); colors.clear();
colors.left(); colors.left();
colors.button("@waves.units.hide", Styles.cleart, () -> { colors.button("@waves.units.hide", Styles.flatt, () -> {
if(hidden.size == usedCopy.size){ if(hidden.size == usedCopy.size){
hidden.clear(); hidden.clear();
}else{ }else{
@@ -80,7 +80,7 @@ public class WaveInfoDialog extends BaseDialog{
dialog.addCloseButton(); dialog.addCloseButton();
dialog.setFillParent(false); dialog.setFillParent(false);
dialog.cont.table(Tex.button, t -> { dialog.cont.table(Tex.button, t -> {
var style = Styles.cleart; var style = Styles.flatt;
t.defaults().size(210f, 58f); t.defaults().size(210f, 58f);
t.button("@waves.copy", Icon.copy, style, () -> { t.button("@waves.copy", Icon.copy, style, () -> {
+1 -1
View File
@@ -516,7 +516,7 @@ public class LStatements{
//sensors //sensors
new Table(i -> { new Table(i -> {
for(LAccess sensor : LAccess.senseable){ for(LAccess sensor : LAccess.senseable){
i.button(sensor.name(), Styles.cleart, () -> { i.button(sensor.name(), Styles.flatt, () -> {
stype("@" + sensor.name()); stype("@" + sensor.name());
hide.run(); hide.run();
}).size(240f, 40f).self(c -> tooltip(c, sensor)).row(); }).size(240f, 40f).self(c -> tooltip(c, sensor)).row();
+2 -2
View File
@@ -43,7 +43,7 @@ public class LogicDialog extends BaseDialog{
dialog.cont.pane(p -> { dialog.cont.pane(p -> {
p.margin(10f); p.margin(10f);
p.table(Tex.button, t -> { p.table(Tex.button, t -> {
TextButtonStyle style = Styles.cleart; TextButtonStyle style = Styles.flatt;
t.defaults().size(280f, 60f).left(); t.defaults().size(280f, 60f).left();
t.button("@schematic.copy", Icon.copy, style, () -> { t.button("@schematic.copy", Icon.copy, style, () -> {
@@ -159,7 +159,7 @@ public class LogicDialog extends BaseDialog{
LStatement example = prov.get(); LStatement example = prov.get();
if(example instanceof InvalidStatement || example.hidden() || (example.privileged() && !privileged) || (example.nonPrivileged() && privileged)) continue; 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.fontColor = example.color();
style.font = Fonts.outline; style.font = Fonts.outline;
+17 -10
View File
@@ -28,8 +28,23 @@ public class Styles{
public static ButtonStyle defaultb, underlineb; 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 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 ScrollPaneStyle defaultPane, horizontalPane, smallPane, noBarPane;
public static SliderStyle defaultSlider; public static SliderStyle defaultSlider;
public static LabelStyle defaultLabel, outlineLabel, techLabel; public static LabelStyle defaultLabel, outlineLabel, techLabel;
@@ -75,14 +90,6 @@ public class Styles{
down = buttonDown; down = buttonDown;
up = button; up = button;
}}; }};
nodet = new TextButtonStyle(){{
disabled = button;
font = Fonts.def;
fontColor = Color.white;
disabledFontColor = Color.gray;
up = buttonOver;
over = buttonDown;
}};
nonet = new TextButtonStyle(){{ nonet = new TextButtonStyle(){{
font = Fonts.outline; font = Fonts.outline;
fontColor = Color.lightGray; fontColor = Color.lightGray;
@@ -90,7 +97,7 @@ public class Styles{
disabledFontColor = Color.gray; disabledFontColor = Color.gray;
up = none; up = none;
}}; }};
cleart = new TextButtonStyle(){{ flatt = new TextButtonStyle(){{
over = flatOver; over = flatOver;
font = Fonts.def; font = Fonts.def;
fontColor = Color.white; fontColor = Color.white;
@@ -445,7 +445,7 @@ public class CustomRulesDialog extends BaseDialog{
for(Weather weather : content.<Weather>getBy(ContentType.weather)){ for(Weather weather : content.<Weather>getBy(ContentType.weather)){
if(weather.hidden) continue; if(weather.hidden) continue;
t.button(weather.localizedName, Styles.cleart, () -> { t.button(weather.localizedName, Styles.flatt, () -> {
rules.weather.add(new WeatherEntry(weather)); rules.weather.add(new WeatherEntry(weather));
rebuild[0].run(); rebuild[0].run();
@@ -103,7 +103,7 @@ public class LoadDialog extends BaseDialog{
any = true; any = true;
TextButton button = new TextButton("", Styles.cleart); TextButton button = new TextButton("", Styles.flatt);
button.getLabel().remove(); button.getLabel().remove();
button.clearChildren(); button.clearChildren();
@@ -89,12 +89,12 @@ public class LoadoutDialog extends BaseDialog{
for(ItemStack stack : stacks){ for(ItemStack stack : stacks){
items.table(Tex.pane, t -> { items.table(Tex.pane, t -> {
t.margin(4).marginRight(8).left(); t.margin(4).marginRight(8).left();
t.button("-", Styles.cleart, () -> { t.button("-", Styles.flatt, () -> {
stack.amount = Math.max(stack.amount - step(stack.amount), 0); stack.amount = Math.max(stack.amount - step(stack.amount), 0);
updater.run(); updater.run();
}).size(bsize); }).size(bsize);
t.button("+", Styles.cleart, () -> { t.button("+", Styles.flatt, () -> {
stack.amount = Math.min(stack.amount + step(stack.amount), capacity); stack.amount = Math.min(stack.amount + step(stack.amount), capacity);
updater.run(); updater.run();
}).size(bsize); }).size(bsize);
@@ -180,7 +180,7 @@ public class MapsDialog extends BaseDialog{
mapTable.row(); 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.clearChildren();
button.margin(9); button.margin(9);
button.add(map.name()).width(mapsize - 18f).center().get().setEllipsis(true); button.add(map.name()).width(mapsize - 18f).center().get().setEllipsis(true);
@@ -160,7 +160,7 @@ public class ModsDialog extends BaseDialog{
buttons.button("@mod.import", Icon.add, style, () -> { buttons.button("@mod.import", Icon.add, style, () -> {
BaseDialog dialog = new BaseDialog("@mod.import"); BaseDialog dialog = new BaseDialog("@mod.import");
TextButtonStyle bstyle = Styles.cleart; TextButtonStyle bstyle = Styles.flatt;
dialog.cont.table(Tex.button, t -> { dialog.cont.table(Tex.button, t -> {
t.defaults().size(300f, 70f); t.defaults().size(300f, 70f);
@@ -11,6 +11,7 @@ import arc.scene.actions.*;
import arc.scene.event.*; import arc.scene.event.*;
import arc.scene.style.*; import arc.scene.style.*;
import arc.scene.ui.*; import arc.scene.ui.*;
import arc.scene.ui.TextButton.*;
import arc.scene.ui.layout.*; import arc.scene.ui.layout.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*; import arc.util.*;
@@ -30,6 +31,7 @@ import mindustry.ui.layout.TreeLayout.*;
import java.util.*; import java.util.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
import static mindustry.gen.Tex.*;
public class ResearchDialog extends BaseDialog{ public class ResearchDialog extends BaseDialog{
public static boolean debugShowRequirements = false; public static boolean debugShowRequirements = false;
@@ -667,7 +669,14 @@ public class ResearchDialog extends BaseDialog{
if(mobile && locked(node)){ if(mobile && locked(node)){
b.row(); 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); .disabled(i -> !canSpend(node)).growX().height(44f).colspan(3);
} }
}); });
@@ -258,7 +258,7 @@ public class SchematicsDialog extends BaseDialog{
dialog.cont.pane(p -> { dialog.cont.pane(p -> {
p.margin(10f); p.margin(10f);
p.table(Tex.button, t -> { p.table(Tex.button, t -> {
TextButtonStyle style = Styles.cleart; TextButtonStyle style = Styles.flatt;
t.defaults().size(280f, 60f).left(); t.defaults().size(280f, 60f).left();
t.row(); t.row();
t.button("@schematic.copy.import", Icon.copy, style, () -> { t.button("@schematic.copy.import", Icon.copy, style, () -> {
@@ -309,7 +309,7 @@ public class SchematicsDialog extends BaseDialog{
dialog.cont.pane(p -> { dialog.cont.pane(p -> {
p.margin(10f); p.margin(10f);
p.table(Tex.button, t -> { p.table(Tex.button, t -> {
TextButtonStyle style = Styles.cleart; TextButtonStyle style = Styles.flatt;
t.defaults().size(280f, 60f).left(); t.defaults().size(280f, 60f).left();
if(steam && !s.hasSteamID()){ if(steam && !s.hasSteamID()){
t.button("@schematic.shareworkshop", Icon.book, style, t.button("@schematic.shareworkshop", Icon.book, style,
@@ -85,7 +85,7 @@ public class SettingsMenuDialog extends BaseDialog{
dataDialog.cont.table(Tex.button, t -> { dataDialog.cont.table(Tex.button, t -> {
t.defaults().size(280f, 60f).left(); 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", () -> { t.button("@settings.cleardata", Icon.trash, style, () -> ui.showConfirm("@confirm", "@settings.clearall.confirm", () -> {
ObjectMap<String, Object> map = new ObjectMap<>(); ObjectMap<String, Object> map = new ObjectMap<>();
@@ -248,7 +248,7 @@ public class SettingsMenuDialog extends BaseDialog{
void rebuildMenu(){ void rebuildMenu(){
menu.clearChildren(); menu.clearChildren();
TextButtonStyle style = Styles.cleart; TextButtonStyle style = Styles.flatt;
menu.defaults().size(300f, 60f); menu.defaults().size(300f, 60f);
menu.button("@settings.game", style, () -> visible(0)); menu.button("@settings.game", style, () -> visible(0));