Tweaks
This commit is contained in:
@@ -223,7 +223,9 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
player.add();
|
player.add();
|
||||||
}
|
}
|
||||||
|
|
||||||
Core.input.addProcessor(input);
|
Events.on(ClientLoadEvent.class, e -> {
|
||||||
|
Core.input.addProcessor(input);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playMap(Map map, Rules rules){
|
public void playMap(Map map, Rules rules){
|
||||||
|
|||||||
@@ -64,7 +64,9 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
private int prevX, prevY, prevRotation;
|
private int prevX, prevY, prevRotation;
|
||||||
|
|
||||||
public MobileInput(){
|
public MobileInput(){
|
||||||
Core.input.addProcessor(new GestureDetector(20, 0.5f, 0.4f, 0.15f, this));
|
Events.on(ClientLoadEvent.class, e -> {
|
||||||
|
Core.input.addProcessor(new GestureDetector(20, 0.5f, 0.4f, 0.15f, this));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//region utility methods
|
//region utility methods
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import io.anuke.mindustry.game.*;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
import java.time.*;
|
import java.text.*;
|
||||||
import java.time.format.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class CrashSender{
|
public class CrashSender{
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ public class CrashSender{
|
|||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
File file = new File(OS.getAppDataDirectoryString(Vars.appName), "crashes/crash-report-" + DateTimeFormatter.ofPattern("MM_dd_yyyy_HH_mm_ss").format(LocalDateTime.now()) + ".txt");
|
File file = new File(OS.getAppDataDirectoryString(Vars.appName), "crashes/crash-report-" + new SimpleDateFormat("MM_dd_yyyy_HH_mm_ss").format(new Date()) + ".txt");
|
||||||
Files.createDirectories(Paths.get(OS.getAppDataDirectoryString(Vars.appName), "crashes"));
|
Files.createDirectories(Paths.get(OS.getAppDataDirectoryString(Vars.appName), "crashes"));
|
||||||
Files.write(file.toPath(), parseException(exception).getBytes());
|
Files.write(file.toPath(), parseException(exception).getBytes());
|
||||||
|
|
||||||
|
|||||||
@@ -128,11 +128,11 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
if(draw.getRegion() == def && text != null){
|
if(draw.getRegion() == def && text != null){
|
||||||
draw.setRegion(new TextureRegion(text));
|
draw.setRegion(new TextureRegion(text));
|
||||||
}
|
}
|
||||||
}).left().size(160f).padRight(5);
|
}).left().size(160f).padRight(6);
|
||||||
|
|
||||||
button.table(meta -> {
|
button.table(meta -> {
|
||||||
meta.left().top();
|
meta.left().top();
|
||||||
meta.defaults().padBottom(-2).left().width(250f);
|
meta.defaults().padBottom(-2).left().width(290f);
|
||||||
meta.row();
|
meta.row();
|
||||||
meta.labelWrap(Core.bundle.format("save.map", color + (slot.getMap() == null ? Core.bundle.get("unknown") : slot.getMap().name())));
|
meta.labelWrap(Core.bundle.format("save.map", color + (slot.getMap() == null ? Core.bundle.get("unknown") : slot.getMap().name())));
|
||||||
meta.row();
|
meta.row();
|
||||||
|
|||||||
@@ -1,30 +1,33 @@
|
|||||||
package io.anuke.mindustry.ui.dialogs;
|
package io.anuke.mindustry.ui.dialogs;
|
||||||
|
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.graphics.g2d.Draw;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.input.KeyCode;
|
import io.anuke.arc.input.*;
|
||||||
import io.anuke.arc.scene.event.InputEvent;
|
import io.anuke.arc.scene.event.*;
|
||||||
import io.anuke.arc.scene.event.InputListener;
|
|
||||||
import io.anuke.arc.scene.ui.layout.UnitScl;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.renderer;
|
||||||
|
|
||||||
public class MinimapDialog extends FloatingDialog{
|
public class MinimapDialog extends FloatingDialog{
|
||||||
|
|
||||||
public MinimapDialog(){
|
public MinimapDialog(){
|
||||||
super("$minimap");
|
super("$minimap");
|
||||||
setFillParent(false);
|
setFillParent(true);
|
||||||
|
|
||||||
shown(this::setup);
|
shown(this::setup);
|
||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
shouldPause = true;
|
shouldPause = true;
|
||||||
|
titleTable.remove();
|
||||||
|
onResize(this::setup);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawBackground(float x, float y){
|
||||||
|
drawDefaultBackground(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
cont.clear();
|
cont.clearChildren();
|
||||||
float size = Math.min(Core.graphics.getWidth(), Core.graphics.getHeight()) / UnitScl.dp.scl(1f) / 1.3f;
|
|
||||||
|
|
||||||
cont.table("pane", t -> {
|
cont.table("pane", t -> {
|
||||||
t.addRect((x, y, width, height) -> {
|
t.addRect((x, y, width, height) -> {
|
||||||
@@ -37,7 +40,7 @@ public class MinimapDialog extends FloatingDialog{
|
|||||||
renderer.minimap.drawEntities(x, y, width, height);
|
renderer.minimap.drawEntities(x, y, width, height);
|
||||||
}
|
}
|
||||||
}).grow();
|
}).grow();
|
||||||
}).size(size);
|
}).size(Math.min(Core.graphics.getWidth() / 1.1f, Core.graphics.getHeight() / 1.3f)).padTop(-20f);
|
||||||
|
|
||||||
cont.addListener(new InputListener(){
|
cont.addListener(new InputListener(){
|
||||||
@Override
|
@Override
|
||||||
@@ -45,18 +48,22 @@ public class MinimapDialog extends FloatingDialog{
|
|||||||
renderer.minimap.zoomBy(amounty);
|
renderer.minimap.zoomBy(amounty);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cont.addListener(new ElementGestureListener(){
|
||||||
|
float lzoom = -1f;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean touchDown(InputEvent event, float x, float y, int pointer, KeyCode button){
|
public void touchUp(InputEvent event, float x, float y, int pointer, KeyCode button){
|
||||||
return true;
|
lzoom = renderer.minimap.getZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void touchDragged(InputEvent event, float x, float y, int pointer){
|
public void zoom(InputEvent event, float initialDistance, float distance){
|
||||||
if(mobile){
|
if(lzoom < 0){
|
||||||
float max = Math.min(world.width(), world.height()) / 16f / 2f;
|
lzoom = renderer.minimap.getZoom();
|
||||||
renderer.minimap.setZoom(1f + y / cont.getHeight() * (max - 1f));
|
|
||||||
}
|
}
|
||||||
|
renderer.minimap.setZoom(initialDistance / distance * lzoom);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user