updated weapon table

This commit is contained in:
sharlotte
2021-08-14 16:15:35 +09:00
parent 0d1a079ba4
commit 4b1050778e

View File

@@ -625,11 +625,9 @@ public class HudUi {
}
public void addWeapon(){
weapon = new Table(tx -> {
tx.left().defaults().minSize(Scl.scl(modUiScale) * 12 * 8f);
tx.add(new Table(Tex.button, tt -> {
tt.left().top().defaults().width(Scl.scl(modUiScale) * 8 * 8f).minHeight(Scl.scl(modUiScale) * 4 * 8f);
weapon = new Table(Tex.button, tt -> {
tt.left().defaults().minSize(Scl.scl(modUiScale) * 12 * 8f);
tt.defaults().width(Scl.scl(modUiScale) * 8 * 8f).minHeight(Scl.scl(modUiScale) * 4 * 8f);
if(getTarget() instanceof Unit u && u.type != null) {
UnitType type = u.type;
@@ -640,7 +638,6 @@ public class HudUi {
if(type.weapons.size > 1 && r % 3 == 0) tt.row();
else if(r % 3 == 0) tt.row();
tt.table(weapontable -> {
weapontable.left();
weapontable.add(new Stack(){{
add(new Table(o -> {
o.left();
@@ -671,20 +668,19 @@ public class HudUi {
if(getDrawable() != null)
getDrawable().draw(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
}
}.setScaling(Scaling.fit)).size(Scl.scl(modUiScale) * 6 * 8f);
}).scaling(Scaling.fill).size(Scl.scl(modUiScale) * iconLarge);
}));
add(new Table(h -> {
h.defaults().growX().height(Scl.scl(modUiScale) * 9f).width(Scl.scl(modUiScale) * 31.5f).padTop(Scl.scl(modUiScale) * 18f);
h.defaults().growX().height(Scl.scl(modUiScale) * 9f).width(Scl.scl(modUiScale) * iconLarge).padTop(Scl.scl(modUiScale) * 18f);
h.add(new Bar(
() -> "",
() -> Pal.accent.cpy().lerp(Color.orange, mount.reload / weapon.reload),
() -> mount.reload / weapon.reload)).padLeft(Scl.scl(modUiScale) * 8f);
() -> mount.reload / weapon.reload));
h.pack();
}));
}}).left();
}).left();
tt.center();
}});
});
}
}
}){
@@ -695,9 +691,7 @@ public class HudUi {
Draw.color(color.r, color.g, color.b, (settings.getInt("uiopacity") / 100f) * this.parentAlpha);
getBackground().draw(x, y, width, height);
}
}).padRight(Scl.scl(modUiScale) * 24 * 8f);
tx.setColor(tx.color.cpy().a(1f));
});
};
}
public void addUnitTable(){
@@ -823,7 +817,7 @@ public class HudUi {
Draw.color(color.r, color.g, color.b, (settings.getInt("uiopacity") / 100f) * this.parentAlpha);
getBackground().draw(x, y, width, height);
}
}).padRight(Scl.scl(modUiScale) * 24 * 8f);
});
table.row();
table.update(() -> {
try {
@@ -839,8 +833,9 @@ public class HudUi {
if(((Turret.TurretBuild) getTarget()).charging) charge += Time.delta;
else charge = 0f;
}
table.removeChild(weapon);
if(settings.getBool("weaponui") && getTarget() instanceof Unit && ((Unit) getTarget()).type != null) {
if(settings.getBool("weaponui") && getTarget() instanceof Unit u && u.type != null) {
addWeapon();
table.row();
table.add(weapon);