Better LiquidDisplay
This commit is contained in:
@@ -15,25 +15,27 @@ public class LiquidDisplay extends Table{
|
|||||||
public final float amount;
|
public final float amount;
|
||||||
public final boolean perSecond;
|
public final boolean perSecond;
|
||||||
|
|
||||||
public LiquidDisplay(Liquid liquid, float amount, boolean perSecond){
|
public LiquidDisplay(Liquid liquid, float size, float amount, boolean perSecond){
|
||||||
this.liquid = liquid;
|
this.liquid = liquid;
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.perSecond = perSecond;
|
this.perSecond = perSecond;
|
||||||
|
|
||||||
|
left();
|
||||||
add(new Stack(){{
|
add(new Stack(){{
|
||||||
add(new Image(liquid.uiIcon).setScaling(Scaling.fit));
|
Image i = new Image(liquid.uiIcon).setScaling(Scaling.fit);
|
||||||
|
i.setAlign(Align.left);
|
||||||
|
add(i);
|
||||||
|
|
||||||
if(amount != 0){
|
if(amount != 0){
|
||||||
Table t = new Table().left().bottom();
|
Table t = new Table().left().bottom();
|
||||||
t.add(Strings.autoFixed(amount, 2)).style(Styles.outlineLabel);
|
t.add(Strings.autoFixed(amount, 2) + (perSecond ? StatUnit.perSecond.localized() : "")).style(Styles.outlineLabel);
|
||||||
add(t);
|
add(t);
|
||||||
}
|
}
|
||||||
}}).size(iconMed).padRight(3 + (amount != 0 && Strings.autoFixed(amount, 2).length() > 2 ? 8 : 0));
|
}}).height(size).left();
|
||||||
|
add(liquid.localizedName).padLeft(6f).left();
|
||||||
|
}
|
||||||
|
|
||||||
if(perSecond){
|
public LiquidDisplay(Liquid liquid, float amount, boolean perSecond){
|
||||||
add(StatUnit.perSecond.localized()).padLeft(2).padRight(5).color(Color.lightGray).style(Styles.outlineLabel);
|
this(liquid, iconMed, amount, perSecond);
|
||||||
}
|
|
||||||
|
|
||||||
add(liquid.localizedName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -314,16 +314,7 @@ public class StatValues{
|
|||||||
table.table(c -> {
|
table.table(c -> {
|
||||||
for(Liquid liquid : content.liquids().select(l -> filter.get(l) && l.unlockedNow() && !l.isHidden())){
|
for(Liquid liquid : content.liquids().select(l -> filter.get(l) && l.unlockedNow() && !l.isHidden())){
|
||||||
c.table(Styles.grayPanel, b -> {
|
c.table(Styles.grayPanel, b -> {
|
||||||
b.add(new Stack(){{
|
b.add(new LiquidDisplay(liquid, 40f, amount, true)).pad(10f).left().grow();
|
||||||
Image i = new Image(liquid.uiIcon).setScaling(Scaling.fit);
|
|
||||||
i.setAlign(Align.left);
|
|
||||||
add(i);
|
|
||||||
|
|
||||||
Table t = new Table().left().bottom();
|
|
||||||
t.add(Strings.autoFixed(amount, 2) + StatUnit.perSecond.localized()).style(Styles.outlineLabel);
|
|
||||||
add(t);
|
|
||||||
}}).height(40).pad(10f).padRight(0).left();
|
|
||||||
b.add(liquid.localizedName).left().padLeft(6f).grow();
|
|
||||||
b.add(Core.bundle.format("stat.efficiency", fixValue(efficiency.get(liquid) * 100f))).right().pad(10f).padRight(15f);
|
b.add(Core.bundle.format("stat.efficiency", fixValue(efficiency.get(liquid) * 100f))).right().pad(10f).padRight(15f);
|
||||||
}).growX().pad(5).row();
|
}).growX().pad(5).row();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user