Merge branch 'master' into crater

This commit is contained in:
Patrick 'Quezler' Mounier
2020-02-06 19:33:57 +01:00
76 changed files with 351 additions and 281 deletions

View File

@@ -130,4 +130,4 @@ public interface Platform{
/** Stops forcing the app into landscape orientation.*/
default void endForceLandscape(){
}
}
}

View File

@@ -337,4 +337,4 @@ public class MapEditor{
world.endMapLoad();
}
}
}
}

View File

@@ -414,4 +414,4 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
public void onSuperDeath(){
super.onDeath();
}
}
}

View File

@@ -15,4 +15,4 @@ public enum UnitCommand{
public String localized(){
return localized;
}
}
}

View File

@@ -176,4 +176,4 @@ public class MapIO{
interface TileProvider{
Tile get(int x, int y);
}
}
}

View File

@@ -501,4 +501,4 @@ public class Maps{
return provider.next(previous);
}
}
}
}

View File

@@ -39,4 +39,4 @@ public class TerrainFilter extends GenerateFilter{
in.block = Blocks.air;
}
}
}
}

View File

@@ -418,4 +418,4 @@ public class ArcNetProvider implements NetProvider{
}
}
}
}

View File

@@ -65,4 +65,4 @@ public class Interpolator{
}
}
}
}

View File

@@ -91,4 +91,4 @@ public class CustomGameDialog extends FloatingDialog{
cont.add(pane).uniformX();
}
}
}

View File

