Added requirement display / Text fixes / Better crash reports
This commit is contained in:
@@ -18,9 +18,7 @@ public class ItemImage extends Stack {
|
||||
t.row();
|
||||
t.label(text).get().setFontScale(Unit.dp.scl(0.5f));
|
||||
|
||||
Image image = new Image(region);
|
||||
|
||||
add(image);
|
||||
add(new Image(region));
|
||||
add(t);
|
||||
}
|
||||
|
||||
@@ -31,9 +29,7 @@ public class ItemImage extends Stack {
|
||||
t.row();
|
||||
t.add(stack.amount + "").get().setFontScale(Unit.dp.scl(0.5f));
|
||||
|
||||
Image image = new Image(stack.item.region);
|
||||
|
||||
add(image);
|
||||
add(new Image(stack.item.region));
|
||||
add(t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import io.anuke.ucore.scene.ui.layout.Table;
|
||||
public class ContentInfoDialog extends FloatingDialog {
|
||||
|
||||
public ContentInfoDialog(){
|
||||
super("$text.info");
|
||||
super("$text.info.title");
|
||||
|
||||
addCloseButton();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.badlogic.gdx.utils.ObjectSet;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.consumers.Consume;
|
||||
@@ -13,8 +15,7 @@ import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.scene.Group;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class BlockConsumeFragment extends Fragment {
|
||||
private Table table;
|
||||
@@ -33,6 +34,9 @@ public class BlockConsumeFragment extends Fragment {
|
||||
ObjectSet<Consume> consumers = new ObjectSet<>();
|
||||
TileEntity entity = tile.entity;
|
||||
Block block = tile.block();
|
||||
Consume[] lastCurrent = {null};
|
||||
|
||||
table.clearChildren();
|
||||
|
||||
//table.background("clear");
|
||||
rebuild(block, entity);
|
||||
@@ -64,7 +68,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, tile.drawy() + tile.block().size * tilesize/2f);
|
||||
table.pack();
|
||||
table.setPosition(v.x, v.y, Align.topRight);
|
||||
});
|
||||
@@ -80,10 +84,27 @@ public class BlockConsumeFragment extends Fragment {
|
||||
|
||||
private void rebuild(Block block, TileEntity entity){
|
||||
table.clearChildren();
|
||||
table.left();
|
||||
|
||||
int scale = mobile ? 4 : 3;
|
||||
|
||||
for(Consume c : block.consumes.array()){
|
||||
if(!c.isOptional() && !c.valid(block, entity)){
|
||||
c.build(table);
|
||||
boolean[] hovered = {false};
|
||||
|
||||
table.table("inventory", c::buildTooltip).visible(() -> hovered[0]).height(scale * 10 + 6).padBottom(-4).right().update(t -> {
|
||||
if(t.getChildren().size == 0) t.remove();
|
||||
});
|
||||
|
||||
Table result = table.table(out -> {
|
||||
out.addImage(c.getIcon()).size(10*scale).color(Color.DARK_GRAY).padRight(-10*scale).padBottom(-scale*2);
|
||||
out.addImage(c.getIcon()).size(10*scale).color(Palette.accent);
|
||||
out.addImage("icon-missing").size(10*scale).color(Palette.remove).padLeft(-10*scale);
|
||||
}).size(10*scale).get();
|
||||
|
||||
result.hovered(() -> hovered[0] = true);
|
||||
result.exited(() -> hovered[0] = false);
|
||||
|
||||
table.row();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user