fixed bug, clean up, added player name json

This commit is contained in:
Sharlotte
2021-07-24 15:08:49 +09:00
parent 6ff1c67fb7
commit d0951b8960
7 changed files with 116 additions and 38 deletions

View File

@@ -46,7 +46,6 @@ public class HudUi {
float tileScrollPos;
float itemScrollPos;
Element image;
Color lastItemColor = Pal.items;
Color lastAmmoColor = Pal.ammo;
Teamc lockedTarget;
@@ -191,7 +190,6 @@ public class HudUi {
update(() -> {
if(!(getTarget() instanceof ItemTurret.ItemTurretBuild) && !(getTarget() instanceof LiquidTurret.LiquidTurretBuild) && !(getTarget() instanceof PowerTurret.PowerTurretBuild)){
clearChildren();
image = null;
return;
}
if(getTarget() instanceof Turret.TurretBuild){
@@ -216,31 +214,27 @@ public class HudUi {
imaget = new Image(entity.liquids.current().uiIcon).setScaling(Scaling.fit);
}
else if(getTarget() instanceof PowerTurret.PowerTurretBuild){
imaget = new ReqImage(Icon.power.getRegion(), () -> ((PowerTurret.PowerTurretBuild) getTarget()).power.status * ((PowerTurret.PowerTurretBuild) getTarget()).power.graph.getLastScaledPowerIn() > 0f){{
add(new Image(Icon.power.getRegion()));
add(new Element(){
@Override
public void draw(){
Building entity = getTarget();
float max = entity.block.consumes.getPower().usage;
float v = entity.power.status * entity.power.graph.getLastScaledPowerIn();
imaget = new Image(Icon.power.getRegion()){
@Override
public void draw(){
Building entity = getTarget();
float max = entity.block.consumes.getPower().usage;
float v = entity.power.status * entity.power.graph.getLastScaledPowerIn();
Lines.stroke(Scl.scl(2f), Pal.removeBack);
Draw.alpha(1 - v/max);
Lines.line(x, y - 2f + height, x + width, y - 2f);
Draw.color(Pal.remove);
Draw.alpha(1 - v/max);
Lines.line(x, y + height, x + width, y);
Draw.reset();
}
});
}};
super.draw();
Lines.stroke(Scl.scl(2f), Pal.removeBack);
Draw.alpha(1 - v/max);
Lines.line(x, y - 2f + height, x + width, y - 2f);
Draw.color(Pal.remove);
Draw.alpha(1 - v/max);
Lines.line(x, y + height, x + width, y);
Draw.reset();
}
};
}
if(image != null && (imaget.getClass() != image.getClass() || imaget.getClass() == Image.class))
clearChildren();
clearChildren();
add(imaget).size(iconSmall).padBottom(2 * 8f).padRight(3 * 8f);
image = imaget;
}
});
pack();