mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-09 20:29:06 +07:00
Fixed many placement mode bugs
This commit is contained in:
parent
ae89a004a6
commit
2037ebaaba
@ -1,7 +1,7 @@
|
||||
#Autogenerated file. Do not modify.
|
||||
#Thu Mar 15 12:52:13 EDT 2018
|
||||
#Thu Mar 15 14:23:19 EDT 2018
|
||||
version=release
|
||||
androidBuildCode=388
|
||||
androidBuildCode=412
|
||||
name=Mindustry
|
||||
code=3.4
|
||||
build=custom build
|
||||
|
@ -408,7 +408,8 @@ public class Renderer extends RendererModule{
|
||||
if((input.recipe != null && state.inventory.hasItems(input.recipe.requirements) && (!ui.hasMouse() || android)
|
||||
&& control.input().drawPlace())){
|
||||
|
||||
input.placeMode.draw(control.input().getBlockX(), control.input().getBlockY(), control.input().getBlockEndX(), control.input().getBlockEndY());
|
||||
input.placeMode.draw(control.input().getBlockX(), control.input().getBlockY(),
|
||||
control.input().getBlockEndX(), control.input().getBlockEndY());
|
||||
|
||||
Lines.stroke(1f);
|
||||
Draw.color(Color.SCARLET);
|
||||
@ -424,9 +425,15 @@ public class Renderer extends RendererModule{
|
||||
if(input.breakMode == PlaceMode.holdDelete)
|
||||
input.breakMode.draw(tilex, tiley, 0, 0);
|
||||
|
||||
}else if(input.breakMode.delete && control.input().drawPlace() && input.recipe == null){
|
||||
input.breakMode.draw(control.input().getBlockX(), control.input().getBlockY(),
|
||||
control.input().getBlockEndX(), control.input().getBlockEndY());
|
||||
}else if(input.breakMode.delete && control.input().drawPlace()
|
||||
&& (input.recipe == null || !state.inventory.hasItems(input.recipe.requirements))
|
||||
&& (input.placeMode.delete || input.breakMode.both)){
|
||||
|
||||
if(input.breakMode == PlaceMode.holdDelete)
|
||||
input.breakMode.draw(tilex, tiley, 0, 0);
|
||||
else
|
||||
input.breakMode.draw(control.input().getBlockX(), control.input().getBlockY(),
|
||||
control.input().getBlockEndX(), control.input().getBlockEndY());
|
||||
}
|
||||
|
||||
if(ui.toolfrag.confirming){
|
||||
|
@ -20,9 +20,9 @@ public class AndroidInput extends InputHandler{
|
||||
public float lmousex, lmousey;
|
||||
public float mousex, mousey;
|
||||
public boolean brokeBlock = false;
|
||||
public boolean placing = false;
|
||||
|
||||
private boolean enableHold = false;
|
||||
private boolean placing = false;
|
||||
private float warmup;
|
||||
private float warmupDelay = 20;
|
||||
|
||||
@ -48,6 +48,7 @@ public class AndroidInput extends InputHandler{
|
||||
}else if(pointer == 0 && !breakMode.pan && breaking() && drawPlace()){
|
||||
breakMode.released(getBlockX(), getBlockY(), getBlockEndX(), getBlockEndY());
|
||||
}
|
||||
|
||||
placing = false;
|
||||
return false;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class GestureHandler extends GestureAdapter{
|
||||
if(control.showCursor() && !Inputs.keyDown("select")) return false;
|
||||
|
||||
if(!control.showCursor() && !(control.input().recipe != null
|
||||
&& state.inventory.hasItems(control.input().recipe.requirements) && control.input().placeMode.lockCamera) &&
|
||||
&& control.input().placeMode.lockCamera) &&
|
||||
!(control.input().recipe == null && control.input().breakMode.lockCamera)){
|
||||
float dx = deltaX*Core.camera.zoom/Core.cameraScale, dy = deltaY*Core.camera.zoom/Core.cameraScale;
|
||||
player.x -= dx;
|
||||
|
@ -164,7 +164,6 @@ public enum PlaceMode{
|
||||
}
|
||||
|
||||
public void released(int tilex, int tiley, int endx, int endy){
|
||||
|
||||
process(tilex, tiley, endx, endy);
|
||||
tilex = this.tilex; tiley = this.tiley;
|
||||
endx = this.endx; endy = this.endy;
|
||||
|
@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.input.AndroidInput;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.mindustry.input.PlaceMode;
|
||||
import io.anuke.ucore.core.Core;
|
||||
@ -128,7 +129,7 @@ public class PlacementFragment implements Fragment{
|
||||
|
||||
defaults().padBottom(-5.5f);
|
||||
|
||||
new imagebutton("icon-" + mode.name(), "toggle", 10 * 3, () -> {
|
||||
ImageButton button = new imagebutton("icon-" + mode.name(), "toggle", 10 * 3, () -> {
|
||||
control.input().resetCursor();
|
||||
input.breakMode = mode;
|
||||
input.lastBreakMode = mode;
|
||||
@ -138,7 +139,15 @@ public class PlacementFragment implements Fragment{
|
||||
input.placeMode = input.lastPlaceMode;
|
||||
}
|
||||
modeText(Bundles.format("text.mode.break", mode.toString()));
|
||||
}).group(breakGroup).get().setName(mode.name());
|
||||
}).group(breakGroup).get();
|
||||
|
||||
button.setName(mode.name());
|
||||
button.released(() -> {
|
||||
//TODO hack
|
||||
if(mode == PlaceMode.areaDelete){
|
||||
((AndroidInput)input).placing = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}}.end().get();
|
||||
@ -215,6 +224,7 @@ public class PlacementFragment implements Fragment{
|
||||
|
||||
if(!show){
|
||||
control.input().breakMode = PlaceMode.none;
|
||||
if(control.input().placeMode.delete) control.input().placeMode = PlaceMode.none;
|
||||
breaktable.actions(Actions.translateBy(-breaktable.getWidth() - 5, 0, dur, in), Actions.call(() -> shown = false));
|
||||
}else{
|
||||
shown = true;
|
||||
|
Loading…
Reference in New Issue
Block a user