mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-13 19:39:04 +07:00
Cleanup
This commit is contained in:
parent
96329b9b2e
commit
da1517879a
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1006 B |
Binary file not shown.
Before Width: | Height: | Size: 630 B After Width: | Height: | Size: 483 B |
@ -635,8 +635,8 @@ public class Renderer implements ApplicationListener{
|
||||
|
||||
public void showLaunch(CoreBlock coreType){
|
||||
Vars.ui.hudfrag.showLaunch();
|
||||
Vars.control.input.frag.config.hideConfig();
|
||||
Vars.control.input.frag.inv.hide();
|
||||
Vars.control.input.config.hideConfig();
|
||||
Vars.control.input.inv.hide();
|
||||
launchCoreType = coreType;
|
||||
launching = true;
|
||||
landCore = player.team().core();
|
||||
|
@ -212,10 +212,10 @@ public class UI implements ApplicationListener, Loadable{
|
||||
|
||||
hudfrag.build(hudGroup);
|
||||
menufrag.build(menuGroup);
|
||||
chatfrag.container().build(hudGroup);
|
||||
chatfrag.build(hudGroup);
|
||||
minimapfrag.build(hudGroup);
|
||||
listfrag.build(hudGroup);
|
||||
scriptfrag.container().build(hudGroup);
|
||||
scriptfrag.build(hudGroup);
|
||||
loadfrag.build(group);
|
||||
new FadeInFragment().build(group);
|
||||
}
|
||||
|
@ -323,8 +323,8 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
|
||||
/** Deselect this tile from configuration. */
|
||||
public void deselect(){
|
||||
if(!headless && control.input.frag.config.getSelectedTile() == self()){
|
||||
control.input.frag.config.hideConfig();
|
||||
if(!headless && control.input.config.getSelected() == self()){
|
||||
control.input.config.hideConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1470,7 +1470,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
* Called when another tile is tapped while this block is selected.
|
||||
* @return whether this block should be deselected.
|
||||
*/
|
||||
public boolean onConfigureTileTapped(Building other){
|
||||
public boolean onConfigureBuildTapped(Building other){
|
||||
if(block.clearOnDoubleTap){
|
||||
if(self() == other){
|
||||
deselect();
|
||||
@ -1482,6 +1482,15 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
return self() != other;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a position is tapped when this building is selected.
|
||||
*
|
||||
* @return whether the tap event is consumed - if true, the player will not start shooting or interact with things under the cursor.
|
||||
* */
|
||||
public boolean onConfigureTapped(float x, float y){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this block's config menu is closed
|
||||
*/
|
||||
|
@ -144,8 +144,8 @@ public class OverlayRenderer{
|
||||
}
|
||||
|
||||
//draw config selected block
|
||||
if(input.frag.config.isShown()){
|
||||
Building tile = input.frag.config.getSelectedTile();
|
||||
if(input.config.isShown()){
|
||||
Building tile = input.config.getSelected();
|
||||
tile.drawConfigure();
|
||||
}
|
||||
|
||||
|
@ -613,7 +613,7 @@ public class DesktopInput extends InputHandler{
|
||||
commandRect = true;
|
||||
commandRectX = input.mouseWorldX();
|
||||
commandRectY = input.mouseWorldY();
|
||||
}else if(selected != null){
|
||||
}else if(!checkConfigTap() && selected != null){
|
||||
//only begin shooting if there's no cursor event
|
||||
if(!tryTapPlayer(Core.input.mouseWorld().x, Core.input.mouseWorld().y) && !tileTapped(selected.build) && !player.unit().activelyBuilding() && !droppingItem
|
||||
&& !(tryStopMine(selected) || (!settings.getBool("doubletapmine") || selected == prevSelected && Time.timeSinceMillis(selectMillis) < 500) && tryBeginMine(selected)) && !Core.scene.hasKeyboard()){
|
||||
|
@ -13,6 +13,7 @@ import arc.scene.event.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.ai.types.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
@ -39,6 +40,7 @@ import mindustry.world.meta.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static arc.Core.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
@ -50,8 +52,6 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
final static Rect r1 = new Rect(), r2 = new Rect();
|
||||
final static Seq<Unit> tmpUnits = new Seq<>(false);
|
||||
|
||||
public final OverlayFragment frag = new OverlayFragment();
|
||||
|
||||
/** If true, there is a cutscene currently occurring in logic. */
|
||||
public boolean logicCutscene;
|
||||
public Vec2 logicCamPan = new Vec2();
|
||||
@ -89,6 +89,11 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
private Seq<BuildPlan> plansOut = new Seq<>(BuildPlan.class);
|
||||
private QuadTree<BuildPlan> playerPlanTree = new QuadTree<>(new Rect());
|
||||
|
||||
public final BlockInventoryFragment inv;
|
||||
public final BlockConfigFragment config;
|
||||
|
||||
private WidgetGroup group = new WidgetGroup();
|
||||
|
||||
private final Eachable<BuildPlan> allPlans = cons -> {
|
||||
player.unit().plans().each(cons);
|
||||
selectPlans.each(cons);
|
||||
@ -101,6 +106,10 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
};
|
||||
|
||||
public InputHandler(){
|
||||
group.touchable = Touchable.childrenOnly;
|
||||
inv = new BlockInventoryFragment();
|
||||
config = new BlockConfigFragment();
|
||||
|
||||
Events.on(UnitDestroyEvent.class, e -> {
|
||||
if(e.unit != null && e.unit.isPlayer() && e.unit.getPlayer().isLocal() && e.unit.type.weapons.contains(w -> w.bullet.killShooter)){
|
||||
player.shooting = false;
|
||||
@ -673,6 +682,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
if(state.isMenu()){
|
||||
controlledType = null;
|
||||
logicCutscene = false;
|
||||
config.forceHide();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1092,11 +1102,15 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
updateLine(x1, y1, tileX(getMouseX()), tileY(getMouseY()));
|
||||
}
|
||||
|
||||
boolean checkConfigTap(){
|
||||
return config.isShown() && config.getSelected().onConfigureTapped(input.mouseWorldX(), input.mouseWorldY());
|
||||
}
|
||||
|
||||
/** Handles tile tap events that are not platform specific. */
|
||||
boolean tileTapped(@Nullable Building build){
|
||||
if(build == null){
|
||||
frag.inv.hide();
|
||||
frag.config.hideConfig();
|
||||
inv.hide();
|
||||
config.hideConfig();
|
||||
commandBuild = null;
|
||||
return false;
|
||||
}
|
||||
@ -1108,21 +1122,21 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
consumed = true;
|
||||
}else if(build.block.configurable && build.interactable(player.team())){ //check if tapped block is configurable
|
||||
consumed = true;
|
||||
if((!frag.config.isShown() && build.shouldShowConfigure(player)) //if the config fragment is hidden, show
|
||||
if((!config.isShown() && build.shouldShowConfigure(player)) //if the config fragment is hidden, show
|
||||
//alternatively, the current selected block can 'agree' to switch config tiles
|
||||
|| (frag.config.isShown() && frag.config.getSelectedTile().onConfigureTileTapped(build))){
|
||||
|| (config.isShown() && config.getSelected().onConfigureBuildTapped(build))){
|
||||
Sounds.click.at(build);
|
||||
frag.config.showConfig(build);
|
||||
config.showConfig(build);
|
||||
}
|
||||
//otherwise...
|
||||
}else if(!frag.config.hasConfigMouse()){ //make sure a configuration fragment isn't on the cursor
|
||||
}else if(!config.hasConfigMouse()){ //make sure a configuration fragment isn't on the cursor
|
||||
//then, if it's shown and the current block 'agrees' to hide, hide it.
|
||||
if(frag.config.isShown() && frag.config.getSelectedTile().onConfigureTileTapped(build)){
|
||||
if(config.isShown() && config.getSelected().onConfigureBuildTapped(build)){
|
||||
consumed = true;
|
||||
frag.config.hideConfig();
|
||||
config.hideConfig();
|
||||
}
|
||||
|
||||
if(frag.config.isShown()){
|
||||
if(config.isShown()){
|
||||
consumed = true;
|
||||
}
|
||||
}
|
||||
@ -1137,14 +1151,14 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
consumed = true;
|
||||
}else if(build.interactable(player.team()) && build.block.synthetic() && (!consumed || build.block.allowConfigInventory)){
|
||||
if(build.block.hasItems && build.items.total() > 0){
|
||||
frag.inv.showFor(build);
|
||||
inv.showFor(build);
|
||||
consumed = true;
|
||||
showedInventory = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!showedInventory){
|
||||
frag.inv.hide();
|
||||
inv.hide();
|
||||
}
|
||||
|
||||
return consumed;
|
||||
@ -1300,7 +1314,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
|
||||
public void remove(){
|
||||
Core.input.removeProcessor(this);
|
||||
frag.remove();
|
||||
group.remove();
|
||||
if(Core.scene != null){
|
||||
Table table = (Table)Core.scene.find("inputTable");
|
||||
if(table != null){
|
||||
@ -1334,7 +1348,11 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
uiGroup.toBack();
|
||||
buildUI(uiGroup);
|
||||
|
||||
frag.add();
|
||||
group.setFillParent(true);
|
||||
Vars.ui.hudGroup.addChildBefore(Core.scene.find("overlaymarker"), group);
|
||||
|
||||
inv.build(group);
|
||||
config.build(group);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -628,7 +628,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
}else if(buildingTapped != null){
|
||||
Call.buildingControlSelect(player, buildingTapped);
|
||||
recentRespawnTimer = 1f;
|
||||
}else if(!tryBeginMine(cursor)){
|
||||
}else if(!checkConfigTap() && !tryBeginMine(cursor)){
|
||||
tileTapped(linked.build);
|
||||
}
|
||||
return false;
|
||||
@ -636,8 +636,9 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
unitTapped = selectedUnit();
|
||||
buildingTapped = selectedControlBuild();
|
||||
|
||||
//prevent mining if placing/breaking blocks
|
||||
if(!tryStopMine() && !canTapPlayer(worldx, worldy) && !tileTapped(linked.build) && mode == none && !Core.settings.getBool("doubletapmine")){
|
||||
if(!tryStopMine() && !canTapPlayer(worldx, worldy) && !checkConfigTap() && !tileTapped(linked.build) && mode == none && !Core.settings.getBool("doubletapmine")){
|
||||
tryBeginMine(cursor);
|
||||
}
|
||||
}
|
||||
|
@ -12,46 +12,34 @@ import mindustry.gen.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class BlockConfigFragment extends Fragment{
|
||||
public class BlockConfigFragment{
|
||||
Table table = new Table();
|
||||
Building configTile;
|
||||
Building selected;
|
||||
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
table.visible = false;
|
||||
parent.addChild(table);
|
||||
|
||||
//hacky way to hide block config when in menu
|
||||
//TODO remove?
|
||||
Core.scene.add(new Element(){
|
||||
@Override
|
||||
public void act(float delta){
|
||||
super.act(delta);
|
||||
if(state.isMenu()){
|
||||
table.visible = false;
|
||||
configTile = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
Events.on(ResetEvent.class, e -> forceHide());
|
||||
}
|
||||
|
||||
Events.on(ResetEvent.class, e -> {
|
||||
table.visible = false;
|
||||
configTile = null;
|
||||
});
|
||||
public void forceHide(){
|
||||
table.visible = false;
|
||||
selected = null;
|
||||
}
|
||||
|
||||
public boolean isShown(){
|
||||
return table.visible && configTile != null;
|
||||
return table.visible && selected != null;
|
||||
}
|
||||
|
||||
public Building getSelectedTile(){
|
||||
return configTile;
|
||||
public Building getSelected(){
|
||||
return selected;
|
||||
}
|
||||
|
||||
public void showConfig(Building tile){
|
||||
if(configTile != null) configTile.onConfigureClosed();
|
||||
if(selected != null) selected.onConfigureClosed();
|
||||
if(tile.configTapped()){
|
||||
configTile = tile;
|
||||
selected = tile;
|
||||
|
||||
table.visible = true;
|
||||
table.clear();
|
||||
@ -62,16 +50,16 @@ public class BlockConfigFragment extends Fragment{
|
||||
Actions.scaleTo(1f, 1f, 0.07f, Interp.pow3Out));
|
||||
|
||||
table.update(() -> {
|
||||
if(configTile != null && configTile.shouldHideConfigure(player)){
|
||||
if(selected != null && selected.shouldHideConfigure(player)){
|
||||
hideConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
table.setOrigin(Align.center);
|
||||
if(configTile == null || configTile.block == Blocks.air || !configTile.isValid()){
|
||||
if(selected == null || selected.block == Blocks.air || !selected.isValid()){
|
||||
hideConfig();
|
||||
}else{
|
||||
configTile.updateTableAlign(table);
|
||||
selected.updateTableAlign(table);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -83,8 +71,8 @@ public class BlockConfigFragment extends Fragment{
|
||||
}
|
||||
|
||||
public void hideConfig(){
|
||||
if(configTile != null) configTile.onConfigureClosed();
|
||||
configTile = null;
|
||||
if(selected != null) selected.onConfigureClosed();
|
||||
selected = null;
|
||||
table.actions(Actions.scaleTo(0f, 1f, 0.06f, Interp.pow3Out), Actions.visible(false));
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ import java.util.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class BlockInventoryFragment extends Fragment{
|
||||
public class BlockInventoryFragment{
|
||||
private static final float holdWithdraw = 20f;
|
||||
private static final float holdShrink = 120f;
|
||||
|
||||
@ -38,7 +38,6 @@ public class BlockInventoryFragment extends Fragment{
|
||||
Events.on(WorldLoadEvent.class, e -> hide());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
table.name = "inventory";
|
||||
table.setTransform(true);
|
||||
|
@ -37,12 +37,6 @@ public class ChatFragment extends Table{
|
||||
private Seq<String> history = new Seq<>();
|
||||
private int historyPos = 0;
|
||||
private int scrollPos = 0;
|
||||
private Fragment container = new Fragment(){
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
scene.add(ChatFragment.this);
|
||||
}
|
||||
};
|
||||
|
||||
public ChatFragment(){
|
||||
super();
|
||||
@ -89,8 +83,8 @@ public class ChatFragment extends Table{
|
||||
setup();
|
||||
}
|
||||
|
||||
public Fragment container(){
|
||||
return container;
|
||||
public void build(Group parent){
|
||||
scene.add(this);
|
||||
}
|
||||
|
||||
public void clearMessages(){
|
||||
|
@ -7,11 +7,10 @@ import arc.scene.*;
|
||||
import arc.scene.event.*;
|
||||
|
||||
/** Fades in a black overlay.*/
|
||||
public class FadeInFragment extends Fragment{
|
||||
public class FadeInFragment{
|
||||
private static final float duration = 40f;
|
||||
float time = 0f;
|
||||
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
parent.addChild(new Element(){
|
||||
{
|
||||
|
@ -1,7 +0,0 @@
|
||||
package mindustry.ui.fragments;
|
||||
|
||||
import arc.scene.*;
|
||||
|
||||
public abstract class Fragment{
|
||||
public abstract void build(Group parent);
|
||||
}
|
@ -22,7 +22,7 @@ import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class HintsFragment extends Fragment{
|
||||
public class HintsFragment{
|
||||
private static final Boolp isTutorial = () -> Vars.state.rules.sector == SectorPresets.groundZero.sector;
|
||||
private static final float foutTime = 0.6f;
|
||||
|
||||
@ -35,7 +35,6 @@ public class HintsFragment extends Fragment{
|
||||
ObjectSet<Block> placedBlocks = new ObjectSet<>();
|
||||
Table last;
|
||||
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
group.setFillParent(true);
|
||||
group.touchable = Touchable.childrenOnly;
|
||||
|
@ -31,7 +31,7 @@ import mindustry.ui.*;
|
||||
import static mindustry.Vars.*;
|
||||
import static mindustry.gen.Tex.*;
|
||||
|
||||
public class HudFragment extends Fragment{
|
||||
public class HudFragment{
|
||||
private static final float dsize = 65f, pauseHeight = 36f;
|
||||
|
||||
public final PlacementFragment blockfrag = new PlacementFragment();
|
||||
@ -47,7 +47,6 @@ public class HudFragment extends Fragment{
|
||||
private Table lastUnlockLayout;
|
||||
private long lastToast;
|
||||
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
|
||||
//warn about guardian/boss waves
|
||||
|
@ -12,14 +12,13 @@ import arc.scene.ui.layout.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.ui.*;
|
||||
|
||||
public class LoadingFragment extends Fragment{
|
||||
public class LoadingFragment{
|
||||
private Table table;
|
||||
private TextButton button;
|
||||
private Bar bar;
|
||||
private Label nameLabel;
|
||||
private float progValue;
|
||||
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
parent.fill(t -> {
|
||||
//rect must fill screen completely.
|
||||
|
@ -21,12 +21,11 @@ import mindustry.ui.*;
|
||||
import static mindustry.Vars.*;
|
||||
import static mindustry.gen.Tex.*;
|
||||
|
||||
public class MenuFragment extends Fragment{
|
||||
public class MenuFragment{
|
||||
private Table container, submenu;
|
||||
private Button currentMenu;
|
||||
private MenuRenderer renderer;
|
||||
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
renderer = new MenuRenderer();
|
||||
|
||||
|
@ -14,13 +14,12 @@ import mindustry.ui.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class MinimapFragment extends Fragment{
|
||||
public class MinimapFragment{
|
||||
private boolean shown;
|
||||
float panx, pany, zoom = 1f, lastZoom = -1;
|
||||
private float baseSize = Scl.scl(5f);
|
||||
public Element elem;
|
||||
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
elem = parent.fill((x, y, w, h) -> {
|
||||
w = Core.graphics.getWidth();
|
||||
|
@ -1,32 +0,0 @@
|
||||
package mindustry.ui.fragments;
|
||||
|
||||
import arc.*;
|
||||
import arc.scene.event.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import mindustry.*;
|
||||
|
||||
/** Fragment for displaying overlays such as block inventories. */
|
||||
public class OverlayFragment{
|
||||
public final BlockInventoryFragment inv;
|
||||
public final BlockConfigFragment config;
|
||||
|
||||
private WidgetGroup group = new WidgetGroup();
|
||||
|
||||
public OverlayFragment(){
|
||||
group.touchable = Touchable.childrenOnly;
|
||||
inv = new BlockInventoryFragment();
|
||||
config = new BlockConfigFragment();
|
||||
}
|
||||
|
||||
public void add(){
|
||||
group.setFillParent(true);
|
||||
Vars.ui.hudGroup.addChildBefore(Core.scene.find("overlaymarker"), group);
|
||||
|
||||
inv.build(group);
|
||||
config.build(group);
|
||||
}
|
||||
|
||||
public void remove(){
|
||||
group.remove();
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ import mindustry.world.blocks.ConstructBlock.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class PlacementFragment extends Fragment{
|
||||
public class PlacementFragment{
|
||||
final int rowWidth = 4;
|
||||
|
||||
public Category currentCategory = Category.distribution;
|
||||
@ -229,7 +229,6 @@ public class PlacementFragment extends Fragment{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
parent.fill(full -> {
|
||||
toggler = full;
|
||||
|
@ -18,14 +18,13 @@ import mindustry.ui.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class PlayerListFragment extends Fragment{
|
||||
public class PlayerListFragment{
|
||||
public Table content = new Table().marginRight(13f).marginLeft(13f);
|
||||
private boolean visible = false;
|
||||
private Interval timer = new Interval();
|
||||
private TextField search;
|
||||
private Seq<Player> players = new Seq<>();
|
||||
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
content.name = "players";
|
||||
parent.fill(cont -> {
|
||||
|
@ -32,12 +32,6 @@ public class ScriptConsoleFragment extends Table{
|
||||
private Seq<String> history = new Seq<>();
|
||||
private int historyPos = 0;
|
||||
private int scrollPos = 0;
|
||||
private Fragment container = new Fragment(){
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
scene.add(ScriptConsoleFragment.this);
|
||||
}
|
||||
};
|
||||
|
||||
public ScriptConsoleFragment(){
|
||||
setFillParent(true);
|
||||
@ -82,8 +76,8 @@ public class ScriptConsoleFragment extends Table{
|
||||
setup();
|
||||
}
|
||||
|
||||
public Fragment container(){
|
||||
return container;
|
||||
public void build(Group parent){
|
||||
scene.add(this);
|
||||
}
|
||||
|
||||
public void clearMessages(){
|
||||
|
@ -41,7 +41,7 @@ public class ItemSelection{
|
||||
if(!item.unlockedNow() || (item instanceof Item checkVisible && state.rules.hiddenBuildItems.contains(checkVisible))) continue;
|
||||
|
||||
ImageButton button = cont.button(Tex.whiteui, Styles.clearToggleTransi, 24, () -> {
|
||||
if(closeSelect) control.input.frag.config.hideConfig();
|
||||
if(closeSelect) control.input.config.hideConfig();
|
||||
}).group(group).tooltip(item.localizedName).get();
|
||||
button.changed(() -> consumer.get(button.isChecked() ? item : null));
|
||||
button.getStyle().imageUp = new TextureRegionDrawable(item.uiIcon);
|
||||
|
@ -263,7 +263,7 @@ public class ItemBridge extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Building other){
|
||||
public boolean onConfigureBuildTapped(Building other){
|
||||
//reverse connection
|
||||
if(other instanceof ItemBridgeBuild b && b.link == pos()){
|
||||
configure(other.pos());
|
||||
|
@ -75,8 +75,8 @@ public class MassDriver extends Block{
|
||||
Drawf.dashCircle(x * tilesize, y * tilesize, range, Pal.accent);
|
||||
|
||||
//check if a mass driver is selected while placing this driver
|
||||
if(!control.input.frag.config.isShown()) return;
|
||||
Building selected = control.input.frag.config.getSelectedTile();
|
||||
if(!control.input.config.isShown()) return;
|
||||
Building selected = control.input.config.getSelected();
|
||||
if(selected == null || selected.block != this || !selected.within(x * tilesize, y * tilesize, range)) return;
|
||||
|
||||
//if so, draw a dotted line towards it while it is in range
|
||||
@ -250,7 +250,7 @@ public class MassDriver extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Building other){
|
||||
public boolean onConfigureBuildTapped(Building other){
|
||||
if(this == other){
|
||||
if(link == -1) deselect();
|
||||
configure(-1);
|
||||
|
@ -571,7 +571,7 @@ public class LogicBlock extends Block{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Building other){
|
||||
public boolean onConfigureBuildTapped(Building other){
|
||||
if(this == other || !accessible()){
|
||||
deselect();
|
||||
return false;
|
||||
@ -582,7 +582,7 @@ public class LogicBlock extends Block{
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.onConfigureTileTapped(other);
|
||||
return super.onConfigureBuildTapped(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -102,8 +102,8 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
Drawf.dashCircle(x * tilesize, y * tilesize, range, Pal.accent);
|
||||
|
||||
//check if a mass driver is selected while placing this driver
|
||||
if(!control.input.frag.config.isShown()) return;
|
||||
Building selected = control.input.frag.config.getSelectedTile();
|
||||
if(!control.input.config.isShown()) return;
|
||||
Building selected = control.input.config.getSelected();
|
||||
if(selected == null || selected.block != this || !selected.within(x * tilesize, y * tilesize, range)) return;
|
||||
|
||||
//if so, draw a dotted line towards it while it is in range
|
||||
@ -431,7 +431,7 @@ public class PayloadMassDriver extends PayloadBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Building other){
|
||||
public boolean onConfigureBuildTapped(Building other){
|
||||
if(this == other){
|
||||
if(link == -1) deselect();
|
||||
configure(-1);
|
||||
|
@ -384,7 +384,7 @@ public class PowerNode extends PowerBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Building other){
|
||||
public boolean onConfigureBuildTapped(Building other){
|
||||
if(linkValid(this, other)){
|
||||
configure(other.pos());
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user