Schematic fixes

This commit is contained in:
Anuken
2019-11-01 17:48:30 -04:00
parent 4743434e9c
commit ad23cbc03c
3 changed files with 13 additions and 5 deletions
@@ -20,6 +20,7 @@ import io.anuke.mindustry.entities.traits.BuilderTrait.*;
import io.anuke.mindustry.entities.traits.*; import io.anuke.mindustry.entities.traits.*;
import io.anuke.mindustry.entities.type.*; import io.anuke.mindustry.entities.type.*;
import io.anuke.mindustry.game.EventType.*; import io.anuke.mindustry.game.EventType.*;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.gen.*; import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*; import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.ui.*; import io.anuke.mindustry.ui.*;
@@ -414,6 +415,12 @@ public class MobileInput extends InputHandler implements GestureListener{
return mode == breaking; return mode == breaking;
} }
@Override
public void useSchematic(Schematic schem){
selectRequests.clear();
selectRequests.addAll(schematics.toRequests(schem, world.toTile(player.x), world.toTile(player.y)));
}
@Override @Override
public boolean touchDown(int screenX, int screenY, int pointer, KeyCode button){ public boolean touchDown(int screenX, int screenY, int pointer, KeyCode button){
if(state.is(State.menu) || player.isDead()) return false; if(state.is(State.menu) || player.isDead()) return false;
@@ -34,6 +34,7 @@ public class SchematicsDialog extends FloatingDialog{
addCloseButton(); addCloseButton();
buttons.addImageTextButton("$schematic.import", Icon.loadMapSmall, this::showImport); buttons.addImageTextButton("$schematic.import", Icon.loadMapSmall, this::showImport);
shown(this::setup); shown(this::setup);
onResize(this::setup);
} }
void setup(){ void setup(){
@@ -123,7 +124,7 @@ public class SchematicsDialog extends FloatingDialog{
sel[0].getStyle().up = Tex.pane; sel[0].getStyle().up = Tex.pane;
if(++i % 4 == 0){ if(++i % (mobile ? Core.graphics.isPortrait() ? 2 : 3 : 4) == 0){
t.row(); t.row();
} }
} }