UI cleanup
This commit is contained in:
@@ -17,7 +17,7 @@ public class BlockConfigFragment extends Fragment{
|
||||
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
table.visible(false);
|
||||
table.visible = false;
|
||||
parent.addChild(table);
|
||||
|
||||
//hacky way to hide block config when in menu
|
||||
@@ -27,7 +27,7 @@ public class BlockConfigFragment extends Fragment{
|
||||
public void act(float delta){
|
||||
super.act(delta);
|
||||
if(state.isMenu()){
|
||||
table.visible(false);
|
||||
table.visible = false;
|
||||
configTile = null;
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class BlockConfigFragment extends Fragment{
|
||||
}
|
||||
|
||||
public boolean isShown(){
|
||||
return table.isVisible() && configTile != null;
|
||||
return table.visible && configTile != null;
|
||||
}
|
||||
|
||||
public Building getSelectedTile(){
|
||||
@@ -46,7 +46,7 @@ public class BlockConfigFragment extends Fragment{
|
||||
if(tile.configTapped()){
|
||||
configTile = tile;
|
||||
|
||||
table.visible(true);
|
||||
table.visible = true;
|
||||
table.clear();
|
||||
tile.buildConfiguration(table);
|
||||
table.pack();
|
||||
|
||||
@@ -65,7 +65,7 @@ public class BlockInventoryFragment extends Fragment{
|
||||
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
table.setName("inventory");
|
||||
table.name = "inventory";
|
||||
table.setTransform(true);
|
||||
parent.setTransform(true);
|
||||
parent.addChild(table);
|
||||
@@ -90,7 +90,7 @@ public class BlockInventoryFragment extends Fragment{
|
||||
table.clearListeners();
|
||||
table.update(null);
|
||||
}), Actions.visible(false));
|
||||
table.touchable(Touchable.disabled);
|
||||
table.touchable = Touchable.disabled;
|
||||
tile = null;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class BlockInventoryFragment extends Fragment{
|
||||
table.clearChildren();
|
||||
table.clearActions();
|
||||
table.background(Tex.inventory);
|
||||
table.touchable(Touchable.enabled);
|
||||
table.touchable = Touchable.enabled;
|
||||
table.update(() -> {
|
||||
|
||||
if(state.isMenu() || tile == null || !tile.isValid() || !tile.block().isAccessible() || emptyTime >= holdShrink){
|
||||
@@ -209,7 +209,7 @@ public class BlockInventoryFragment extends Fragment{
|
||||
|
||||
updateTablePosition();
|
||||
|
||||
table.visible(true);
|
||||
table.visible = true;
|
||||
|
||||
if(actions){
|
||||
table.setScale(0f, 1f);
|
||||
|
||||
@@ -131,8 +131,8 @@ public class ChatFragment extends Table{
|
||||
|
||||
float spacing = chatspace;
|
||||
|
||||
chatfield.visible(shown);
|
||||
fieldlabel.visible(shown);
|
||||
chatfield.visible = shown;
|
||||
fieldlabel.visible = shown;
|
||||
|
||||
Draw.color(shadowColor);
|
||||
Draw.alpha(shadowColor.a * opacity);
|
||||
|
||||
@@ -16,7 +16,7 @@ public class FadeInFragment extends Fragment{
|
||||
parent.addChild(new Element(){
|
||||
{
|
||||
setFillParent(true);
|
||||
touchable(Touchable.disabled);
|
||||
this.touchable = Touchable.disabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -69,14 +69,14 @@ public class HudFragment extends Fragment{
|
||||
|
||||
//paused table
|
||||
parent.fill(t -> {
|
||||
t.top().visible(() -> state.isPaused() && !state.isOutOfTime()).touchable(Touchable.disabled);
|
||||
t.top().visible(() -> state.isPaused() && !state.isOutOfTime()).touchable = Touchable.disabled;
|
||||
t.table(Styles.black5, top -> top.add("$paused").style(Styles.outlineLabel).pad(8f)).growX();
|
||||
});
|
||||
|
||||
//TODO tear this all down
|
||||
//menu at top left
|
||||
parent.fill(cont -> {
|
||||
cont.setName("overlaymarker");
|
||||
cont.name = "overlaymarker";
|
||||
cont.top().left();
|
||||
|
||||
if(mobile){
|
||||
@@ -189,7 +189,7 @@ public class HudFragment extends Fragment{
|
||||
|
||||
//fps display
|
||||
cont.table(info -> {
|
||||
info.touchable(Touchable.disabled);
|
||||
info.touchable = Touchable.disabled;
|
||||
info.top().left().margin(4).visible(() -> Core.settings.getBool("fps") && shown);
|
||||
info.update(() -> info.setTranslation(state.rules.waves || state.isEditor() ? 0f : -Scl.scl(dsize * 4 + 3), 0));
|
||||
IntFormat fps = new IntFormat("fps");
|
||||
@@ -221,7 +221,7 @@ public class HudFragment extends Fragment{
|
||||
|
||||
//spawner warning
|
||||
parent.fill(t -> {
|
||||
t.touchable(Touchable.disabled);
|
||||
t.touchable = Touchable.disabled;
|
||||
t.table(Styles.black, 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))
|
||||
@@ -235,7 +235,7 @@ public class HudFragment extends Fragment{
|
||||
|
||||
//'core is under attack' table
|
||||
parent.fill(t -> {
|
||||
t.touchable(Touchable.disabled);
|
||||
t.touchable = Touchable.disabled;
|
||||
float notifDuration = 240f;
|
||||
float[] coreAttackTime = {0};
|
||||
float[] coreAttackOpacity = {0};
|
||||
@@ -250,7 +250,7 @@ public class HudFragment extends Fragment{
|
||||
return false;
|
||||
}
|
||||
|
||||
t.getColor().a = coreAttackOpacity[0];
|
||||
t.color.a = coreAttackOpacity[0];
|
||||
if(coreAttackTime[0] > 0){
|
||||
coreAttackOpacity[0] = Mathf.lerpDelta(coreAttackOpacity[0], 1f, 0.1f);
|
||||
}else{
|
||||
@@ -262,7 +262,7 @@ public class HudFragment extends Fragment{
|
||||
return coreAttackOpacity[0] > 0;
|
||||
});
|
||||
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);
|
||||
.update(label -> label.color.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time(), 2f, 1f)))).touchable(Touchable.disabled);
|
||||
});
|
||||
|
||||
//paused table for when the player is out of time
|
||||
@@ -324,7 +324,7 @@ public class HudFragment extends Fragment{
|
||||
showHudText = false;
|
||||
}
|
||||
});
|
||||
p.touchable(Touchable.disabled);
|
||||
p.touchable = Touchable.disabled;
|
||||
});
|
||||
|
||||
//TODO DEBUG: rate table
|
||||
@@ -519,7 +519,7 @@ public class HudFragment extends Fragment{
|
||||
|
||||
public void showLaunchDirect(){
|
||||
Image image = new Image();
|
||||
image.getColor().a = 0f;
|
||||
image.color.a = 0f;
|
||||
image.setFillParent(true);
|
||||
image.actions(Actions.fadeIn(launchDuration / 60f, Interp.pow2In), Actions.delay(8f / 60f), Actions.remove());
|
||||
Core.scene.add(image);
|
||||
@@ -527,7 +527,7 @@ public class HudFragment extends Fragment{
|
||||
|
||||
public void showLaunch(){
|
||||
Image image = new Image();
|
||||
image.getColor().a = 0f;
|
||||
image.color.a = 0f;
|
||||
image.setFillParent(true);
|
||||
image.actions(Actions.fadeIn(40f / 60f));
|
||||
image.update(() -> {
|
||||
@@ -540,8 +540,8 @@ public class HudFragment extends Fragment{
|
||||
|
||||
public void showLand(){
|
||||
Image image = new Image();
|
||||
image.getColor().a = 1f;
|
||||
image.touchable(Touchable.disabled);
|
||||
image.color.a = 1f;
|
||||
image.touchable = Touchable.disabled;
|
||||
image.setFillParent(true);
|
||||
image.actions(Actions.fadeOut(0.8f), Actions.remove());
|
||||
image.update(() -> {
|
||||
@@ -614,11 +614,11 @@ public class HudFragment extends Fragment{
|
||||
});
|
||||
|
||||
table.clearChildren();
|
||||
table.touchable(Touchable.enabled);
|
||||
table.touchable = Touchable.enabled;
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
table.setName("waves");
|
||||
table.name = "waves";
|
||||
table.labelWrap(() -> {
|
||||
builder.setLength(0);
|
||||
builder.append(wavef.get(state.wave));
|
||||
|
||||
@@ -18,8 +18,8 @@ public class LoadingFragment extends Fragment{
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
parent.fill(Styles.black8, t -> {
|
||||
t.visible(false);
|
||||
t.touchable(Touchable.enabled);
|
||||
t.visible = false;
|
||||
t.touchable = Touchable.enabled;
|
||||
t.add().height(133f).row();
|
||||
t.add(new WarningBar()).growX().height(24f);
|
||||
t.row();
|
||||
@@ -37,12 +37,12 @@ public class LoadingFragment extends Fragment{
|
||||
|
||||
public void setProgress(Floatp progress){
|
||||
bar.reset(0f);
|
||||
bar.visible(true);
|
||||
bar.visible = true;
|
||||
bar.set(() -> ((int)(progress.get() * 100) + "%"), progress, Pal.accent);
|
||||
}
|
||||
|
||||
public void setButton(Runnable listener){
|
||||
button.visible(true);
|
||||
button.visible = true;
|
||||
button.getListeners().remove(button.getListeners().size - 1);
|
||||
button.clicked(listener);
|
||||
}
|
||||
@@ -58,19 +58,19 @@ public class LoadingFragment extends Fragment{
|
||||
|
||||
public void show(String text){
|
||||
table.<Label>find("namelabel").setColor(Color.white);
|
||||
bar.visible(false);
|
||||
bar.visible = false;
|
||||
table.clearActions();
|
||||
table.touchable(Touchable.enabled);
|
||||
table.touchable = Touchable.enabled;
|
||||
table.<Label>find("namelabel").setText(text);
|
||||
table.visible(true);
|
||||
table.getColor().a = 1f;
|
||||
table.visible = true;
|
||||
table.color.a = 1f;
|
||||
table.toFront();
|
||||
}
|
||||
|
||||
public void hide(){
|
||||
table.clearActions();
|
||||
table.toFront();
|
||||
table.touchable(Touchable.disabled);
|
||||
table.touchable = Touchable.disabled;
|
||||
table.actions(Actions.fadeOut(0.5f), Actions.visible(false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class MenuFragment extends Fragment{
|
||||
|
||||
Fonts.def.setColor(Color.white);
|
||||
Fonts.def.draw(versionText, fx, fy - logoh/2f, Align.center);
|
||||
}).touchable(Touchable.disabled);
|
||||
}).touchable = Touchable.disabled;
|
||||
}
|
||||
|
||||
private void buildMobile(){
|
||||
@@ -184,7 +184,7 @@ public class MenuFragment extends Fragment{
|
||||
|
||||
container.table(background, t -> {
|
||||
submenu = t;
|
||||
t.getColor().a = 0f;
|
||||
t.color.a = 0f;
|
||||
t.top();
|
||||
t.defaults().width(width).height(70f);
|
||||
t.visible(() -> !t.getChildren().isEmpty());
|
||||
|
||||
@@ -54,7 +54,7 @@ public class MinimapFragment extends Fragment{
|
||||
shown = false;
|
||||
}
|
||||
});
|
||||
elem.touchable(Touchable.enabled);
|
||||
elem.touchable = Touchable.enabled;
|
||||
|
||||
elem.addListener(new ElementGestureListener(){
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class OverlayFragment{
|
||||
private WidgetGroup group = new WidgetGroup();
|
||||
|
||||
public OverlayFragment(){
|
||||
group.touchable(Touchable.childrenOnly);
|
||||
group.touchable = Touchable.childrenOnly;
|
||||
inv = new BlockInventoryFragment();
|
||||
config = new BlockConfigFragment();
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class PlacementFragment extends Fragment{
|
||||
|
||||
void rebuild(){
|
||||
currentCategory = Category.turret;
|
||||
Group group = toggler.getParent();
|
||||
Group group = toggler.parent;
|
||||
int index = toggler.getZIndex();
|
||||
toggler.remove();
|
||||
build(group);
|
||||
|
||||
@@ -122,8 +122,8 @@ public class ScriptConsoleFragment extends Table{
|
||||
|
||||
float spacing = chatspace;
|
||||
|
||||
chatfield.visible(open);
|
||||
fieldlabel.visible(open);
|
||||
chatfield.visible = open;
|
||||
fieldlabel.visible = open;
|
||||
|
||||
Draw.color(shadowColor);
|
||||
Draw.alpha(shadowColor.a * opacity);
|
||||
|
||||
Reference in New Issue
Block a user