This commit is contained in:
Anuken
2019-02-11 09:02:28 -05:00
parent 52593252c5
commit 51ba999ee1
7 changed files with 27 additions and 19 deletions
+5 -4
View File
@@ -32,7 +32,7 @@ public class Bar extends Element{
public Bar(Supplier<String> name, Supplier<Color> color, FloatProvider fraction){
this.fraction = fraction;
lastValue = value = fraction.get();
lastValue = value = Mathf.clamp(fraction.get());
update(() -> {
this.name = name.get();
this.blinkColor.set(color.get());
@@ -47,13 +47,14 @@ public class Bar extends Element{
@Override
public void draw(){
if(!Mathf.isEqual(lastValue, fraction.get())){
float computed = Mathf.clamp(fraction.get());
if(!Mathf.isEqual(lastValue, computed)){
blink = 1f;
lastValue = fraction.get();
lastValue = computed;
}
blink = Mathf.lerpDelta(blink, 0f, 0.2f);
value = Mathf.lerpDelta(value, fraction.get(), 0.15f);
value = Mathf.lerpDelta(value, computed, 0.15f);
Draw.colorl(0.1f);
Draw.drawable("bar", x, y, width, height);
@@ -211,8 +211,8 @@ public class TechTreeDialog extends FloatingDialog{
list.left();
list.addImage(req.item.getContentIcon()).size(8 * 3).padRight(3);
list.add(req.item.localizedName()).color(Color.LIGHT_GRAY);
list.add(" " + Math.min(data.getItem(req.item), req.amount) + " / " + req.amount)
.color(data.has(req.item, req.amount) ? Color.LIGHT_GRAY : Color.SCARLET);
list.label(() -> " " + Math.min(data.getItem(req.item), req.amount) + " / " + req.amount)
.update(l -> l.setColor(data.has(req.item, req.amount) ? Color.LIGHT_GRAY : Color.SCARLET));
}).fillX().left();
t.row();
}
@@ -226,7 +226,8 @@ public class HudFragment extends Fragment{
world.isZone() &&
world.getZone().metCondition() &&
!Net.client() &&
state.wave % world.getZone().launchPeriod == 0);
state.wave % world.getZone().launchPeriod == 0 &&
state.wavetime < state.rules.waveSpacing - 70);
button.update(() -> {
if(world.getZone() == null){