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