it is done
This commit is contained in:
27
core/src/mindustry/ui/ItemDisplay.java
Normal file
27
core/src/mindustry/ui/ItemDisplay.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package mindustry.ui;
|
||||
|
||||
import arc.scene.ui.layout.Table;
|
||||
import mindustry.type.Item;
|
||||
import mindustry.type.ItemStack;
|
||||
|
||||
/** An item image with text. */
|
||||
public class ItemDisplay extends Table{
|
||||
public final Item item;
|
||||
public final int amount;
|
||||
|
||||
public ItemDisplay(Item item){
|
||||
this(item, 0);
|
||||
}
|
||||
|
||||
public ItemDisplay(Item item, int amount, boolean showName){
|
||||
add(new ItemImage(new ItemStack(item, amount))).size(8 * 4).padRight(amount > 99 ? 12 : 0);
|
||||
if(showName) add(item.localizedName).padLeft(4 + amount > 99 ? 4 : 0);
|
||||
|
||||
this.item = item;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public ItemDisplay(Item item, int amount){
|
||||
this(item, amount, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user