Fixed world data not loading on mobile servers
This commit is contained in:
@@ -18,7 +18,6 @@ import io.anuke.ucore.scene.ui.layout.Cell;
|
|||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
import io.anuke.ucore.scene.utils.UIUtils;
|
import io.anuke.ucore.scene.utils.UIUtils;
|
||||||
import io.anuke.ucore.util.Bundles;
|
import io.anuke.ucore.util.Bundles;
|
||||||
import io.anuke.ucore.util.Log;
|
|
||||||
import io.anuke.ucore.util.Strings;
|
import io.anuke.ucore.util.Strings;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
@@ -252,10 +251,7 @@ public class JoinDialog extends FloatingDialog{
|
|||||||
|
|
||||||
local.clear();
|
local.clear();
|
||||||
local.background((Drawable)null);
|
local.background((Drawable)null);
|
||||||
local.table("button", t -> {
|
local.table("button", t -> t.label(() -> "[accent]" + Bundles.get("text.hosts.discovering") + Strings.animated(4, 10f, ".")).pad(10f)).growX();
|
||||||
t.label(() -> "[accent]" + Bundles.get("text.hosts.discovering") + Strings.animated(4, 10f, ".")).pad(10f);
|
|
||||||
}).growX();
|
|
||||||
Log.info("begin of discover");
|
|
||||||
Net.discoverServers(this::addLocalHost, this::finishLocalHosts);
|
Net.discoverServers(this::addLocalHost, this::finishLocalHosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package io.anuke.kryonet;
|
package io.anuke.kryonet;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import com.dosse.upnp.UPnP;
|
import com.dosse.upnp.UPnP;
|
||||||
import com.esotericsoftware.kryonet.Connection;
|
import com.esotericsoftware.kryonet.Connection;
|
||||||
@@ -28,6 +27,8 @@ import java.nio.channels.ClosedSelectorException;
|
|||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.threads;
|
||||||
|
|
||||||
public class KryoServer implements ServerProvider {
|
public class KryoServer implements ServerProvider {
|
||||||
final boolean tcpOnly = System.getProperty("java.version") == null;
|
final boolean tcpOnly = System.getProperty("java.version") == null;
|
||||||
final Server server;
|
final Server server;
|
||||||
@@ -65,7 +66,7 @@ public class KryoServer implements ServerProvider {
|
|||||||
Log.info("&bRecieved connection: {0} / {1}. Kryonet ID: {2}", c.id, c.addressTCP, connection.getID());
|
Log.info("&bRecieved connection: {0} / {1}. Kryonet ID: {2}", c.id, c.addressTCP, connection.getID());
|
||||||
|
|
||||||
connections.add(kn);
|
connections.add(kn);
|
||||||
Gdx.app.postRunnable(() -> Net.handleServerReceived(kn.id, c));
|
threads.runDelay(() -> Net.handleServerReceived(kn.id, c));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -79,7 +80,7 @@ public class KryoServer implements ServerProvider {
|
|||||||
|
|
||||||
Log.info("&bLost connection: {0}", k.id);
|
Log.info("&bLost connection: {0}", k.id);
|
||||||
|
|
||||||
Gdx.app.postRunnable(() -> {
|
threads.runDelay(() -> {
|
||||||
Net.handleServerReceived(k.id, c);
|
Net.handleServerReceived(k.id, c);
|
||||||
connections.remove(k);
|
connections.remove(k);
|
||||||
});
|
});
|
||||||
@@ -90,7 +91,7 @@ public class KryoServer implements ServerProvider {
|
|||||||
KryoConnection k = getByKryoID(connection.getID());
|
KryoConnection k = getByKryoID(connection.getID());
|
||||||
if(object instanceof FrameworkMessage || k == null) return;
|
if(object instanceof FrameworkMessage || k == null) return;
|
||||||
|
|
||||||
Gdx.app.postRunnable(() -> {
|
threads.runDelay(() -> {
|
||||||
try{
|
try{
|
||||||
Net.handleServerReceived(k.id, object);
|
Net.handleServerReceived(k.id, object);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.io.File;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@@ -30,7 +30,7 @@ public class BundleLauncher {
|
|||||||
Log.info("Parsing bundle: {0}", child);
|
Log.info("Parsing bundle: {0}", child);
|
||||||
|
|
||||||
OrderedMap<String, String> other = new OrderedMap<>();
|
OrderedMap<String, String> other = new OrderedMap<>();
|
||||||
PropertiesUtils.load(other, Files.newBufferedReader(child, Charset.forName("UTF-8")));
|
PropertiesUtils.load(other, Files.newBufferedReader(child, StandardCharsets.UTF_8));
|
||||||
removals.clear();
|
removals.clear();
|
||||||
|
|
||||||
for(String key : other.orderedKeys()){
|
for(String key : other.orderedKeys()){
|
||||||
@@ -63,7 +63,7 @@ public class BundleLauncher {
|
|||||||
result.append((e.key + " = " + e.value).replace("\\", "\\\\").replace("\n", "\\n"));
|
result.append((e.key + " = " + e.value).replace("\\", "\\\\").replace("\n", "\\n"));
|
||||||
result.append("\n");
|
result.append("\n");
|
||||||
}
|
}
|
||||||
Files.write(child, result.toString().getBytes("UTF-8"));
|
Files.write(child, result.toString().getBytes(StandardCharsets.UTF_8));
|
||||||
|
|
||||||
}catch (IOException e){
|
}catch (IOException e){
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user