diff --git a/scripts/main.js b/scripts/main.js index c2a6673..31bf2d7 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -2,8 +2,7 @@ let cols = [Pal.lancerLaser, Pal.accent, Color.valueOf("cc6eaf")]; function addTable(table){ - table.table(Styles.black5, cons(t => { - t.background(Tex.buttonEdge3); + table.table(Tex.pane, t => { let s = new Slider(-8, 8, 1, false); s.setValue(0); let l = t.label(() => { @@ -16,24 +15,19 @@ function addTable(table){ }).growX().width(8.5 * 8).color(Pal.accent); let b = t.button(new TextureRegionDrawable(Icon.refresh), 24, () => s.setValue(0)).padLeft(6).get(); b.getStyle().imageUpColor = Pal.accent; - t.add(s).padLeft(6); + t.add(s).padLeft(6).minWidth(200); s.moved(v => { let t = Math.pow(2, v); Time.setDeltaProvider(() => Math.min(Core.graphics.getDeltaTime() * 60 * t, 3 * t)); l.color(Tmp.c1.lerp(cols, (s.getValue() + 8) / 16)); }); - })); - table.fillParent = true; + }); table.visibility = () => { - if(!Vars.ui.hudfrag.shown) return false; - if(Vars.ui.minimapfrag.shown()) return false; + if(!Vars.ui.hudfrag.shown || Vars.ui.minimapfrag.shown()) return false; if(!Vars.mobile) return true; - if(Vars.player.unit().isBuilding()) return false; - if(Vars.control.input.block != null) return false; - if(Vars.control.input.mode == PlaceMode.breaking) return false; - //todo port to v7 - //if(Vars.control.input.selectRequests != null && !Vars.control.input.selectRequests.isEmpty() && Vars.control.input.lastSchematic != null && !Vars.control.input.selectRequests.isEmpty()) return false; - return true; + + let input = Vars.control.input; + return input.lastSchematic == null || input.selectPlans.isEmpty(); }; } @@ -44,5 +38,6 @@ if(!Vars.headless){ tc.bottom().left(); addTable(tc); Vars.ui.hudGroup.addChild(tc); + if(Vars.mobile) tc.moveBy(0, Scl.scl(46)); }); }