Mobile scrolling fix

This commit is contained in:
Anuken
2019-09-15 15:47:42 -04:00
parent f1bf8a0f1a
commit 681347e933
3 changed files with 29 additions and 4 deletions
+1 -2
View File
@@ -915,7 +915,7 @@ unit.lich.name = Lich
unit.reaper.name = Reaper
tutorial.next = [lightgray]<Tap to continue>
tutorial.intro = You have entered the[scarlet] Mindustry Tutorial.[]\nBegin by[accent] mining copper[]. Tap a copper ore vein near your core to do this.\n\n[accent]{0}/{1} copper
tutorial.drill = Mining manually is inefficient.\n[accent]Drills []can mine automatically.\nClick the drill tab in the bottom right.\nSelect the[accent] mechanical drill[]. Place it on a copper vein by clicking.\n[accent]Right-click[] to stop building.
tutorial.drill = Mining manually is inefficient.\n[accent]Drills []can mine automatically.\nClick the drill tab in the bottom right.\nSelect the[accent] mechanical drill[]. Place it on a copper vein by clicking.\n[accent]Right-click[] to stop building, and[accent] Hold Ctrl while scrolling[] to zoom in and out.
tutorial.drill.mobile = Mining manually is inefficient.\n[accent]Drills []can mine automatically.\nTap the drill tab in the bottom right.\nSelect the[accent] mechanical drill[].\nPlace it on a copper vein by tapping, then press the[accent] checkmark[] below to confirm your selection.\nPress the[accent] X button[] to cancel placement.
tutorial.blockinfo = Each block has different stats. Each drill can only mine certain ores.\nTo check a block's info and stats,[accent] tap the "?" button while selecting it in the build menu.[]\n\n[accent]Access the Mechanical Drill's stats now.[]
tutorial.conveyor = [accent]Conveyors[] are used to transport items to the core.\nMake a line of conveyors from the drill to the core.\n[accent]Hold down the mouse to place in a line.[]\nHold[accent] CTRL[] while selecting a line to place diagonally.\n\n[accent]Place 2 conveyors with the line tool, then deliver an item into the core.
@@ -934,7 +934,6 @@ tutorial.waves = The[lightgray] enemy[] approaches.\n\nDefend the core for 2 wav
tutorial.waves.mobile = The[lightgray] enemy[] approaches.\n\nDefend the core for 2 waves. Your ship will automatically fire at enemies.\nBuild more turrets and drills. Mine more copper.
tutorial.launch = Once you reach a specific wave, you are able to[accent] launch the core[], leaving your defenses behind and[accent] obtaining all the resources in your core.[]\nThese resources can then be used to research new technology.\n\n[accent]Press the launch button.
item.copper.description = The most basic structural material. Used extensively in all types of blocks.
item.lead.description = A basic starter material. Used extensively in electronics and liquid transportation blocks.
item.metaglass.description = A super-tough glass compound. Extensively used for liquid distribution and storage.
@@ -134,7 +134,7 @@ public class MusicControl{
/** Plays a music track once and only once. If something is already playing, does nothing.*/
private void playOnce(@NonNull Music music){
if(current != null) return; //do not interrupt already-playing tracks
if(current != null || music == null) return; //do not interrupt already-playing tracks
//save last random track played to prevent duplicates
lastRandomPlayed = music;
@@ -67,7 +67,33 @@ public class MobileInput extends InputHandler implements GestureListener{
public MobileInput(){
Events.on(ClientLoadEvent.class, e -> {
Core.input.addProcessor(new GestureDetector(20, 0.5f, 0.4f, 0.15f, this));
GestureDetector dec = new GestureDetector(20, 0.5f, 0.4f, 0.15f, this){
boolean clearMouse = false;
@Override
public boolean touchDown(int x, int y, int pointer, KeyCode button){
if(Core.scene.hasMouse(x, y)){
clearMouse = true;
return false;
}
return super.touchDown(x, y, pointer, button);
}
@Override
public boolean touchDragged(int x, int y, int pointer){
if(!clearMouse){
return super.touchDragged(x, y, pointer);
}
return false;
}
@Override
public boolean touchUp(int x, int y, int pointer, KeyCode button){
clearMouse = false;
return super.touchUp(x, y, pointer, button);
}
};
Core.input.getInputProcessors().insert(0, dec);
});
}