WIP low-tier leg unit

This commit is contained in:
Anuken
2022-02-25 22:23:50 -05:00
parent 7245364a55
commit 7650226f25
20 changed files with 91 additions and 202 deletions

View File

@@ -18,7 +18,6 @@ import arc.scene.ui.TreeElement.*;
import mindustry.annotations.Annotations.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.ui.dialogs.*;
import static mindustry.gen.Tex.*;
@@ -26,11 +25,12 @@ import static mindustry.gen.Tex.*;
public class Styles{
//TODO all these names are inconsistent and not descriptive
public static Drawable black, black9, black8, black6, black3, black5, none, flatDown, flatOver, accentDrawable;
public static ButtonStyle defaultb, waveb, modsb, underlineb;
public static TextButtonStyle defaultt, squaret, nodet, cleart, discordt, nonet, infot, clearPartialt, clearTogglet, logicTogglet, clearToggleMenut, togglet, transt, fullTogglet, squareTogglet, logict;
public static ImageButtonStyle defaulti, nodei, righti, emptyi, emptytogglei, selecti, logici, geni, colori, accenti, cleari, clearFulli, clearPartiali, clearPartial2i, clearTogglei, clearTransi, clearToggleTransi, clearTogglePartiali;
public static ButtonStyle defaultb, underlineb;
public static TextButtonStyle defaultt, nodet, cleart, 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, nonePane;
public static KeybindDialog.KeybindDialogStyle defaultKeybindDialog;
public static SliderStyle defaultSlider;
public static LabelStyle defaultLabel, outlineLabel, techLabel;
public static TextFieldStyle defaultField, nodeField, areaField, nodeArea;
@@ -59,24 +59,12 @@ public class Styles{
disabled = buttonDisabled;
}};
modsb = new ButtonStyle(){{
down = flatOver;
up = underline;
over = underline2;
}};
underlineb = new ButtonStyle(){{
down = flatOver;
up = sideline;
over = sidelineOver;
checked = flatOver;
}};
waveb = new ButtonStyle(){{
up = wavepane;
over = wavepane; //TODO wrong
disabled = wavepane;
}};
defaultt = new TextButtonStyle(){{
over = buttonOver;
@@ -87,15 +75,6 @@ public class Styles{
down = buttonDown;
up = button;
}};
squaret = new TextButtonStyle(){{
font = Fonts.def;
fontColor = Color.white;
disabledFontColor = Color.gray;
over = buttonSquareOver;
disabled = buttonDisabled;
down = buttonSquareDown;
up = buttonSquare;
}};
nodet = new TextButtonStyle(){{
disabled = button;
font = Fonts.def;
@@ -127,16 +106,6 @@ public class Styles{
down = flatOver;
up = underlineWhite;
}};
discordt = new TextButtonStyle(){{
font = Fonts.def;
fontColor = Color.white;
up = discordBanner;
}};
infot = new TextButtonStyle(){{
font = Fonts.def;
fontColor = Color.white;
up = infoBanner;
}};
clearPartialt = new TextButtonStyle(){{
down = flatOver;
up = pane;
@@ -225,14 +194,6 @@ public class Styles{
up = buttonOver;
over = buttonDown;
}};
righti = new ImageButtonStyle(){{
over = buttonRightOver;
down = buttonRightDown;
up = buttonRight;
disabled = buttonRightDisabled;
imageDisabledColor = Color.clear;
imageUpColor = Color.white;
}};
emptyi = new ImageButtonStyle(){{
imageDownColor = Pal.accent;
imageOverColor = Color.lightGray;
@@ -282,11 +243,6 @@ public class Styles{
imageDisabledColor = Color.gray;
imageUpColor = Color.white;
}};
clearPartial2i = new ImageButtonStyle(){{
down = whiteui;
up = pane;
over = flatDown;
}};
clearTogglei = new ImageButtonStyle(){{
down = flatDown;
checked = flatDown;
@@ -330,12 +286,6 @@ public class Styles{
}};
nonePane = new ScrollPaneStyle();
defaultKeybindDialog = new KeybindDialog.KeybindDialogStyle(){{
keyColor = Pal.accent;
keyNameColor = Color.white;
controllerColor = Color.lightGray;
}};
defaultSlider = new SliderStyle(){{
background = sliderBack;
knob = sliderKnob;

View File

@@ -6,7 +6,6 @@ import arc.graphics.*;
import arc.input.*;
import arc.input.InputDevice.*;
import arc.scene.event.*;
import arc.scene.style.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*;
import arc.struct.*;
@@ -18,7 +17,6 @@ import mindustry.ui.*;
import static arc.Core.*;
public class KeybindDialog extends Dialog{
protected KeybindDialogStyle style;
protected Section section;
protected KeyBind rebindKey = null;
protected boolean rebindAxis = false;
@@ -30,7 +28,6 @@ public class KeybindDialog extends Dialog{
public KeybindDialog(){
super(bundle.get("keybind.title", "Rebind Keys"));
style = scene.getStyle(KeybindDialogStyle.class);
setup();
addCloseButton();
setFillParent(true);
@@ -48,11 +45,6 @@ public class KeybindDialog extends Dialog{
});
}
public void setStyle(KeybindDialogStyle style){
this.style = style;
setup();
}
private void setup(){
cont.clear();
@@ -124,7 +116,7 @@ public class KeybindDialog extends Dialog{
table.add().height(10);
table.row();
if(section.device.type() == DeviceType.controller){
table.table(info -> info.add("Controller Type: [#" + style.controllerColor.toString().toUpperCase() + "]" +
table.table(info -> info.add("Controller Type: [lightGray]" +
Strings.capitalize(section.device.name())).left());
}
table.row();
@@ -140,12 +132,12 @@ public class KeybindDialog extends Dialog{
}
if(keybind.defaultValue(section.device.type()) instanceof Axis){
table.add(bundle.get("keybind." + keybind.name() + ".name", Strings.capitalize(keybind.name())), style.keyNameColor).left().padRight(40).padLeft(8);
table.add(bundle.get("keybind." + keybind.name() + ".name", Strings.capitalize(keybind.name())), Color.white).left().padRight(40).padLeft(8);
table.labelWrap(() -> {
Axis axis = keybinds.get(section, keybind);
return axis.key != null ? axis.key.toString() : axis.min + " [red]/[] " + axis.max;
}).color(style.keyColor).left().minWidth(90).fillX().padRight(20);
}).color(Pal.accent).left().minWidth(90).fillX().padRight(20);
table.button("@settings.rebind", tstyle, () -> {
rebindAxis = true;
@@ -153,8 +145,8 @@ public class KeybindDialog extends Dialog{
openDialog(section, keybind);
}).width(130f);
}else{
table.add(bundle.get("keybind." + keybind.name() + ".name", Strings.capitalize(keybind.name())), style.keyNameColor).left().padRight(40).padLeft(8);
table.label(() -> keybinds.get(section, keybind).key.toString()).color(style.keyColor).left().minWidth(90).padRight(20);
table.add(bundle.get("keybind." + keybind.name() + ".name", Strings.capitalize(keybind.name())), Color.white).left().padRight(40).padLeft(8);
table.label(() -> keybinds.get(section, keybind).key.toString()).color(Pal.accent).left().minWidth(90).padRight(20);
table.button("@settings.rebind", tstyle, () -> {
rebindAxis = false;
@@ -239,10 +231,4 @@ public class KeybindDialog extends Dialog{
rebindDialog.show();
Time.runTask(1f, () -> getScene().setScrollFocus(rebindDialog));
}
public static class KeybindDialogStyle extends Style{
public Color keyColor = Color.white;
public Color keyNameColor = Color.white;
public Color controllerColor = Color.white;
}
}

View File

@@ -29,6 +29,7 @@ import mindustry.type.*;
import mindustry.ui.*;
import static mindustry.Vars.*;
import static mindustry.gen.Tex.*;
public class HudFragment extends Fragment{
private static final float dsize = 65f, pauseHeight = 36f;
@@ -199,8 +200,17 @@ public class HudFragment extends Fragment{
//wave info button with text
s.add(makeStatusTable()).grow().name("status");
var rightStyle = new ImageButtonStyle(){{
over = buttonRightOver;
down = buttonRightDown;
up = buttonRight;
disabled = buttonRightDisabled;
imageDisabledColor = Color.clear;
imageUpColor = Color.white;
}};
//table with button to skip wave
s.button(Icon.play, Styles.righti, 30f, () -> {
s.button(Icon.play, rightStyle, 30f, () -> {
if(net.client() && player.admin){
Call.adminRequest(player, AdminAction.wave);
}else{

View File

@@ -9,6 +9,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.util.*;
import mindustry.core.*;
@@ -18,6 +19,7 @@ import mindustry.graphics.*;
import mindustry.ui.*;
import static mindustry.Vars.*;
import static mindustry.gen.Tex.*;
public class MenuFragment extends Fragment{
private Table container, submenu;
@@ -52,8 +54,17 @@ public class MenuFragment extends Fragment{
//info icon
if(mobile){
parent.fill(c -> c.bottom().left().button("", Styles.infot, ui.about::show).size(84, 45).name("info"));
parent.fill(c -> c.bottom().right().button("", Styles.discordt, ui.discord::show).size(84, 45).name("discord"));
parent.fill(c -> c.bottom().left().button("", new TextButtonStyle(){{
font = Fonts.def;
fontColor = Color.white;
up = infoBanner;
}}, ui.about::show).size(84, 45).name("info"));
parent.fill(c -> c.bottom().right().button("", new TextButtonStyle(){{
font = Fonts.def;
fontColor = Color.white;
up = discordBanner;
}}, ui.discord::show).size(84, 45).name("discord"));
}else if(becontrol.active()){
parent.fill(c -> c.bottom().right().button("@be.check", Icon.refresh, () -> {
ui.loadfrag.show();