Flipped place menu

This commit is contained in:
Anuken
2018-11-18 23:19:39 -05:00
parent 19ac8bd9b2
commit ba01ed0153

View File

@@ -38,7 +38,6 @@ public class PlacementFragment extends Fragment{
@Override @Override
public void build(Group parent){ public void build(Group parent){
parent.fill(frame -> { parent.fill(frame -> {
frame.clear();
InputHandler input = control.input(0); InputHandler input = control.input(0);
//rebuilds the category table with the correct recipes //rebuilds the category table with the correct recipes
@@ -63,7 +62,7 @@ public class PlacementFragment extends Fragment{
if(control.unlocks.isUnlocked(recipe)){ if(control.unlocks.isUnlocked(recipe)){
input.recipe = input.recipe == recipe ? null : recipe; input.recipe = input.recipe == recipe ? null : recipe;
} }
}).size(50f).group(group).get(); }).size(46f).group(group).get();
button.update(() -> { //color unplacable things gray button.update(() -> { //color unplacable things gray
boolean ulock = control.unlocks.isUnlocked(recipe); boolean ulock = control.unlocks.isUnlocked(recipe);
@@ -95,7 +94,7 @@ public class PlacementFragment extends Fragment{
blockTable.act(0f); blockTable.act(0f);
}; };
frame.bottom().left().visible(() -> !state.is(State.menu)); frame.bottom().right().visible(() -> !state.is(State.menu));
frame.table("clear", top -> { frame.table("clear", top -> {
top.add(new Table()).growX().update(topTable -> { top.add(new Table()).growX().update(topTable -> {
@@ -113,7 +112,7 @@ public class PlacementFragment extends Fragment{
header.add(new ImageStack(lastDisplay.getCompactIcon())).size(8*4); header.add(new ImageStack(lastDisplay.getCompactIcon())).size(8*4);
header.labelWrap(() -> header.labelWrap(() ->
!control.unlocks.isUnlocked(Recipe.getByResult(lastDisplay)) ? Bundles.get("text.blocks.unknown") : lastDisplay.formalName) !control.unlocks.isUnlocked(Recipe.getByResult(lastDisplay)) ? Bundles.get("text.blocks.unknown") : lastDisplay.formalName)
.left().width(200f).padLeft(5); .left().width(190f).padLeft(5);
header.add().growX(); header.add().growX();
if(control.unlocks.isUnlocked(Recipe.getByResult(lastDisplay))){ if(control.unlocks.isUnlocked(Recipe.getByResult(lastDisplay))){
header.addButton("?", "clear-partial", () -> ui.content.show(Recipe.getByResult(lastDisplay))) header.addButton("?", "clear-partial", () -> ui.content.show(Recipe.getByResult(lastDisplay)))
@@ -147,13 +146,15 @@ public class PlacementFragment extends Fragment{
}else if(tileDisplayBlock() != null){ //show selected tile }else if(tileDisplayBlock() != null){ //show selected tile
lastDisplay = tileDisplayBlock(); lastDisplay = tileDisplayBlock();
topTable.add(new ImageStack(lastDisplay.getDisplayIcon(hoverTile))).size(8*4); topTable.add(new ImageStack(lastDisplay.getDisplayIcon(hoverTile))).size(8*4);
topTable.labelWrap(lastDisplay.getDisplayName(hoverTile)).left().width(200f).padLeft(5); topTable.labelWrap(lastDisplay.getDisplayName(hoverTile)).left().width(190f).padLeft(5);
} }
}); });
top.row(); top.row();
top.addImage("blank").growX().color(Palette.accent).height(3f); top.addImage("blank").growX().color(Palette.accent).height(3f);
}).colspan(3).fillX().visible(() -> getSelected() != null || tileDisplayBlock() != null).touchable(Touchable.enabled); }).colspan(3).fillX().visible(() -> getSelected() != null || tileDisplayBlock() != null).touchable(Touchable.enabled);
frame.row(); frame.row();
frame.table("clear", blocks -> blockTable = blocks).fillY().bottom().touchable(Touchable.enabled);
frame.addImage("blank").width(3f).fillY().color(Palette.accent);
frame.table(categories -> { frame.table(categories -> {
categories.defaults().size(48f); categories.defaults().size(48f);
@@ -170,9 +171,6 @@ public class PlacementFragment extends Fragment{
if(cat.ordinal() %2 == 1) categories.row(); if(cat.ordinal() %2 == 1) categories.row();
} }
}).touchable(Touchable.enabled); }).touchable(Touchable.enabled);
frame.addImage("blank").width(3f).fillY().color(Palette.accent);
frame.table("clear", blocks -> blockTable = blocks).fillY().bottom().touchable(Touchable.enabled);
rebuildCategory.run(); rebuildCategory.run();
}); });