Fixed various mobile bugs / Automatic map folder creation

This commit is contained in:
Anuken
2019-02-09 11:07:51 -05:00
parent 17b24c3389
commit 533ddb874e
8 changed files with 23 additions and 17 deletions

View File

@@ -291,7 +291,6 @@ public class Control implements ApplicationListener{
@Override @Override
public void update(){ public void update(){
saves.update(); saves.update();
for(InputHandler inputHandler : inputs){ for(InputHandler inputHandler : inputs){

View File

@@ -16,6 +16,7 @@ import io.anuke.arc.math.geom.Rectangle;
import io.anuke.arc.math.geom.Vector2; import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.scene.ui.layout.Table; import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.util.Align; import io.anuke.arc.util.Align;
import io.anuke.arc.util.Log;
import io.anuke.arc.util.Time; import io.anuke.arc.util.Time;
import io.anuke.mindustry.content.Blocks; import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.content.Fx; import io.anuke.mindustry.content.Fx;
@@ -327,6 +328,7 @@ public class MobileInput extends InputHandler implements GestureListener{
//draw placing //draw placing
if(mode == placing && block != null){ if(mode == placing && block != null){
Log.info(Core.input.mouseY());
NormalizeDrawResult dresult = PlaceUtils.normalizeDrawArea(block, lineStartX, lineStartY, tileX, tileY, true, maxLength, lineScale); NormalizeDrawResult dresult = PlaceUtils.normalizeDrawArea(block, lineStartX, lineStartY, tileX, tileY, true, maxLength, lineScale);
Lines.rect(dresult.x, dresult.y, dresult.x2 - dresult.x, dresult.y2 - dresult.y); Lines.rect(dresult.x, dresult.y, dresult.x2 - dresult.x, dresult.y2 - dresult.y);

View File

@@ -196,9 +196,9 @@ public class Administration{
return getCreateInfo(uuid).banned; return getCreateInfo(uuid).banned;
} }
public boolean isAdmin(String id, String usip){ public boolean isAdmin(String id, String usid){
PlayerInfo info = getCreateInfo(id); PlayerInfo info = getCreateInfo(id);
return info.admin && usip.equals(info.adminUsid); return info.admin && usid.equals(info.adminUsid);
} }
/**Finds player info by IP, UUID and name.*/ /**Finds player info by IP, UUID and name.*/

View File

@@ -22,9 +22,10 @@ public class ItemsDisplay extends Table{
public void rebuild(){ public void rebuild(){
clear(); clear();
top().left(); top().left();
margin(0);
table("flat", t -> { table("flat", t -> {
t.margin(4); t.margin(2);
ObjectIntMap<Item> items = data.items(); ObjectIntMap<Item> items = data.items();
for(Item item : content.items()){ for(Item item : content.items()){
if(item.type == ItemType.material && data.isUnlocked(item)){ if(item.type == ItemType.material && data.isUnlocked(item)){

View File

@@ -4,10 +4,12 @@ import io.anuke.arc.Core;
import io.anuke.arc.collection.Array; import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.ObjectSet; import io.anuke.arc.collection.ObjectSet;
import io.anuke.arc.graphics.Color; import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Lines; import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.scene.Group; import io.anuke.arc.scene.Group;
import io.anuke.arc.scene.ui.TextButton; import io.anuke.arc.scene.ui.TextButton;
import io.anuke.arc.scene.ui.layout.Table; import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.util.Align; import io.anuke.arc.util.Align;
import io.anuke.arc.util.Structs; import io.anuke.arc.util.Structs;
import io.anuke.mindustry.content.Zones; import io.anuke.mindustry.content.Zones;
@@ -26,7 +28,7 @@ import io.anuke.mindustry.world.Block.Icon;
import static io.anuke.mindustry.Vars.*; import static io.anuke.mindustry.Vars.*;
public class DeployDialog extends FloatingDialog{ public class DeployDialog extends FloatingDialog{
private static final float nodeSize = 250f; private final float nodeSize = Unit.dp.scl(250f);
private ObjectSet<ZoneNode> nodes = new ObjectSet<>(); private ObjectSet<ZoneNode> nodes = new ObjectSet<>();
public DeployDialog(){ public DeployDialog(){
@@ -35,8 +37,7 @@ public class DeployDialog extends FloatingDialog{
ZoneNode root = new ZoneNode(Zones.groundZero, null); ZoneNode root = new ZoneNode(Zones.groundZero, null);
TreeLayout layout = new TreeLayout(); TreeLayout layout = new TreeLayout();
layout.gapBetweenLevels = 40f; layout.gapBetweenLevels = layout.gapBetweenNodes = Unit.dp.scl(40f);
layout.gapBetweenNodes = 40f;
layout.layout(root); layout.layout(root);
addCloseButton(); addCloseButton();
@@ -230,7 +231,7 @@ public class DeployDialog extends FloatingDialog{
{ {
for(ZoneNode node : nodes){ for(ZoneNode node : nodes){
TextButton button = new TextButton("", "node"); TextButton button = new TextButton("", "node");
button.setSize(nodeSize, nodeSize); button.setSize(nodeSize);
button.update(() -> { button.update(() -> {
button.setPosition(node.x + panX + width/2f, node.y + panY + height/2f, Align.center); button.setPosition(node.x + panX + width/2f, node.y + panY + height/2f, Align.center);
}); });
@@ -251,11 +252,12 @@ public class DeployDialog extends FloatingDialog{
for(ZoneNode node : nodes){ for(ZoneNode node : nodes){
for(ZoneNode child : node.children){ for(ZoneNode child : node.children){
Lines.stroke(3f, node.zone.locked() || child.zone.locked() ? Pal.locked : Pal.accent); Lines.stroke(Unit.dp.scl(3f), node.zone.locked() || child.zone.locked() ? Pal.locked : Pal.accent);
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY); Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
} }
} }
Draw.reset();
super.draw(); super.draw();
} }
} }

View File

@@ -4,6 +4,7 @@ import io.anuke.arc.Core;
import io.anuke.arc.collection.Array; import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.ObjectSet; import io.anuke.arc.collection.ObjectSet;
import io.anuke.arc.graphics.Color; import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Lines; import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.math.Interpolation; import io.anuke.arc.math.Interpolation;
import io.anuke.arc.scene.Element; import io.anuke.arc.scene.Element;
@@ -13,6 +14,7 @@ import io.anuke.arc.scene.event.Touchable;
import io.anuke.arc.scene.style.TextureRegionDrawable; import io.anuke.arc.scene.style.TextureRegionDrawable;
import io.anuke.arc.scene.ui.ImageButton; import io.anuke.arc.scene.ui.ImageButton;
import io.anuke.arc.scene.ui.layout.Table; import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.util.Align; import io.anuke.arc.util.Align;
import io.anuke.arc.util.Log; import io.anuke.arc.util.Log;
import io.anuke.arc.util.Structs; import io.anuke.arc.util.Structs;
@@ -29,7 +31,7 @@ import io.anuke.mindustry.world.Block.Icon;
import static io.anuke.mindustry.Vars.*; import static io.anuke.mindustry.Vars.*;
public class TechTreeDialog extends FloatingDialog{ public class TechTreeDialog extends FloatingDialog{
private static final float nodeSize = 60f; private final float nodeSize = Unit.dp.scl(60f);
private ObjectSet<TechTreeNode> nodes = new ObjectSet<>(); private ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
private TechTreeNode root = new TechTreeNode(TechTree.root, null); private TechTreeNode root = new TechTreeNode(TechTree.root, null);
private ItemsDisplay items; private ItemsDisplay items;
@@ -38,8 +40,8 @@ public class TechTreeDialog extends FloatingDialog{
super(""); super("");
TreeLayout layout = new TreeLayout(); TreeLayout layout = new TreeLayout();
layout.gapBetweenLevels = 60f; layout.gapBetweenLevels = Unit.dp.scl(60f);
layout.gapBetweenNodes = 40f; layout.gapBetweenNodes = Unit.dp.scl(40f);
layout.layout(root); layout.layout(root);
titleTable.remove(); titleTable.remove();
@@ -160,7 +162,7 @@ public class TechTreeDialog extends FloatingDialog{
button.touchable(() -> !node.visible ? Touchable.disabled : Touchable.enabled); button.touchable(() -> !node.visible ? Touchable.disabled : Touchable.enabled);
button.setUserObject(node.node); button.setUserObject(node.node);
button.tapped(() -> moved = false); button.tapped(() -> moved = false);
button.setSize(nodeSize, nodeSize); button.setSize(nodeSize);
button.update(() -> { button.update(() -> {
float offset = (Core.graphics.getHeight() % 2) / 2f; float offset = (Core.graphics.getHeight() % 2) / 2f;
button.setPosition(node.x + panX + width/2f, node.y + panY + height/2f + offset, Align.center); button.setPosition(node.x + panX + width/2f, node.y + panY + height/2f + offset, Align.center);
@@ -254,12 +256,13 @@ public class TechTreeDialog extends FloatingDialog{
for(TechTreeNode node : nodes){ for(TechTreeNode node : nodes){
for(TechTreeNode child : node.children){ for(TechTreeNode child : node.children){
Lines.stroke(3f, locked(node.node) || locked(child.node) ? Pal.locked : Pal.accent); Lines.stroke(Unit.dp.scl(3f), locked(node.node) || locked(child.node) ? Pal.locked : Pal.accent);
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY); Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
} }
} }
Draw.reset();
super.draw(); super.draw();
} }
} }

View File

@@ -21,7 +21,6 @@ import java.io.DataOutput;
import java.io.IOException; import java.io.IOException;
import static io.anuke.mindustry.Vars.content; import static io.anuke.mindustry.Vars.content;
import static io.anuke.mindustry.Vars.data;
public class LiquidSource extends Block{ public class LiquidSource extends Block{
@@ -64,8 +63,6 @@ public class LiquidSource extends Block{
Table cont = new Table(); Table cont = new Table();
for(int i = 0; i < items.size; i++){ for(int i = 0; i < items.size; i++){
if(!data.isUnlocked(items.get(i))) continue;
final int f = i; final int f = i;
ImageButton button = cont.addImageButton("clear", "clear-toggle", 24, ImageButton button = cont.addImageButton("clear", "clear-toggle", 24,
() -> Call.setLiquidSourceLiquid(null, tile, items.get(f))).size(38).group(group).get(); () -> Call.setLiquidSourceLiquid(null, tile, items.get(f))).size(38).group(group).get();

View File

@@ -118,6 +118,8 @@ public class ServerControl implements ApplicationListener{
} }
}); });
customMapDirectory.mkdirs();
Thread thread = new Thread(this::readCommands, "Server Controls"); Thread thread = new Thread(this::readCommands, "Server Controls");
thread.setDaemon(true); thread.setDaemon(true);
thread.start(); thread.start();