Right menu removed in editor mode
This commit is contained in:
@@ -124,9 +124,7 @@ public class PlacementFragment{
|
||||
toggler.setZIndex(index);
|
||||
}
|
||||
|
||||
boolean gridUpdate(InputHandler input){
|
||||
scrollPositions.put(currentCategory, blockPane.getScrollY());
|
||||
|
||||
boolean updatePick(InputHandler input){
|
||||
if(Core.input.keyTap(Binding.pick) && player.isBuilder() && !Core.scene.hasDialog()){ //mouse eyedropper select
|
||||
var build = world.buildWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
||||
|
||||
@@ -150,9 +148,9 @@ public class PlacementFragment{
|
||||
var tile = world.tileWorld(Core.input.mouseWorldX(), Core.input.mouseWorldY());
|
||||
if(tile != null){
|
||||
tryRecipe =
|
||||
tile.block() != Blocks.air ? tile.block() :
|
||||
tile.overlay() != Blocks.air ? tile.overlay() :
|
||||
tile.floor() != Blocks.air ? tile.floor() : null;
|
||||
tile.block() != Blocks.air ? tile.block() :
|
||||
tile.overlay() != Blocks.air ? tile.overlay() :
|
||||
tile.floor() != Blocks.air ? tile.floor() : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,6 +163,15 @@ public class PlacementFragment{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean gridUpdate(InputHandler input){
|
||||
scrollPositions.put(currentCategory, blockPane.getScrollY());
|
||||
|
||||
if(updatePick(input)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(ui.chatfrag.shown() || ui.consolefrag.shown() || Core.scene.hasKeyboard()) return false;
|
||||
|
||||
@@ -258,7 +265,14 @@ public class PlacementFragment{
|
||||
public void build(Group parent){
|
||||
parent.fill(full -> {
|
||||
toggler = full;
|
||||
full.bottom().right().visible(() -> ui.hudfrag.shown);
|
||||
full.bottom().right().visible(() -> {
|
||||
if(state.rules.editor){
|
||||
//force update the mouse picking, since it otherwise would not happen
|
||||
updatePick(control.input);
|
||||
}
|
||||
|
||||
return ui.hudfrag.shown && !state.rules.editor;
|
||||
});
|
||||
|
||||
full.table(frame -> {
|
||||
|
||||
@@ -644,7 +658,11 @@ public class PlacementFragment{
|
||||
}).grow().get();
|
||||
blockPane.setStyle(Styles.smallPane);
|
||||
blocksSelect.row();
|
||||
blocksSelect.table(control.input::buildPlacementUI).name("inputTable").growX();
|
||||
blocksSelect.table(t -> {
|
||||
t.image().color(Pal.gray).height(4f).colspan(4).growX();
|
||||
t.row();
|
||||
control.input.buildPlacementUI(t);
|
||||
}).name("inputTable").growX();
|
||||
}).fillY().bottom().touchable(Touchable.enabled);
|
||||
blockCatTable.table(categories -> {
|
||||
categories.bottom();
|
||||
@@ -730,13 +748,14 @@ public class PlacementFragment{
|
||||
return control.input.block != null || menuHoverBlock != null || hover != null;
|
||||
}
|
||||
|
||||
/** Returns the thing being hovered over. */
|
||||
@Nullable
|
||||
Displayable hovered(){
|
||||
Vec2 v = topTable.stageToLocalCoordinates(Core.input.mouse());
|
||||
/** @return the thing being hovered over. */
|
||||
public @Nullable Displayable hovered(){
|
||||
if(!state.rules.editor){
|
||||
Vec2 v = topTable.stageToLocalCoordinates(Core.input.mouse());
|
||||
|
||||
//if the mouse intersects the table or the UI has the mouse, no hovering can occur
|
||||
if(Core.scene.hasMouse() || topTable.hit(v.x, v.y, false) != null) return null;
|
||||
//if the mouse intersects the table or the UI has the mouse, no hovering can occur
|
||||
if(Core.scene.hasMouse() || topTable.hit(v.x, v.y, false) != null) return null;
|
||||
}
|
||||
|
||||
//check for a unit
|
||||
Unit unit = Units.closestOverlap(player.team(), Core.input.mouseWorldX(), Core.input.mouseWorldY(), 5f, u -> !u.isLocal() && u.displayable());
|
||||
|
||||
Reference in New Issue
Block a user