deselectable content selection UI (#6205)

This commit is contained in:
JrTRinny
2021-10-21 12:40:34 -04:00
committed by GitHub
parent 4dc2164468
commit f944d3d579
4 changed files with 34 additions and 2 deletions
@@ -6,6 +6,7 @@ import arc.scene.ui.layout.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.*;
import mindustry.gen.*;
import mindustry.world.*;
import mindustry.world.blocks.*;
import mindustry.world.blocks.storage.*;
@@ -57,6 +58,17 @@ public class Constructor extends BlockProducer{
ItemSelection.buildTable(table, content.blocks().select(Constructor.this::canProduce), () -> recipe, this::configure);
}
@Override
public boolean onConfigureTileTapped(Building other){
if(this == other){
deselect();
configure(null);
return false;
}
return true;
}
@Override
public Object config(){
return recipe;
@@ -91,6 +91,17 @@ public class PayloadSource extends PayloadBlock{
() -> (UnlockableContent)config(), this::configure);
}
@Override
public boolean onConfigureTileTapped(Building other){
if(this == other){
deselect();
configure(null);
return false;
}
return true;
}
@Override
public Object config(){
return unit == null ? block : unit;
@@ -166,6 +166,17 @@ public class UnitFactory extends UnitBlock{
}
}
@Override
public boolean onConfigureTileTapped(Building other){
if(this == other){
deselect();
configure(null);
return false;
}
return true;
}
@Override
public boolean acceptPayload(Building source, Payload payload){
return false;