This commit is contained in:
Anuken
2018-11-02 19:45:31 -04:00
24 changed files with 329 additions and 131 deletions

View File

@@ -2,7 +2,7 @@ package io.anuke.mindustry.ai;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.*;
import io.anuke.mindustry.content.Items;
import com.badlogic.gdx.utils.Bits;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.game.EventType.TileChangeEvent;
@@ -14,10 +14,7 @@ import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.meta.BlockFlag;
import io.anuke.ucore.core.Events;
import io.anuke.ucore.function.Predicate;
import io.anuke.ucore.util.EnumSet;
import io.anuke.ucore.util.Geometry;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.ThreadArray;
import io.anuke.ucore.util.*;
import static io.anuke.mindustry.Vars.*;
@@ -33,12 +30,14 @@ public class BlockIndexer{
private final static int structQuadrantSize = 12;
/**Set of all ores that are being scanned.*/
private final ObjectSet<Item> scanOres = ObjectSet.with(Items.copper, Items.coal, Items.lead, Items.thorium, Items.titanium);
private final ObjectSet<Item> scanOres = new ObjectSet<Item>(){{addAll(Item.getAllOres());}};
private final ObjectSet<Item> itemSet = new ObjectSet<>();
/**Stores all ore quadtrants on the map.*/
private ObjectMap<Item, ObjectSet<Tile>> ores;
/**Tags all quadrants.*/
private Bits[] structQuadrants;
/**Stores all damaged tile entities by team.*/
private ObjectSet<Tile>[] damagedTiles = new ObjectSet[Team.all.length];
/**Maps teams to a map of flagged tiles by type.*/
private ObjectSet<Tile>[][] flagMap = new ObjectSet[Team.all.length][BlockFlag.all.length];
@@ -62,7 +61,9 @@ public class BlockIndexer{
});
Events.on(WorldLoadEvent.class, event -> {
damagedTiles = new ObjectSet[Team.all.length];
flagMap = new ObjectSet[Team.all.length][BlockFlag.all.length];
for(int i = 0; i < flagMap.length; i++){
for(int j = 0; j < BlockFlag.all.length; j++){
flagMap[i][j] = new ObjectSet<>();
@@ -79,7 +80,13 @@ public class BlockIndexer{
for(int x = 0; x < world.width(); x++){
for(int y = 0; y < world.height(); y++){
process(world.tile(x, y));
Tile tile = world.tileWorld(x, y);
process(tile);
if(tile.entity != null && tile.entity.healthf() < 0.9999f){
notifyTileDamaged(tile.entity);
}
}
}
@@ -97,6 +104,28 @@ public class BlockIndexer{
return flagMap[team.ordinal()];
}
/**Returns all damaged tiles by team.*/
public ObjectSet<Tile> getDamaged(Team team){
returnArray.clear();
if(damagedTiles[team.ordinal()] == null){
damagedTiles[team.ordinal()] = new ObjectSet<>();
}
ObjectSet<Tile> set = damagedTiles[team.ordinal()];
for(Tile tile : set){
if(tile.entity == null || tile.entity.getTeam() != team || tile.entity.healthf() >= 0.9999f){
returnArray.add(tile);
}
}
for(Tile tile : returnArray){
set.remove(tile);
}
return set;
}
/**Get all allied blocks with a flag.*/
public ObjectSet<Tile> getAllied(Team team, BlockFlag type){
return flagMap[team.ordinal()][type.ordinal()];
@@ -115,6 +144,15 @@ public class BlockIndexer{
return returnArray;
}
public void notifyTileDamaged(TileEntity entity){
if(damagedTiles[entity.getTeam().ordinal()] == null){
damagedTiles[entity.getTeam().ordinal()] = new ObjectSet<>();
}
ObjectSet<Tile> set = damagedTiles[entity.getTeam().ordinal()];
set.add(entity.tile);
}
public TileEntity findTile(Team team, float x, float y, float range, Predicate<Tile> pred){
TileEntity closest = null;
float dst = 0;

View File

@@ -143,10 +143,14 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
public void damage(float damage){
if(dead) return;
float preHealth = health;
Call.onTileDamage(tile, health - tile.block().handleDamage(tile, damage));
if(health <= 0){
Call.onTileDestroyed(tile);
}else if(preHealth >= maxHealth() - 0.00001f && health < maxHealth()){ //when just damaged
world.indexer.notifyTileDamaged(this);
}
}

View File

@@ -11,8 +11,9 @@ import io.anuke.ucore.entities.EntityGroup;
import io.anuke.ucore.entities.EntityQuery;
import io.anuke.ucore.function.Consumer;
import io.anuke.ucore.function.Predicate;
import io.anuke.ucore.util.Threads;
import io.anuke.ucore.util.EnumSet;
import io.anuke.ucore.util.Geometry;
import io.anuke.ucore.util.Threads;
import static io.anuke.mindustry.Vars.*;
@@ -125,6 +126,12 @@ public class Units{
return value[0];
}
/**Returns the neareset damaged tile.*/
public static TileEntity findDamagedTile(Team team, float x, float y){
Tile tile = Geometry.findClosest(x, y, world.indexer.getDamaged(team));
return tile == null ? null : tile.entity;
}
/**Returns the neareset ally tile in a range.*/
public static TileEntity findAllyTile(Team team, float x, float y, float range, Predicate<Tile> pred){
return world.indexer.findTile(team, x, y, range, pred);

View File

@@ -79,12 +79,14 @@ public class Drone extends FlyingUnit implements BuilderTrait{
}
//if it's missing requirements, try and mine them
for(ItemStack stack : entity.recipe.requirements){
if(!core.items.has(stack.item, stack.amount) && type.toMine.contains(stack.item)){
targetItem = stack.item;
getPlaceQueue().clear();
setState(mine);
return;
if(entity.recipe != null){
for(ItemStack stack : entity.recipe.requirements){
if(!core.items.has(stack.item, stack.amount) && type.toMine.contains(stack.item)){
targetItem = stack.item;
getPlaceQueue().clear();
setState(mine);
return;
}
}
}
@@ -102,22 +104,19 @@ public class Drone extends FlyingUnit implements BuilderTrait{
}
public void update(){
if(target != null && (((TileEntity) target).health >= ((TileEntity) target).tile.block().health
|| target.distanceTo(Drone.this) > discoverRange)){
target = null;
}
if(target == null){
retarget(() -> {
target = Units.findAllyTile(team, x, y, discoverRange,
tile -> tile.entity != null && tile.entity.health + 0.0001f < tile.block().health);
retarget(() -> {
target = Units.findDamagedTile(team, x, y);
if(target == null){
setState(mine);
}
});
}else if(target.distanceTo(Drone.this) > type.range){
circle(type.range);
if(target == null){
setState(mine);
}
});
if(target == null) return;
if(target.distanceTo(Drone.this) > type.range){
circle(type.range*0.9f);
}else{
TileEntity entity = (TileEntity) target;
entity.healBy(type.healSpeed * entity.tile.block().health / 100f * Timers.delta());
@@ -316,7 +315,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{
target = null;
}
if(Net.client() && state.is(repair) && target instanceof TileEntity){
if(Net.client() && state.is(repair) && target instanceof TileEntity && target.distanceTo(this) < type.range){
TileEntity entity = (TileEntity) target;
entity.health += type.healSpeed * Timers.delta();
entity.health = Mathf.clamp(entity.health, 0, entity.tile.block().health);
@@ -327,7 +326,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{
@Override
protected void updateRotation(){
if(target != null && (state.is(repair) || state.is(mine))){
if(target != null && ((state.is(repair) && target.distanceTo(this) < type.range) || state.is(mine))){
rotation = Mathf.slerpDelta(rotation, angleTo(target), 0.3f);
}else{
rotation = Mathf.slerpDelta(rotation, velocity.angle(), 0.3f);
@@ -353,7 +352,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{
TargetTrait entity = target;
if(entity instanceof TileEntity && state.is(repair)){
if(entity instanceof TileEntity && state.is(repair) && target.distanceTo(this) < type.range){
float len = 5f;
Draw.color(Color.BLACK, Color.WHITE, 0.95f + Mathf.absin(Timers.time(), 0.8f, 0.05f));
Shapes.laser("beam", "beam-end",

View File

@@ -206,22 +206,12 @@ public abstract class InputHandler extends InputAdapter{
consumed = true;
showedInventory = true;
}
if(tile.block().consumes.hasAny()){
frag.consume.show(tile);
consumed = true;
showedConsume = true;
}
}
if(!showedInventory){
frag.inv.hide();
}
if(!showedConsume){
frag.consume.hide();
}
if(!consumed && player.isBuilding()){
player.clearBuilding();
recipe = null;
@@ -231,9 +221,7 @@ public abstract class InputHandler extends InputAdapter{
return consumed;
}
/**
* Tries to select the player to drop off items, returns true if successful.
*/
/**Tries to select the player to drop off items, returns true if successful.*/
boolean tryTapPlayer(float x, float y){
if(canTapPlayer(x, y)){
droppingItem = true;
@@ -246,9 +234,7 @@ public abstract class InputHandler extends InputAdapter{
return Vector2.dst(x, y, player.x, player.y) <= playerSelectRange && player.inventory.hasItem();
}
/**
* Tries to begin mining a tile, returns true if successful.
*/
/**Tries to begin mining a tile, returns true if successful.*/
boolean tryBeginMine(Tile tile){
if(canMine(tile)){
//if a block is clicked twice, reset it

View File

@@ -6,10 +6,10 @@ import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.game.UnlockableContent;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.world.meta.StatValue;
import io.anuke.ucore.scene.event.HandCursorListener;
import io.anuke.ucore.scene.ui.Image;
import io.anuke.ucore.scene.ui.ScrollPane;
import io.anuke.ucore.scene.ui.Tooltip;
import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.scene.utils.UIUtils;
@@ -65,10 +65,7 @@ public class UnlocksDialog extends FloatingDialog{
if(control.unlocks.isUnlocked(unlock)){
image.clicked(() -> Vars.ui.content.show(unlock));
image.addListener(new Tooltip<>(new Table("clear"){{
add(unlock.localizedName());
margin(4);
}}));
StatValue.addToolTip(image, unlock);
}
if((++count) % maxWidth == 0){

View File

@@ -12,6 +12,7 @@ import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.consumers.Consume;
import io.anuke.ucore.core.Graphics;
import io.anuke.ucore.scene.Element;
import io.anuke.ucore.scene.Group;
import io.anuke.ucore.scene.ui.layout.Table;
@@ -19,6 +20,7 @@ import static io.anuke.mindustry.Vars.*;
public class BlockConsumeFragment extends Fragment{
private Table table;
private Tile lastTile;
private boolean visible;
@Override
@@ -26,6 +28,24 @@ public class BlockConsumeFragment extends Fragment{
table = new Table();
table.visible(() -> !state.is(State.menu) && visible);
table.setTransform(true);
parent.addChild(new Element(){{update(() -> {
if(!ui.hasMouse()){
Tile tile = world.tileWorld(Graphics.mouseWorld().x, Graphics.mouseWorld().y);
if(tile == null) return;
tile = tile.target();
if(tile != lastTile){
if(tile.block().consumes.hasAny()){
show(tile);
}else if(visible){
hide();
}
lastTile = tile;
}
}
});}});
parent.setTransform(true);
parent.addChild(table);
}
@@ -66,7 +86,7 @@ public class BlockConsumeFragment extends Fragment{
rebuild(block, entity);
}
Vector2 v = Graphics.screen(tile.drawx() - tile.block().size * tilesize / 2f, tile.drawy() + tile.block().size * tilesize / 2f);
Vector2 v = Graphics.screen(tile.drawx() - tile.block().size * tilesize / 2f + 0.25f, tile.drawy() + tile.block().size * tilesize / 2f);
table.pack();
table.setPosition(v.x, v.y, Align.topRight);
});
@@ -76,8 +96,7 @@ public class BlockConsumeFragment extends Fragment{
public void hide(){
table.clear();
table.update(() -> {
});
table.update(() -> {});
visible = false;
}

View File

@@ -101,14 +101,6 @@ public class Tile implements PosTrait, TargetTrait{
return -1;
}
public byte sizedRelativeTo(int cx, int cy){
if(x == cx && y == cy - 1 - block().size / 2) return 1;
if(x == cx && y == cy + 1 + block().size / 2) return 3;
if(x == cx - 1 - block().size / 2 && y == cy) return 0;
if(x == cx + 1 + block().size / 2 && y == cy) return 2;
return -1;
}
public <T extends TileEntity> T entity(){
return (T) entity;
}

View File

@@ -14,6 +14,7 @@ import io.anuke.mindustry.graphics.Layer;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Edges;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.meta.BlockGroup;
import io.anuke.ucore.core.Timers;
@@ -265,7 +266,8 @@ public class ItemBridge extends Block{
Tile other = world.tile(entity.link);
if(!linkValid(tile, other)){
int i = tile.absoluteRelativeTo(to.x, to.y);
Tile edge = Edges.getFacingEdge(to, tile);
int i = tile.absoluteRelativeTo(edge.x, edge.y);
IntSetIterator it = entity.incoming.iterator();

View File

@@ -37,27 +37,62 @@ public class PowerGraph{
lastFrameUpdated = threads.getFrameID();
boolean charge = false;
float totalInput = 0f;
float bufferInput = 0f;
for(Tile producer : producers){
totalInput += producer.entity.power.amount;
if (producer.block().consumesPower) {
bufferInput += producer.entity.power.amount;
} else {
totalInput += producer.entity.power.amount;
}
}
float maxOutput = 0f;
float bufferOutput = 0f;
for(Tile consumer : consumers){
maxOutput += consumer.block().powerCapacity - consumer.entity.power.amount;
if (consumer.block().outputsPower) {
bufferOutput += consumer.block().powerCapacity - consumer.entity.power.amount;
} else {
maxOutput += consumer.block().powerCapacity - consumer.entity.power.amount;
}
}
if (totalInput <= 0.0001f || maxOutput <= 0.0001f) {
if (maxOutput < totalInput) {
charge = true;
}
if (totalInput + bufferInput <= 0.0001f || maxOutput + bufferOutput <= 0.0001f) {
return;
}
float inputUsed = Math.min(maxOutput / totalInput, 1f);
float bufferUsed = 0;
if (charge) {
bufferUsed = Math.min((totalInput - maxOutput) / bufferOutput, 1f);
} else {
bufferUsed = Math.min((maxOutput - totalInput) / bufferInput, 1f);
}
float inputUsed = charge ? Math.min((maxOutput + bufferOutput) / totalInput, 1f) : 1f;
for(Tile producer : producers){
if (producer.block().consumesPower) {
if (!charge) {
producer.entity.power.amount -= producer.entity.power.amount * bufferUsed;
}
continue;
}
producer.entity.power.amount -= producer.entity.power.amount * inputUsed;
}
float outputSatisfied = Math.min(totalInput / maxOutput, 1f);
float outputSatisfied = charge ? 1f : Math.min((totalInput + bufferInput) / maxOutput, 1f);
for(Tile consumer : consumers){
if (consumer.block().outputsPower) {
if (charge) {
consumer.entity.power.amount += (consumer.block().powerCapacity - consumer.entity.power.amount) * bufferUsed;
}
continue;
}
consumer.entity.power.amount += (consumer.block().powerCapacity - consumer.entity.power.amount) * outputSatisfied;
}
}

View File

@@ -42,6 +42,7 @@ public class Cultivator extends Drill{
stats.remove(BlockStat.drillTier);
stats.add(BlockStat.drillTier, table -> {
table.addImage("grass1").size(8 * 3).padBottom(3).padTop(3);
// TODO: find out localized name and add tool tip
});
}

View File

@@ -16,11 +16,14 @@ import io.anuke.mindustry.world.consumers.ConsumeLiquid;
import io.anuke.mindustry.world.meta.BlockGroup;
import io.anuke.mindustry.world.meta.BlockStat;
import io.anuke.mindustry.world.meta.StatUnit;
import io.anuke.mindustry.world.meta.StatValue;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.core.Graphics;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.scene.ui.Image;
import io.anuke.ucore.scene.ui.layout.Cell;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Threads;
@@ -133,7 +136,8 @@ public class Drill extends Block{
for(int i = 0; i < list.size; i++){
Item item = list.get(i);
table.addImage(item.name + "1").size(8 * 3).padRight(2).padLeft(2).padTop(3).padBottom(3);
Cell<Image> imageCell = table.addImage(item.name + "1").size(8 * 3).padRight(2).padLeft(2).padTop(3).padBottom(3);
StatValue.addToolTip(imageCell.getElement(), item);
if(i != list.size - 1){
table.add("/");
}

View File

@@ -64,15 +64,11 @@ public class Pump extends LiquidBlock{
if(isMultiblock()){
Liquid last = null;
for(Tile other : tile.getLinkedTilesAs(this, drawTiles)){
if(other == null) return false;
//can't place pump on block with multiple liquids
if(last != null && other.floor().liquidDrop != last){
if(other.floor().liquidDrop == null)
continue;
if(other.floor().liquidDrop != last && last != null)
return false;
}
if(isValid(other)){
last = other.floor().liquidDrop;
}
last = other.floor().liquidDrop;
}
return last != null;
}else{

View File

@@ -81,11 +81,15 @@ public class CommandCenter extends Block{
public void buildTable(Tile tile, Table table){
CommandCenterEntity entity = tile.entity();
ButtonGroup<ImageButton> group = new ButtonGroup<>();
Table buttons = new Table();
for(UnitCommand cmd : UnitCommand.values()){
table.addImageButton("command-" + cmd.name(), "toggle", 8*3, () -> threads.run(() -> Call.onCommandCenterSet(players[0], tile, cmd))).size(40f, 44f)
buttons.addImageButton("command-" + cmd.name(), "toggle", 8*3, () -> threads.run(() -> Call.onCommandCenterSet(players[0], tile, cmd))).size(40f, 44f)
.checked(entity.command == cmd).group(group);
}
table.add(buttons);
table.row();
table.table("button", t -> t.label(() -> entity.command.localized()).center().growX()).growX().padTop(-5);
}
@Remote(called = Loc.server, forward = true, targets = Loc.both)

View File

@@ -1,5 +1,10 @@
package io.anuke.mindustry.world.meta;
import io.anuke.mindustry.game.UnlockableContent;
import io.anuke.ucore.scene.Element;
import io.anuke.ucore.scene.ui.Image;
import io.anuke.ucore.scene.ui.Tooltip;
import io.anuke.ucore.scene.ui.layout.Cell;
import io.anuke.ucore.scene.ui.layout.Table;
/**
@@ -7,8 +12,38 @@ import io.anuke.ucore.scene.ui.layout.Table;
*/
public interface StatValue{
/**
* This method should all elements necessary to display this stat to the specified table.
* This method should provide all elements necessary to display this stat to the specified table.
* For example, a stat that is just text would add label to the table.
*/
void display(Table table);
/**
* This method adds an icon image together with a tool tip which contains the name of the item.
* @param table the table to add the image cell to.
* @param item The item which provides the tool tip content.
* @return the image cell which was created. The cell is not yet sized or padded.
*/
static Cell<Image> addImageWithToolTip(Table table, UnlockableContent item){
// Create a table cell with a new image as provided by the item
Cell<Image> imageCell = table.addImage(item.getContentIcon());
// Retrieve the image and add a tool tip with the item's name
addToolTip(imageCell.getElement(), item);
// Return the table cell for further processing (sizing, padding, ...)
return imageCell;
}
/**
* Adds a tool tip containing the item's localized name to the given element.
* @param element The element to assign the tool tip to.
* @param item The item which provides the tool tip content.
*/
static void addToolTip(Element element, UnlockableContent item){
element.addListener(new Tooltip<>(new Table("clear"){{
add(item.localizedName());
margin(4);
}}));
}
}

View File

@@ -4,6 +4,8 @@ import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.world.meta.StatValue;
import io.anuke.ucore.function.Predicate;
import io.anuke.ucore.scene.ui.Image;
import io.anuke.ucore.scene.ui.layout.Cell;
import io.anuke.ucore.scene.ui.layout.Table;
import static io.anuke.mindustry.Vars.*;
@@ -24,7 +26,12 @@ public class ItemFilterValue implements StatValue{
for(int i = 0; i < list.size; i++){
Item item = list.get(i);
table.addImage(item.region).size(8 * 3).padRight(2).padLeft(2);
Cell<Image> imageCell = table.addImage(item.region);
imageCell.size(8 * 3).padRight(2).padLeft(2);
StatValue.addToolTip(imageCell.getElement(), item);
if(i != list.size - 1){
table.add("/");
}

View File

@@ -5,6 +5,9 @@ import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.ui.ItemImage;
import io.anuke.mindustry.world.meta.ContentStatValue;
import io.anuke.mindustry.world.meta.StatValue;
import io.anuke.ucore.scene.ui.Image;
import io.anuke.ucore.scene.ui.layout.Cell;
import io.anuke.ucore.scene.ui.layout.Table;
public class ItemListValue implements ContentStatValue{
@@ -38,11 +41,17 @@ public class ItemListValue implements ContentStatValue{
public void display(Table table){
if(items != null){
for(Item item : items){
table.addImage(item.region).size(8 * 3).padRight(5);
Cell<Image> imageCell = table.addImage(item.region);
imageCell.size(8 * 3).padRight(5);
StatValue.addToolTip(imageCell.getElement(), item);
}
}else{
for(ItemStack stack : stacks){
table.add(new ItemImage(stack)).size(8 * 3).padRight(5);
ItemImage image = new ItemImage(stack);
table.add(image).size(8 * 3).padRight(5);
StatValue.addToolTip(image, stack.item);
}
}
}

View File

@@ -5,6 +5,7 @@ import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.ui.ItemImage;
import io.anuke.mindustry.world.meta.ContentStatValue;
import io.anuke.mindustry.world.meta.StatValue;
import io.anuke.ucore.scene.ui.layout.Table;
public class ItemValue implements ContentStatValue{
@@ -22,6 +23,8 @@ public class ItemValue implements ContentStatValue{
@Override
public void display(Table table){
//TODO better implementation, quantity support
table.add(new ItemImage(item)).size(8 * 3);
ItemImage image = new ItemImage(item);
table.add(image).size(8 * 3);
StatValue.addToolTip(image, item.item);
}
}

View File

@@ -4,6 +4,9 @@ import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.type.Liquid;
import io.anuke.mindustry.world.meta.StatValue;
import io.anuke.ucore.function.Predicate;
import io.anuke.ucore.scene.ui.Image;
import io.anuke.ucore.scene.ui.Tooltip;
import io.anuke.ucore.scene.ui.layout.Cell;
import io.anuke.ucore.scene.ui.layout.Table;
import static io.anuke.mindustry.Vars.*;
@@ -24,7 +27,10 @@ public class LiquidFilterValue implements StatValue{
for(int i = 0; i < list.size; i++){
Liquid item = list.get(i);
table.addImage(item.getContentIcon()).size(8 * 3).padRight(2).padLeft(2).padTop(2).padBottom(2);
Cell<Image> imageCell = StatValue.addImageWithToolTip(table, item);
imageCell.size(8 * 3).padRight(2).padLeft(2).padTop(2).padBottom(2);
if(i != list.size - 1){
table.add("/");
}

View File

@@ -3,6 +3,9 @@ package io.anuke.mindustry.world.meta.values;
import io.anuke.mindustry.game.UnlockableContent;
import io.anuke.mindustry.type.Liquid;
import io.anuke.mindustry.world.meta.ContentStatValue;
import io.anuke.mindustry.world.meta.StatValue;
import io.anuke.ucore.scene.ui.Image;
import io.anuke.ucore.scene.ui.layout.Cell;
import io.anuke.ucore.scene.ui.layout.Table;
public class LiquidValue implements ContentStatValue{
@@ -19,6 +22,7 @@ public class LiquidValue implements ContentStatValue{
@Override
public void display(Table table){
table.addImage(liquid.getContentIcon()).size(8 * 3);
Cell<Image> imageCell = StatValue.addImageWithToolTip(table, liquid);
imageCell.size(8 * 3);
}
}