Updated inventory menu, weapon factory mechanics
This commit is contained in:
@@ -13,6 +13,8 @@ import io.anuke.ucore.scene.Group;
|
||||
import io.anuke.ucore.scene.actions.Actions;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
|
||||
public class BlockConfigFragment implements Fragment {
|
||||
private Table table = new Table();
|
||||
private Tile configTile;
|
||||
@@ -43,8 +45,8 @@ public class BlockConfigFragment implements Fragment {
|
||||
|
||||
table.update(() -> {
|
||||
table.setOrigin(Align.center);
|
||||
Vector2 pos = Graphics.screen(tile.drawx(), tile.drawy());
|
||||
table.setPosition(pos.x, pos.y, Align.center);
|
||||
Vector2 pos = Graphics.screen(tile.drawx(), tile.drawy() - tile.block().size * tilesize/2f - 1);
|
||||
table.setPosition(pos.x, pos.y, Align.top);
|
||||
if(configTile == null || configTile.block() == Blocks.air){
|
||||
hideConfig();
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
|
||||
public class BlockInventoryFragment implements Fragment {
|
||||
private Table table;
|
||||
@@ -127,7 +128,7 @@ public class BlockInventoryFragment implements Fragment {
|
||||
}
|
||||
|
||||
if(row == 0){
|
||||
table.addImage("icon-items-none").color(Color.LIGHT_GRAY);
|
||||
table.setSize(0f, 0f);
|
||||
}
|
||||
|
||||
updateTablePosition();
|
||||
@@ -143,9 +144,9 @@ public class BlockInventoryFragment implements Fragment {
|
||||
}
|
||||
|
||||
private void updateTablePosition(){
|
||||
Vector2 v = Graphics.screen(tile.drawx(), tile.drawy());
|
||||
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.center);
|
||||
table.setPosition(v.x, v.y, Align.topLeft);
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server, targets = Loc.both, in = In.blocks)
|
||||
|
||||
Reference in New Issue
Block a user