UI cleanup
This commit is contained in:
@@ -182,10 +182,10 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
Group group = Core.scene.root;
|
Group group = Core.scene.root;
|
||||||
|
|
||||||
menuGroup.setFillParent(true);
|
menuGroup.setFillParent(true);
|
||||||
menuGroup.touchable(Touchable.childrenOnly);
|
menuGroup.touchable = Touchable.childrenOnly;
|
||||||
menuGroup.visible(() -> state.isMenu());
|
menuGroup.visible(() -> state.isMenu());
|
||||||
hudGroup.setFillParent(true);
|
hudGroup.setFillParent(true);
|
||||||
hudGroup.touchable(Touchable.childrenOnly);
|
hudGroup.touchable = Touchable.childrenOnly;
|
||||||
hudGroup.visible(() -> state.isGame());
|
hudGroup.visible(() -> state.isGame());
|
||||||
|
|
||||||
Core.scene.add(menuGroup);
|
Core.scene.add(menuGroup);
|
||||||
@@ -292,7 +292,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
public void showInfoToast(String info, float duration){
|
public void showInfoToast(String info, float duration){
|
||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
table.setFillParent(true);
|
table.setFillParent(true);
|
||||||
table.touchable(Touchable.disabled);
|
table.touchable = Touchable.disabled;
|
||||||
table.update(() -> {
|
table.update(() -> {
|
||||||
if(state.isMenu()) table.remove();
|
if(state.isMenu()) table.remove();
|
||||||
});
|
});
|
||||||
@@ -305,7 +305,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
public void showInfoPopup(String info, float duration, int align, int top, int left, int bottom, int right){
|
public void showInfoPopup(String info, float duration, int align, int top, int left, int bottom, int right){
|
||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
table.setFillParent(true);
|
table.setFillParent(true);
|
||||||
table.touchable(Touchable.disabled);
|
table.touchable = Touchable.disabled;
|
||||||
table.update(() -> {
|
table.update(() -> {
|
||||||
if(state.isMenu()) table.remove();
|
if(state.isMenu()) table.remove();
|
||||||
});
|
});
|
||||||
@@ -318,7 +318,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
public void showLabel(String info, float duration, float worldx, float worldy){
|
public void showLabel(String info, float duration, float worldx, float worldy){
|
||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
table.setFillParent(true);
|
table.setFillParent(true);
|
||||||
table.touchable(Touchable.disabled);
|
table.touchable = Touchable.disabled;
|
||||||
table.update(() -> {
|
table.update(() -> {
|
||||||
if(state.isMenu()) table.remove();
|
if(state.isMenu()) table.remove();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
mode.setColor(Pal.remove);
|
mode.setColor(Pal.remove);
|
||||||
mode.update(() -> mode.setText(tool.mode == -1 ? "" : "M" + (tool.mode + 1) + " "));
|
mode.update(() -> mode.setText(tool.mode == -1 ? "" : "M" + (tool.mode + 1) + " "));
|
||||||
mode.setAlignment(Align.bottomRight, Align.bottomRight);
|
mode.setAlignment(Align.bottomRight, Align.bottomRight);
|
||||||
mode.touchable(Touchable.disabled);
|
mode.touchable = Touchable.disabled;
|
||||||
|
|
||||||
tools.stack(button, mode);
|
tools.stack(button, mode);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ public class MapGenerateDialog extends BaseDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void rebuildFilters(){
|
void rebuildFilters(){
|
||||||
int cols = Math.max((int)(Math.max(filterTable.getParent().getWidth(), Core.graphics.getWidth()/2f * 0.9f) / Scl.scl(290f)), 1);
|
int cols = Math.max((int)(Math.max(filterTable.parent.getWidth(), Core.graphics.getWidth()/2f * 0.9f) / Scl.scl(290f)), 1);
|
||||||
filterTable.clearChildren();
|
filterTable.clearChildren();
|
||||||
filterTable.top().left();
|
filterTable.top().left();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
Core.input.getInputProcessors().insert(0, new GestureDetector(20, 0.5f, 2, 0.15f, this));
|
Core.input.getInputProcessors().insert(0, new GestureDetector(20, 0.5f, 2, 0.15f, this));
|
||||||
touchable(Touchable.enabled);
|
this.touchable = Touchable.enabled;
|
||||||
|
|
||||||
Point2 firstTouch = new Point2();
|
Point2 firstTouch = new Point2();
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
}).growX().height(70f);
|
}).growX().height(70f);
|
||||||
}), new Label("$waves.none"){{
|
}), new Label("$waves.none"){{
|
||||||
visible(() -> groups.isEmpty());
|
visible(() -> groups.isEmpty());
|
||||||
touchable(Touchable.disabled);
|
this.touchable = Touchable.disabled;
|
||||||
setWrap(true);
|
setWrap(true);
|
||||||
setAlignment(Align.center, Align.center);
|
setAlignment(Align.center, Align.center);
|
||||||
}}).width(390f).growY();
|
}}).width(390f).growY();
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ public class DesktopInput extends InputHandler{
|
|||||||
group.fill(t -> {
|
group.fill(t -> {
|
||||||
t.bottom();
|
t.bottom();
|
||||||
t.visible(() -> {
|
t.visible(() -> {
|
||||||
t.getColor().a = Mathf.lerpDelta(t.getColor().a, player.builder().isBuilding() ? 1f : 0f, 0.15f);
|
t.color.a = Mathf.lerpDelta(t.color.a, player.builder().isBuilding() ? 1f : 0f, 0.15f);
|
||||||
|
|
||||||
return Core.settings.getBool("hints") && selectRequests.isEmpty() && t.getColor().a > 0.01f;
|
return Core.settings.getBool("hints") && selectRequests.isEmpty() && t.color.a > 0.01f;
|
||||||
});
|
});
|
||||||
t.touchable(() -> t.getColor().a < 0.1f ? Touchable.disabled : Touchable.childrenOnly);
|
t.touchable(() -> t.color.a < 0.1f ? Touchable.disabled : Touchable.childrenOnly);
|
||||||
t.table(Styles.black6, b -> {
|
t.table(Styles.black6, b -> {
|
||||||
b.defaults().left();
|
b.defaults().left();
|
||||||
b.label(() -> Core.bundle.format(!isBuilding ? "resumebuilding" : "pausebuilding", Core.keybinds.get(Binding.pause_building).key.toString())).style(Styles.outlineLabel);
|
b.label(() -> Core.bundle.format(!isBuilding ? "resumebuilding" : "pausebuilding", Core.keybinds.get(Binding.pause_building).key.toString())).style(Styles.outlineLabel);
|
||||||
|
|||||||
@@ -890,7 +890,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
uiGroup = new WidgetGroup();
|
uiGroup = new WidgetGroup();
|
||||||
uiGroup.touchable(Touchable.childrenOnly);
|
uiGroup.touchable = Touchable.childrenOnly;
|
||||||
uiGroup.setFillParent(true);
|
uiGroup.setFillParent(true);
|
||||||
ui.hudGroup.addChild(uiGroup);
|
ui.hudGroup.addChild(uiGroup);
|
||||||
buildUI(uiGroup);
|
buildUI(uiGroup);
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ public class BorderImage extends Image{
|
|||||||
public void draw(){
|
public void draw(){
|
||||||
super.draw();
|
super.draw();
|
||||||
|
|
||||||
float scaleX = getScaleX();
|
float scaleX = this.scaleX;
|
||||||
float scaleY = getScaleY();
|
float scaleY = this.scaleY;
|
||||||
|
|
||||||
Draw.color(borderColor);
|
Draw.color(borderColor);
|
||||||
Draw.alpha(parentAlpha);
|
Draw.alpha(parentAlpha);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class Minimap extends Table{
|
|||||||
public Minimap(){
|
public Minimap(){
|
||||||
background(Tex.pane);
|
background(Tex.pane);
|
||||||
float margin = 5f;
|
float margin = 5f;
|
||||||
touchable(Touchable.enabled);
|
this.touchable = Touchable.enabled;
|
||||||
|
|
||||||
add(new Element(){
|
add(new Element(){
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ public class MultiReqImage extends Stack{
|
|||||||
|
|
||||||
time += Time.delta / 60f;
|
time += Time.delta / 60f;
|
||||||
|
|
||||||
displays.each(req -> req.visible(false));
|
displays.each(req -> req.visible = false);
|
||||||
|
|
||||||
ReqImage valid = displays.find(ReqImage::valid);
|
ReqImage valid = displays.find(ReqImage::valid);
|
||||||
if(valid != null){
|
if(valid != null){
|
||||||
valid.visible(true);
|
valid.visible = true;
|
||||||
}else{
|
}else{
|
||||||
if(displays.size > 0){
|
if(displays.size > 0){
|
||||||
displays.get((int)(time) % displays.size).visible(true);
|
displays.get((int)time % displays.size).visible = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class DatabaseDialog extends BaseDialog{
|
|||||||
image.addListener(listener);
|
image.addListener(listener);
|
||||||
if(!Vars.mobile && unlocked(unlock)){
|
if(!Vars.mobile && unlocked(unlock)){
|
||||||
image.addListener(new HandCursorListener());
|
image.addListener(new HandCursorListener());
|
||||||
image.update(() -> image.getColor().lerp(!listener.isOver() ? Color.lightGray : Color.white, 0.4f * Time.delta));
|
image.update(() -> image.color.lerp(!listener.isOver() ? Color.lightGray : Color.white, 0.4f * Time.delta));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(unlocked(unlock)){
|
if(unlocked(unlock)){
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class FileChooser extends BaseDialog{
|
|||||||
cancel.clicked(this::hide);
|
cancel.clicked(this::hide);
|
||||||
|
|
||||||
navigation = new TextField("");
|
navigation = new TextField("");
|
||||||
navigation.touchable(Touchable.disabled);
|
navigation.touchable = Touchable.disabled;
|
||||||
|
|
||||||
files = new Table();
|
files = new Table();
|
||||||
files.marginRight(10);
|
files.marginRight(10);
|
||||||
|
|||||||
@@ -286,12 +286,12 @@ public class JoinDialog extends BaseDialog{
|
|||||||
pad = 6;
|
pad = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cell cell = ((Table)pane.getParent()).getCell(button);
|
Cell cell = ((Table)pane.parent).getCell(button);
|
||||||
|
|
||||||
if(!Mathf.equal(cell.minWidth(), pw)){
|
if(!Mathf.equal(cell.minWidth(), pw)){
|
||||||
cell.width(pw);
|
cell.width(pw);
|
||||||
cell.padLeft(pad);
|
cell.padLeft(pad);
|
||||||
pane.getParent().invalidateHierarchy();
|
pane.parent.invalidateHierarchy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -416,12 +416,12 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
stable.update(() -> {
|
stable.update(() -> {
|
||||||
if(selected != null){
|
if(selected != null){
|
||||||
if(launching){
|
if(launching){
|
||||||
stable.getColor().sub(0, 0, 0, 0.05f * Time.delta);
|
stable.color.sub(0, 0, 0, 0.05f * Time.delta);
|
||||||
}else{
|
}else{
|
||||||
//fade out UI when not facing selected sector
|
//fade out UI when not facing selected sector
|
||||||
Tmp.v31.set(selected.tile.v).rotate(Vec3.Y, -planets.planet.getRotation()).scl(-1f).nor();
|
Tmp.v31.set(selected.tile.v).rotate(Vec3.Y, -planets.planet.getRotation()).scl(-1f).nor();
|
||||||
float dot = planets.cam.direction.dot(Tmp.v31);
|
float dot = planets.cam.direction.dot(Tmp.v31);
|
||||||
stable.getColor().a = Math.max(dot, 0f)*2f;
|
stable.color.a = Math.max(dot, 0f)*2f;
|
||||||
if(dot*2f <= -0.1f){
|
if(dot*2f <= -0.1f){
|
||||||
stable.remove();
|
stable.remove();
|
||||||
selected = null;
|
selected = null;
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class ResearchDialog extends BaseDialog{
|
|||||||
addListener(new InputListener(){
|
addListener(new InputListener(){
|
||||||
@Override
|
@Override
|
||||||
public boolean scrolled(InputEvent event, float x, float y, float amountX, float amountY){
|
public boolean scrolled(InputEvent event, float x, float y, float amountX, float amountY){
|
||||||
view.setScale(Mathf.clamp(view.getScaleX() - amountY / 10f * view.getScaleX(), 0.25f, 1f));
|
view.setScale(Mathf.clamp(view.scaleX - amountY / 10f * view.scaleX, 0.25f, 1f));
|
||||||
view.setOrigin(Align.center);
|
view.setOrigin(Align.center);
|
||||||
view.setTransform(true);
|
view.setTransform(true);
|
||||||
return true;
|
return true;
|
||||||
@@ -81,7 +81,7 @@ public class ResearchDialog extends BaseDialog{
|
|||||||
@Override
|
@Override
|
||||||
public void zoom(InputEvent event, float initialDistance, float distance){
|
public void zoom(InputEvent event, float initialDistance, float distance){
|
||||||
if(view.lastZoom < 0){
|
if(view.lastZoom < 0){
|
||||||
view.lastZoom = view.getScaleX();
|
view.lastZoom = view.scaleX;
|
||||||
}
|
}
|
||||||
|
|
||||||
view.setScale(Mathf.clamp(distance / initialDistance * view.lastZoom, 0.25f, 1f));
|
view.setScale(Mathf.clamp(distance / initialDistance * view.lastZoom, 0.25f, 1f));
|
||||||
@@ -91,13 +91,13 @@ public class ResearchDialog extends BaseDialog{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void touchUp(InputEvent event, float x, float y, int pointer, KeyCode button){
|
public void touchUp(InputEvent event, float x, float y, int pointer, KeyCode button){
|
||||||
view.lastZoom = view.getScaleX();
|
view.lastZoom = view.scaleX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void pan(InputEvent event, float x, float y, float deltaX, float deltaY){
|
public void pan(InputEvent event, float x, float y, float deltaX, float deltaY){
|
||||||
view.panX += deltaX / view.getScaleX();
|
view.panX += deltaX / view.scaleX;
|
||||||
view.panY += deltaY / view.getScaleY();
|
view.panY += deltaY / view.scaleY;
|
||||||
view.moved = true;
|
view.moved = true;
|
||||||
view.clamp();
|
view.clamp();
|
||||||
}
|
}
|
||||||
@@ -180,7 +180,7 @@ public class ResearchDialog extends BaseDialog{
|
|||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
table.actions(Actions.fadeOut(0.5f, Interp.fade), Actions.remove());
|
table.actions(Actions.fadeOut(0.5f, Interp.fade), Actions.remove());
|
||||||
table.top().add(info);
|
table.top().add(info);
|
||||||
table.setName("toast");
|
table.name = "toast";
|
||||||
table.update(() -> {
|
table.update(() -> {
|
||||||
table.toFront();
|
table.toFront();
|
||||||
table.setPosition(Core.graphics.getWidth() / 2f, Core.graphics.getHeight() - 21, Align.top);
|
table.setPosition(Core.graphics.getWidth() / 2f, Core.graphics.getHeight() - 21, Align.top);
|
||||||
@@ -230,7 +230,7 @@ public class ResearchDialog extends BaseDialog{
|
|||||||
Table infoTable = new Table();
|
Table infoTable = new Table();
|
||||||
|
|
||||||
{
|
{
|
||||||
infoTable.touchable(Touchable.enabled);
|
infoTable.touchable = Touchable.enabled;
|
||||||
|
|
||||||
for(TechTreeNode node : nodes){
|
for(TechTreeNode node : nodes){
|
||||||
ImageButton button = new ImageButton(node.node.content.icon(Cicon.medium), Styles.nodei);
|
ImageButton button = new ImageButton(node.node.content.icon(Cicon.medium), Styles.nodei);
|
||||||
@@ -273,7 +273,7 @@ public class ResearchDialog extends BaseDialog{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
button.touchable(() -> !node.visible ? Touchable.disabled : Touchable.enabled);
|
button.touchable(() -> !node.visible ? Touchable.disabled : Touchable.enabled);
|
||||||
button.setUserObject(node.node);
|
button.userObject = node.node;
|
||||||
button.setSize(nodeSize);
|
button.setSize(nodeSize);
|
||||||
button.update(() -> {
|
button.update(() -> {
|
||||||
float offset = (Core.graphics.getHeight() % 2) / 2f;
|
float offset = (Core.graphics.getHeight() % 2) / 2f;
|
||||||
@@ -335,7 +335,7 @@ public class ResearchDialog extends BaseDialog{
|
|||||||
|
|
||||||
if(button == null) return;
|
if(button == null) return;
|
||||||
|
|
||||||
TechNode node = (TechNode)button.getUserObject();
|
TechNode node = (TechNode)button.userObject;
|
||||||
|
|
||||||
infoTable.exited(() -> {
|
infoTable.exited(() -> {
|
||||||
if(hoverNode == button && !infoTable.hasMouse() && !hoverNode.hasMouse()){
|
if(hoverNode == button && !infoTable.hasMouse() && !hoverNode.hasMouse()){
|
||||||
|
|||||||
@@ -277,8 +277,8 @@ public class SchematicsDialog extends BaseDialog{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
boolean checked = getParent().getParent() instanceof Button
|
boolean checked = parent.parent instanceof Button
|
||||||
&& ((Button)getParent().getParent()).isOver();
|
&& ((Button)parent.parent).isOver();
|
||||||
|
|
||||||
boolean wasSet = set;
|
boolean wasSet = set;
|
||||||
if(!set){
|
if(!set){
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class BlockConfigFragment extends Fragment{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void build(Group parent){
|
public void build(Group parent){
|
||||||
table.visible(false);
|
table.visible = false;
|
||||||
parent.addChild(table);
|
parent.addChild(table);
|
||||||
|
|
||||||
//hacky way to hide block config when in menu
|
//hacky way to hide block config when in menu
|
||||||
@@ -27,7 +27,7 @@ public class BlockConfigFragment extends Fragment{
|
|||||||
public void act(float delta){
|
public void act(float delta){
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
if(state.isMenu()){
|
if(state.isMenu()){
|
||||||
table.visible(false);
|
table.visible = false;
|
||||||
configTile = null;
|
configTile = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ public class BlockConfigFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShown(){
|
public boolean isShown(){
|
||||||
return table.isVisible() && configTile != null;
|
return table.visible && configTile != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Building getSelectedTile(){
|
public Building getSelectedTile(){
|
||||||
@@ -46,7 +46,7 @@ public class BlockConfigFragment extends Fragment{
|
|||||||
if(tile.configTapped()){
|
if(tile.configTapped()){
|
||||||
configTile = tile;
|
configTile = tile;
|
||||||
|
|
||||||
table.visible(true);
|
table.visible = true;
|
||||||
table.clear();
|
table.clear();
|
||||||
tile.buildConfiguration(table);
|
tile.buildConfiguration(table);
|
||||||
table.pack();
|
table.pack();
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class BlockInventoryFragment extends Fragment{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void build(Group parent){
|
public void build(Group parent){
|
||||||
table.setName("inventory");
|
table.name = "inventory";
|
||||||
table.setTransform(true);
|
table.setTransform(true);
|
||||||
parent.setTransform(true);
|
parent.setTransform(true);
|
||||||
parent.addChild(table);
|
parent.addChild(table);
|
||||||
@@ -90,7 +90,7 @@ public class BlockInventoryFragment extends Fragment{
|
|||||||
table.clearListeners();
|
table.clearListeners();
|
||||||
table.update(null);
|
table.update(null);
|
||||||
}), Actions.visible(false));
|
}), Actions.visible(false));
|
||||||
table.touchable(Touchable.disabled);
|
table.touchable = Touchable.disabled;
|
||||||
tile = null;
|
tile = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ public class BlockInventoryFragment extends Fragment{
|
|||||||
table.clearChildren();
|
table.clearChildren();
|
||||||
table.clearActions();
|
table.clearActions();
|
||||||
table.background(Tex.inventory);
|
table.background(Tex.inventory);
|
||||||
table.touchable(Touchable.enabled);
|
table.touchable = Touchable.enabled;
|
||||||
table.update(() -> {
|
table.update(() -> {
|
||||||
|
|
||||||
if(state.isMenu() || tile == null || !tile.isValid() || !tile.block().isAccessible() || emptyTime >= holdShrink){
|
if(state.isMenu() || tile == null || !tile.isValid() || !tile.block().isAccessible() || emptyTime >= holdShrink){
|
||||||
@@ -209,7 +209,7 @@ public class BlockInventoryFragment extends Fragment{
|
|||||||
|
|
||||||
updateTablePosition();
|
updateTablePosition();
|
||||||
|
|
||||||
table.visible(true);
|
table.visible = true;
|
||||||
|
|
||||||
if(actions){
|
if(actions){
|
||||||
table.setScale(0f, 1f);
|
table.setScale(0f, 1f);
|
||||||
|
|||||||
@@ -131,8 +131,8 @@ public class ChatFragment extends Table{
|
|||||||
|
|
||||||
float spacing = chatspace;
|
float spacing = chatspace;
|
||||||
|
|
||||||
chatfield.visible(shown);
|
chatfield.visible = shown;
|
||||||
fieldlabel.visible(shown);
|
fieldlabel.visible = shown;
|
||||||
|
|
||||||
Draw.color(shadowColor);
|
Draw.color(shadowColor);
|
||||||
Draw.alpha(shadowColor.a * opacity);
|
Draw.alpha(shadowColor.a * opacity);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class FadeInFragment extends Fragment{
|
|||||||
parent.addChild(new Element(){
|
parent.addChild(new Element(){
|
||||||
{
|
{
|
||||||
setFillParent(true);
|
setFillParent(true);
|
||||||
touchable(Touchable.disabled);
|
this.touchable = Touchable.disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -69,14 +69,14 @@ public class HudFragment extends Fragment{
|
|||||||
|
|
||||||
//paused table
|
//paused table
|
||||||
parent.fill(t -> {
|
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();
|
t.table(Styles.black5, top -> top.add("$paused").style(Styles.outlineLabel).pad(8f)).growX();
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO tear this all down
|
//TODO tear this all down
|
||||||
//menu at top left
|
//menu at top left
|
||||||
parent.fill(cont -> {
|
parent.fill(cont -> {
|
||||||
cont.setName("overlaymarker");
|
cont.name = "overlaymarker";
|
||||||
cont.top().left();
|
cont.top().left();
|
||||||
|
|
||||||
if(mobile){
|
if(mobile){
|
||||||
@@ -189,7 +189,7 @@ public class HudFragment extends Fragment{
|
|||||||
|
|
||||||
//fps display
|
//fps display
|
||||||
cont.table(info -> {
|
cont.table(info -> {
|
||||||
info.touchable(Touchable.disabled);
|
info.touchable = Touchable.disabled;
|
||||||
info.top().left().margin(4).visible(() -> Core.settings.getBool("fps") && shown);
|
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));
|
info.update(() -> info.setTranslation(state.rules.waves || state.isEditor() ? 0f : -Scl.scl(dsize * 4 + 3), 0));
|
||||||
IntFormat fps = new IntFormat("fps");
|
IntFormat fps = new IntFormat("fps");
|
||||||
@@ -221,7 +221,7 @@ public class HudFragment extends Fragment{
|
|||||||
|
|
||||||
//spawner warning
|
//spawner warning
|
||||||
parent.fill(t -> {
|
parent.fill(t -> {
|
||||||
t.touchable(Touchable.disabled);
|
t.touchable = Touchable.disabled;
|
||||||
t.table(Styles.black, c -> c.add("$nearpoint")
|
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))))
|
.update(l -> l.setColor(Tmp.c1.set(Color.white).lerp(Color.scarlet, Mathf.absin(Time.time(), 10f, 1f))))
|
||||||
.get().setAlignment(Align.center, Align.center))
|
.get().setAlignment(Align.center, Align.center))
|
||||||
@@ -235,7 +235,7 @@ public class HudFragment extends Fragment{
|
|||||||
|
|
||||||
//'core is under attack' table
|
//'core is under attack' table
|
||||||
parent.fill(t -> {
|
parent.fill(t -> {
|
||||||
t.touchable(Touchable.disabled);
|
t.touchable = Touchable.disabled;
|
||||||
float notifDuration = 240f;
|
float notifDuration = 240f;
|
||||||
float[] coreAttackTime = {0};
|
float[] coreAttackTime = {0};
|
||||||
float[] coreAttackOpacity = {0};
|
float[] coreAttackOpacity = {0};
|
||||||
@@ -250,7 +250,7 @@ public class HudFragment extends Fragment{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
t.getColor().a = coreAttackOpacity[0];
|
t.color.a = coreAttackOpacity[0];
|
||||||
if(coreAttackTime[0] > 0){
|
if(coreAttackTime[0] > 0){
|
||||||
coreAttackOpacity[0] = Mathf.lerpDelta(coreAttackOpacity[0], 1f, 0.1f);
|
coreAttackOpacity[0] = Mathf.lerpDelta(coreAttackOpacity[0], 1f, 0.1f);
|
||||||
}else{
|
}else{
|
||||||
@@ -262,7 +262,7 @@ public class HudFragment extends Fragment{
|
|||||||
return coreAttackOpacity[0] > 0;
|
return coreAttackOpacity[0] > 0;
|
||||||
});
|
});
|
||||||
t.table(Tex.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);
|
.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
|
//paused table for when the player is out of time
|
||||||
@@ -324,7 +324,7 @@ public class HudFragment extends Fragment{
|
|||||||
showHudText = false;
|
showHudText = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
p.touchable(Touchable.disabled);
|
p.touchable = Touchable.disabled;
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO DEBUG: rate table
|
//TODO DEBUG: rate table
|
||||||
@@ -519,7 +519,7 @@ public class HudFragment extends Fragment{
|
|||||||
|
|
||||||
public void showLaunchDirect(){
|
public void showLaunchDirect(){
|
||||||
Image image = new Image();
|
Image image = new Image();
|
||||||
image.getColor().a = 0f;
|
image.color.a = 0f;
|
||||||
image.setFillParent(true);
|
image.setFillParent(true);
|
||||||
image.actions(Actions.fadeIn(launchDuration / 60f, Interp.pow2In), Actions.delay(8f / 60f), Actions.remove());
|
image.actions(Actions.fadeIn(launchDuration / 60f, Interp.pow2In), Actions.delay(8f / 60f), Actions.remove());
|
||||||
Core.scene.add(image);
|
Core.scene.add(image);
|
||||||
@@ -527,7 +527,7 @@ public class HudFragment extends Fragment{
|
|||||||
|
|
||||||
public void showLaunch(){
|
public void showLaunch(){
|
||||||
Image image = new Image();
|
Image image = new Image();
|
||||||
image.getColor().a = 0f;
|
image.color.a = 0f;
|
||||||
image.setFillParent(true);
|
image.setFillParent(true);
|
||||||
image.actions(Actions.fadeIn(40f / 60f));
|
image.actions(Actions.fadeIn(40f / 60f));
|
||||||
image.update(() -> {
|
image.update(() -> {
|
||||||
@@ -540,8 +540,8 @@ public class HudFragment extends Fragment{
|
|||||||
|
|
||||||
public void showLand(){
|
public void showLand(){
|
||||||
Image image = new Image();
|
Image image = new Image();
|
||||||
image.getColor().a = 1f;
|
image.color.a = 1f;
|
||||||
image.touchable(Touchable.disabled);
|
image.touchable = Touchable.disabled;
|
||||||
image.setFillParent(true);
|
image.setFillParent(true);
|
||||||
image.actions(Actions.fadeOut(0.8f), Actions.remove());
|
image.actions(Actions.fadeOut(0.8f), Actions.remove());
|
||||||
image.update(() -> {
|
image.update(() -> {
|
||||||
@@ -614,11 +614,11 @@ public class HudFragment extends Fragment{
|
|||||||
});
|
});
|
||||||
|
|
||||||
table.clearChildren();
|
table.clearChildren();
|
||||||
table.touchable(Touchable.enabled);
|
table.touchable = Touchable.enabled;
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
table.setName("waves");
|
table.name = "waves";
|
||||||
table.labelWrap(() -> {
|
table.labelWrap(() -> {
|
||||||
builder.setLength(0);
|
builder.setLength(0);
|
||||||
builder.append(wavef.get(state.wave));
|
builder.append(wavef.get(state.wave));
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ public class LoadingFragment extends Fragment{
|
|||||||
@Override
|
@Override
|
||||||
public void build(Group parent){
|
public void build(Group parent){
|
||||||
parent.fill(Styles.black8, t -> {
|
parent.fill(Styles.black8, t -> {
|
||||||
t.visible(false);
|
t.visible = false;
|
||||||
t.touchable(Touchable.enabled);
|
t.touchable = Touchable.enabled;
|
||||||
t.add().height(133f).row();
|
t.add().height(133f).row();
|
||||||
t.add(new WarningBar()).growX().height(24f);
|
t.add(new WarningBar()).growX().height(24f);
|
||||||
t.row();
|
t.row();
|
||||||
@@ -37,12 +37,12 @@ public class LoadingFragment extends Fragment{
|
|||||||
|
|
||||||
public void setProgress(Floatp progress){
|
public void setProgress(Floatp progress){
|
||||||
bar.reset(0f);
|
bar.reset(0f);
|
||||||
bar.visible(true);
|
bar.visible = true;
|
||||||
bar.set(() -> ((int)(progress.get() * 100) + "%"), progress, Pal.accent);
|
bar.set(() -> ((int)(progress.get() * 100) + "%"), progress, Pal.accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setButton(Runnable listener){
|
public void setButton(Runnable listener){
|
||||||
button.visible(true);
|
button.visible = true;
|
||||||
button.getListeners().remove(button.getListeners().size - 1);
|
button.getListeners().remove(button.getListeners().size - 1);
|
||||||
button.clicked(listener);
|
button.clicked(listener);
|
||||||
}
|
}
|
||||||
@@ -58,19 +58,19 @@ public class LoadingFragment extends Fragment{
|
|||||||
|
|
||||||
public void show(String text){
|
public void show(String text){
|
||||||
table.<Label>find("namelabel").setColor(Color.white);
|
table.<Label>find("namelabel").setColor(Color.white);
|
||||||
bar.visible(false);
|
bar.visible = false;
|
||||||
table.clearActions();
|
table.clearActions();
|
||||||
table.touchable(Touchable.enabled);
|
table.touchable = Touchable.enabled;
|
||||||
table.<Label>find("namelabel").setText(text);
|
table.<Label>find("namelabel").setText(text);
|
||||||
table.visible(true);
|
table.visible = true;
|
||||||
table.getColor().a = 1f;
|
table.color.a = 1f;
|
||||||
table.toFront();
|
table.toFront();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hide(){
|
public void hide(){
|
||||||
table.clearActions();
|
table.clearActions();
|
||||||
table.toFront();
|
table.toFront();
|
||||||
table.touchable(Touchable.disabled);
|
table.touchable = Touchable.disabled;
|
||||||
table.actions(Actions.fadeOut(0.5f), Actions.visible(false));
|
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.setColor(Color.white);
|
||||||
Fonts.def.draw(versionText, fx, fy - logoh/2f, Align.center);
|
Fonts.def.draw(versionText, fx, fy - logoh/2f, Align.center);
|
||||||
}).touchable(Touchable.disabled);
|
}).touchable = Touchable.disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildMobile(){
|
private void buildMobile(){
|
||||||
@@ -184,7 +184,7 @@ public class MenuFragment extends Fragment{
|
|||||||
|
|
||||||
container.table(background, t -> {
|
container.table(background, t -> {
|
||||||
submenu = t;
|
submenu = t;
|
||||||
t.getColor().a = 0f;
|
t.color.a = 0f;
|
||||||
t.top();
|
t.top();
|
||||||
t.defaults().width(width).height(70f);
|
t.defaults().width(width).height(70f);
|
||||||
t.visible(() -> !t.getChildren().isEmpty());
|
t.visible(() -> !t.getChildren().isEmpty());
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class MinimapFragment extends Fragment{
|
|||||||
shown = false;
|
shown = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
elem.touchable(Touchable.enabled);
|
elem.touchable = Touchable.enabled;
|
||||||
|
|
||||||
elem.addListener(new ElementGestureListener(){
|
elem.addListener(new ElementGestureListener(){
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class OverlayFragment{
|
|||||||
private WidgetGroup group = new WidgetGroup();
|
private WidgetGroup group = new WidgetGroup();
|
||||||
|
|
||||||
public OverlayFragment(){
|
public OverlayFragment(){
|
||||||
group.touchable(Touchable.childrenOnly);
|
group.touchable = Touchable.childrenOnly;
|
||||||
inv = new BlockInventoryFragment();
|
inv = new BlockInventoryFragment();
|
||||||
config = new BlockConfigFragment();
|
config = new BlockConfigFragment();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public class PlacementFragment extends Fragment{
|
|||||||
|
|
||||||
void rebuild(){
|
void rebuild(){
|
||||||
currentCategory = Category.turret;
|
currentCategory = Category.turret;
|
||||||
Group group = toggler.getParent();
|
Group group = toggler.parent;
|
||||||
int index = toggler.getZIndex();
|
int index = toggler.getZIndex();
|
||||||
toggler.remove();
|
toggler.remove();
|
||||||
build(group);
|
build(group);
|
||||||
|
|||||||
@@ -122,8 +122,8 @@ public class ScriptConsoleFragment extends Table{
|
|||||||
|
|
||||||
float spacing = chatspace;
|
float spacing = chatspace;
|
||||||
|
|
||||||
chatfield.visible(open);
|
chatfield.visible = open;
|
||||||
fieldlabel.visible(open);
|
fieldlabel.visible = open;
|
||||||
|
|
||||||
Draw.color(shadowColor);
|
Draw.color(shadowColor);
|
||||||
Draw.alpha(shadowColor.a * opacity);
|
Draw.alpha(shadowColor.a * opacity);
|
||||||
|
|||||||
Reference in New Issue
Block a user