Replaced tooltips with names
This commit is contained in:
18
core/src/io/anuke/mindustry/ui/ItemDisplay.java
Normal file
18
core/src/io/anuke/mindustry/ui/ItemDisplay.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
/**An item image with text.*/
|
||||
public class ItemDisplay extends Table{
|
||||
|
||||
public ItemDisplay(Item item){
|
||||
this(item, 0);
|
||||
}
|
||||
|
||||
public ItemDisplay(Item item, int amount){
|
||||
add(new ItemImage(new ItemStack(item, amount))).size(8*3);
|
||||
add(item.localizedName()).padLeft(4);
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,12 @@ public class ItemImage extends Stack{
|
||||
}
|
||||
|
||||
public ItemImage(ItemStack stack){
|
||||
Table t = new Table().left().bottom();
|
||||
t.add(stack.amount + "");
|
||||
|
||||
add(new Image(stack.item.region));
|
||||
add(t);
|
||||
|
||||
if(stack.amount != 0){
|
||||
Table t = new Table().left().bottom();
|
||||
t.add(stack.amount + "");
|
||||
add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
14
core/src/io/anuke/mindustry/ui/LiquidDisplay.java
Normal file
14
core/src/io/anuke/mindustry/ui/LiquidDisplay.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.ucore.scene.ui.Image;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
/**An ItemDisplay, but for liquids.*/
|
||||
public class LiquidDisplay extends Table{
|
||||
|
||||
public LiquidDisplay(Liquid liquid){
|
||||
add(new Image(liquid.getContentIcon())).size(8*3);
|
||||
add(liquid.localizedName()).padLeft(3);
|
||||
}
|
||||
}
|
||||
@@ -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,7 +65,10 @@ public class UnlocksDialog extends FloatingDialog{
|
||||
|
||||
if(control.unlocks.isUnlocked(unlock)){
|
||||
image.clicked(() -> Vars.ui.content.show(unlock));
|
||||
StatValue.addToolTip(image, unlock);
|
||||
image.addListener(new Tooltip<>(new Table("clear"){{
|
||||
add(unlock.localizedName());
|
||||
margin(4);
|
||||
}}));
|
||||
}
|
||||
|
||||
if((++count) % maxWidth == 0){
|
||||
|
||||
@@ -89,7 +89,7 @@ public class PlacementFragment extends Fragment{
|
||||
topTable.table(header -> {
|
||||
header.left();
|
||||
header.add(new ImageStack(lastDisplay.getCompactIcon())).size(8*4);
|
||||
header.labelWrap(lastDisplay.formalName).left().width(150f).padLeft(5);
|
||||
header.labelWrap(lastDisplay.formalName).left().width(200f).padLeft(5);
|
||||
}).growX().left();
|
||||
topTable.row();
|
||||
//add requirement table
|
||||
|
||||
Reference in New Issue
Block a user