mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-07 00:38:26 +07:00
Implemented % tile efficiency display
This commit is contained in:
@ -39,8 +39,8 @@ public class BlockStats{
|
|||||||
|
|
||||||
public void add(BlockStat stat, Attribute attr){
|
public void add(BlockStat stat, Attribute attr){
|
||||||
for(Block block : Vars.content.blocks()){
|
for(Block block : Vars.content.blocks()){
|
||||||
if(!block.isFloor() || block.asFloor().attributes.get(attr) <= 0) continue;
|
if(!block.isFloor() || block.asFloor().attributes.get(attr) == 0) continue;
|
||||||
add(stat, new FloorValue(block.asFloor()));
|
add(stat, new FloorEfficiencyValue(block.asFloor(), block.asFloor().attributes.get(attr)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package mindustry.world.meta.values;
|
||||||
|
|
||||||
|
import arc.scene.ui.*;
|
||||||
|
import arc.scene.ui.layout.*;
|
||||||
|
import arc.util.*;
|
||||||
|
import mindustry.ui.*;
|
||||||
|
import mindustry.world.blocks.environment.*;
|
||||||
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
|
public class FloorEfficiencyValue implements StatValue{
|
||||||
|
private final Floor floor;
|
||||||
|
private final float multiplier;
|
||||||
|
|
||||||
|
public FloorEfficiencyValue(Floor floor, float multiplier){
|
||||||
|
this.floor = floor;
|
||||||
|
this.multiplier = multiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void display(Table table){
|
||||||
|
table.stack(new Image(floor.icon(Cicon.medium)).setScaling(Scaling.fit), new Table(t -> {
|
||||||
|
t.top().right().add((multiplier < 0 ? "[scarlet]" : "[accent]+") + (int)((multiplier) * 100) + "%").style(Styles.outlineLabel);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user