Bugfixes / Requirement display
This commit is contained in:
@@ -10,6 +10,14 @@ import io.anuke.arc.scene.ui.layout.Table;
|
||||
|
||||
public class ItemImage extends Stack{
|
||||
|
||||
public ItemImage(TextureRegion region, int amount){
|
||||
Table t = new Table().left().bottom();
|
||||
t.add(amount + "").name("item-label");
|
||||
|
||||
add(new Image(region));
|
||||
add(t);
|
||||
}
|
||||
|
||||
public ItemImage(TextureRegion region, Supplier<CharSequence> text){
|
||||
Table t = new Table().left().bottom();
|
||||
t.label(text).name("item-label");
|
||||
|
||||
36
core/src/io/anuke/mindustry/ui/ReqImage.java
Normal file
36
core/src/io/anuke/mindustry/ui/ReqImage.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
|
||||
import io.anuke.arc.function.BooleanProvider;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.Lines;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.scene.Element;
|
||||
import io.anuke.arc.scene.ui.Image;
|
||||
import io.anuke.arc.scene.ui.layout.Stack;
|
||||
import io.anuke.arc.scene.ui.layout.Unit;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
|
||||
public class ReqImage extends Stack{
|
||||
|
||||
public ReqImage(Element image, BooleanProvider valid){
|
||||
add(image);
|
||||
add(new Element(){
|
||||
{
|
||||
visible(() -> !valid.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
Lines.stroke(Unit.dp.scl(2f), Pal.removeBack);
|
||||
Lines.line(x, y - 2f + height, x + width, y - 2f);
|
||||
Draw.color(Pal.remove);
|
||||
Lines.line(x, y + height, x + width, y);
|
||||
Draw.reset();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public ReqImage(TextureRegion region, BooleanProvider valid){
|
||||
this(new Image(region), valid);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user