This commit is contained in:
sharlottes
2021-05-29 23:42:22 +09:00
parent 514c4b3bff
commit 8936bed334
4 changed files with 20 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ import mindustry.gen.*;
import mindustry.graphics.Drawf;
import mindustry.graphics.Layer;
import mindustry.graphics.Pal;
import mindustry.graphics.Trail;
import mindustry.type.Item;
import mindustry.type.Liquid;
import mindustry.ui.Cicon;

View File

@@ -10,6 +10,7 @@ import arc.scene.style.*;
import arc.scene.ui.layout.Scl;
import arc.util.pooling.*;
import mindustry.gen.*;
import mindustry.graphics.Pal;
import mindustry.ui.Fonts;
import static arc.Core.settings;
@@ -128,12 +129,12 @@ public class SBar extends Element{
if(Float.isInfinite(computed)) computed = 1f;
blink = Mathf.lerpDelta(blink, 0f, 0.2f);
value = Mathf.lerpDelta(value, computed, 0.15f);
value = Mathf.lerpDelta(value, computed, 0.05f);
NinePatchDrawable bar = (NinePatchDrawable) drawable("unitinfo-barS");
Draw.colorl(0.1f);
bar.draw(x, y, width, height);
Draw.color(color, blinkColor, blink);
Draw.color(color.cpy().mul(Pal.lightishGray), blinkColor, blink);
NinePatchDrawable top = (NinePatchDrawable) drawable("unitinfo-barS-top");
float topWidth = width * value;
@@ -147,6 +148,18 @@ public class SBar extends Element{
}
}
Draw.color(color, blinkColor, blink);
float topWidthReal = width * computed;
if(topWidthReal > Core.atlas.find("unitinfo-bar-top").width){
top.draw(x, y, topWidthReal, height);
}else{
if(ScissorStack.push(scissor.set(x, y, topWidthReal, height))){
top.draw(x, y, Core.atlas.find("unitinfo-bar-top").width, height);
ScissorStack.pop();
}
}
Draw.color();
Font font = Fonts.outline;