removed command info ui, added unit item info.

This commit is contained in:
Sharlotte
2021-07-16 09:14:51 +09:00
parent fe851d3d95
commit 0bc8f17594
9 changed files with 49 additions and 2066 deletions

View File

@@ -496,87 +496,6 @@ public class HudUi {
weapon = new Table(tx -> {
tx.left().defaults().minSize(Scl.scl(12 * 8f));
if(settings.getBool("commandedunitui") && Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == getUnit()) != 0)
tx.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, t1 -> t1.table(tt -> {
tt.left().top().defaults().width(Scl.scl(24/3f * 8f)).minHeight(Scl.scl(12/3f * 8f));
int amount = 0;
if(type != null) amount = Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == getUnit());
Seq<Unit> units = new Seq<>();
units = Groups.unit.copy(units).filter(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == getUnit());
for(int r = 0; r < amount; r++){
Unit unit = units.get(r);
TextureRegion region = unit.type.uiIcon;
if(type.weapons.size > 1 && r % 3 == 0) tt.row();
else if(r % 3 == 0) tt.row();
tt.table(unittable -> {
unittable.left();
unittable.add(new Stack(){{
add(new Table(o -> {
o.left();
o.image(region).size(Scl.scl(30)).scaling(Scaling.fit);
}));
add(new Table(h -> {
h.add(new Stack(){{
add(new Table(e -> {
e.left().defaults().growX().height(Scl.scl(9)).width(Scl.scl(42f)).padRight(Scl.scl(2*8)).padTop(Scl.scl(8*2f));
Bar healthBar = new Bar(
() -> "",
() -> Pal.health,
unit::healthf);
e.add(healthBar).left();
e.pack();
}));
add(new Table(e -> {
e.add(new Stack(){{
add(new Table(t -> {
t.left().defaults().growX().height(Scl.scl(9)).width(Scl.scl(42f)).padRight(Scl.scl(2*8)).padTop(Scl.scl(8*5f));
t.add(new Bar(
() -> "",
() -> unit.stack.item == null || unit.stack.amount <= 0 ? Pal.items : unit.stack.item.color.cpy().lerp(Color.white, 0.15f),
() -> Mathf.clamp(unit.stack.amount / (unit.type.itemCapacity * 1f))
)).growX().left();
}));
add(new Table(t -> {
t.left();
t.add(new Stack(){{
add(new Table(tt ->
tt.add(new Image(){{
update(() -> {
if(!Core.settings.getBool("weaponui")) return;
setDrawable(unit.stack.item == null || unit.stack.amount <= 0 ? Core.atlas.find("clear") : unit.stack.item.uiIcon);
});
}}.setScaling(Scaling.fit)).size(Scl.scl(2.5f * 8f)).scaling(Scaling.fit).padBottom(Scl.scl(4 * 8f)).padLeft(Scl.scl(2 * 8f))
));
add(new Table(tt -> {
Label label = new Label(() -> unit.stack.item == null || unit.stack.amount <= 0 ? "" : unit.stack.amount + "");
label.setFontScale(Scl.scl());
tt.add(label).padBottom(Scl.scl(1 * 8f)).padLeft(Scl.scl(2 * 8f));
tt.pack();
}));
}});
t.pack();
}));
}});
}));
}}).padTop(Scl.scl(2*8)).padRight(Scl.scl(2*8));
h.pack();
}));
}}).left();
}).left();
tt.center();
}
})){
@Override
protected void drawBackground(float x, float y) {
if(getBackground() == null) return;
Color color = this.color;
Draw.color(color.r, color.g, color.b, (settings.getInt("uiopacity") / 100f) * this.parentAlpha);
getBackground().draw(x, y, width, height);
}
}).padRight(Scl.scl(24 * 8f));
tx.row();
if(settings.getBool("weaponui") && type != null && type.weapons.size != 0) tx.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, tt -> {
tt.defaults().width(Scl.scl(24/3f * 8f));