@@ -13,6 +13,7 @@ import arc.util.serialization.*;
import mindustry.*;
import mindustry.core.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.net.*;
import mindustry.net.Packets.*;
import mindustry.ui.*;
@@ -25,6 +26,7 @@ public class JoinDialog extends FloatingDialog{
Server renaming;
Table local = new Table();
Table remote = new Table();
Table global = new Table();
Table hosts = new Table();
int totalHosts;
@@ -80,15 +82,11 @@ public class JoinDialog extends FloatingDialog{
}
});
keyDown(KeyCode.F5, () -> {
refreshLocal();
refreshRemote();
});
keyDown(KeyCode.F5, this::refreshAll);
shown(() -> {
setup();
refreshLocal();
refreshRemote();
refreshAll();
if(!steam){
Core.app.post(() -> Core.settings.getBoolOnce("joininfo", () -> ui.showInfo("$join.info")));
@@ -97,11 +95,16 @@ public class JoinDialog extends FloatingDialog{
onResize(() -> {
setup();
refreshLocal();
refreshRemote();
refreshAll();
});
}
void refreshAll(){
refreshLocal();
refreshRemote();
refreshGlobal();
}
void setupRemote(){
remote.clear();
@@ -128,21 +131,12 @@ public class JoinDialog extends FloatingDialog{
inner.add(button.getLabel()).growX();
inner.addImageButton(Icon.upOpen, Styles.emptyi, () -> {
int index = servers.indexOf(server);
if(index > 0){
servers.remove(index);
servers.insert(0, server);
moveRemote(server, -1);
saveServers();
setupRemote();
for(Server other : servers){
if(other.lastHost != null){
setupServer(other, other.lastHost);
}else{
refreshServer(other);
}
}
}
}).margin(3f).padTop(6f).top().right();
inner.addImageButton(Icon.downOpen, Styles.emptyi, () -> {
moveRemote(server, +1);
}).margin(3f).padTop(6f).top().right();
@@ -172,6 +166,26 @@ public class JoinDialog extends FloatingDialog{
}
}
void moveRemote(Server server, int sign){
int index = servers.indexOf(server);
if(index + sign < 0) return;
if(index + sign > servers.size - 1) return;
servers.remove(index);
servers.insert(index + sign, server);
saveServers();
setupRemote();
for(Server other : servers){
if(other.lastHost != null){
setupServer(other, other.lastHost);
}else{
refreshServer(other);
}
}
}
void refreshRemote(){
for(Server server : servers){
refreshServer(server);
@@ -232,9 +246,9 @@ public class JoinDialog extends FloatingDialog{
hosts.clear();
hosts.add(remote).growX();
hosts.row();
hosts.add(local).width(w);
section("$servers.local", local);
section("$servers.remote", remote);
section("$servers.global", global);
ScrollPane pane = new ScrollPane(hosts);
pane.setFadeScrollBars(false);
@@ -289,6 +303,24 @@ public class JoinDialog extends FloatingDialog{
});
}
void section(String label, Table servers){
Collapser coll = new Collapser(servers, Core.settings.getBool("collapsed-" + label, false));
coll.setDuration(0.1f);
hosts.table(name -> {
name.add(label).pad(10).growX().left().color(Pal.accent);
name.addImageButton(Icon.downOpen, Styles.emptyi, () -> {
coll.toggle(false);
Core.settings.putSave("collapsed-" + label, coll.isCollapsed());
}).update(i -> i.getStyle().imageUp = (!coll.isCollapsed() ? Icon.upOpen : Icon.downOpen)).size(40f).right().padRight(10f);
}).growX();
hosts.row();
hosts.addImage().growX().pad(5).padLeft(10).padRight(10).height(3).color(Pal.accent);
hosts.row();
hosts.add(coll).width(targetWidth());
hosts.row();
}
void refreshLocal(){
totalHosts = 0;
@@ -296,12 +328,17 @@ public class JoinDialog extends FloatingDialog{
local.background(null);
local.table(Tex.button, t -> t.label(() -> "[accent]" + Core.bundle.get("hosts.discovering.any") + Strings.animated(Time.time(), 4, 10f, ".")).pad(10f)).growX();
net.discoverServers(this::addLocalHost, this::finishLocalHosts);
}
void refreshGlobal(){
global.clear();
global.background(null);
for(String host : defaultServers){
String resaddress = host.contains(":") ? host.split(":")[0] : host;
int resport = host.contains(":") ? Strings.parseInt(host.split(":")[1]) : port;
net.pingHost(resaddress, resport, res -> {
res.port = resport;
addLocalHost(res);
addGlobalHost(res);
}, e -> {});
}
}
@@ -334,6 +371,18 @@ public class JoinDialog extends FloatingDialog{
buildServer(host, button);
}
void addGlobalHost(Host host){
global.background(null);
float w = targetWidth();
global.row();
TextButton button = global.addButton("", Styles.cleart, () -> safeConnect(host.address, host.port, host.version))
.width(w).pad(5f).get();
button.clearChildren();
buildServer(host, button);
}
public void connect(String ip, int port){
if(player.name.trim().isEmpty()){
ui.showInfo("$noname");
@@ -428,4 +477,4 @@ public class JoinDialog extends FloatingDialog{
public Server(){
}
}
}
}

View File

@@ -288,4 +288,4 @@ public class BranchTreeLayout implements TreeLayout{
public enum TreeAlignment{
center, towardsRoot, awayFromRoot
}
}
}

View File

@@ -221,4 +221,4 @@ public class Floor extends Block{
return block.edges()[x][2 - y];
}
}
}

View File

@@ -182,7 +182,7 @@ public class Conveyor extends Block implements Autotiler{
return;
}
float nextMax = e.nextc != null && tile.rotation() == e.nextc.tile.rotation() ? 1f - Math.max(itemSpace - e.nextc.minitem, 0) : 1f;
float nextMax = e.aligned ? 1f - Math.max(itemSpace - e.nextc.minitem, 0) : 1f;
for(int i = e.len - 1; i >= 0; i--){
float nextpos = (i == e.len - 1 ? 100f : e.ys[i + 1]) - itemSpace;
@@ -381,4 +381,4 @@ public class Conveyor extends Block implements Autotiler{
}
}
}
}
}

View File

@@ -18,4 +18,4 @@ public class FloorValue implements StatValue{
table.add(new Image(floor.icon(Cicon.small))).padRight(3);
table.add(floor.localizedName).padRight(3);
}
}
}