diff --git a/core/assets-raw/sprites/ui/icons/icon-fdroid.png b/core/assets-raw/sprites/ui/icons/icon-fdroid.png new file mode 100644 index 0000000000..24c7cb884d Binary files /dev/null and b/core/assets-raw/sprites/ui/icons/icon-fdroid.png differ diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index ad684bc223..4fe137fed4 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -3,6 +3,7 @@ package io.anuke.mindustry; import io.anuke.arc.Application.*; import io.anuke.arc.*; import io.anuke.arc.assets.*; +import io.anuke.arc.collection.*; import io.anuke.arc.files.*; import io.anuke.arc.graphics.*; import io.anuke.arc.scene.ui.layout.*; @@ -43,6 +44,8 @@ public class Vars implements Loadable{ public static final String discordURL = "https://discord.gg/mindustry"; /** URL for sending crash reports to */ public static final String crashReportURL = "http://mins.us.to/report"; + /** list of built-in servers.*/ + public static final Array defaultServers = Array.with(/*"mins.us.to"*/); /** maximum distance between mine and core that supports automatic transferring */ public static final float mineTransferRange = 220f; /** team of the player by default */ diff --git a/core/src/io/anuke/mindustry/entities/type/FlyingUnit.java b/core/src/io/anuke/mindustry/entities/type/FlyingUnit.java index d02ad55ec1..95fb1821b9 100644 --- a/core/src/io/anuke/mindustry/entities/type/FlyingUnit.java +++ b/core/src/io/anuke/mindustry/entities/type/FlyingUnit.java @@ -125,8 +125,8 @@ public abstract class FlyingUnit extends BaseUnit{ if(!Net.client()){ updateRotation(); - wobble(); } + wobble(); } @Override diff --git a/core/src/io/anuke/mindustry/game/Tutorial.java b/core/src/io/anuke/mindustry/game/Tutorial.java index a655af8cec..d099055220 100644 --- a/core/src/io/anuke/mindustry/game/Tutorial.java +++ b/core/src/io/anuke/mindustry/game/Tutorial.java @@ -188,13 +188,12 @@ public class Tutorial{ protected final String line = Core.bundle.has("tutorial." + name() + ".mobile") && mobile ? "tutorial." + name() + ".mobile" : "tutorial." + name(); protected final Function text; - protected final Array sentences; + protected Array sentences; protected final BooleanProvider done; TutorialStage(Function text, BooleanProvider done){ this.text = text; this.done = done; - this.sentences = Array.select(Core.bundle.get(line).split("\n"), s -> !s.isEmpty()); } TutorialStage(BooleanProvider done){ @@ -203,6 +202,7 @@ public class Tutorial{ /** displayed tutorial stage text.*/ public String text(){ + if(sentences == null) this.sentences = Array.select(Core.bundle.get(line).split("\n"), s -> !s.isEmpty()); String line = sentences.get(control.tutorial.sentence); return line.contains("{") ? text.get(line) : line; } diff --git a/core/src/io/anuke/mindustry/ui/dialogs/JoinDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/JoinDialog.java index 473addf0ed..8b99c99795 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/JoinDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/JoinDialog.java @@ -176,6 +176,11 @@ public class JoinDialog extends FloatingDialog{ void setupServer(Server server, Host host){ server.lastHost = host; + server.content.clear(); + buildServer(host, server.content); + } + + void buildServer(Host host, Table content){ String versionString; if(host.version == -1){ @@ -192,9 +197,8 @@ public class JoinDialog extends FloatingDialog{ versionString = Core.bundle.format("server.version", host.version, host.versionType); } - server.content.clear(); - server.content.table(t -> { + content.table(t -> { t.add("[lightgray]" + host.name + " " + versionString).width(targetWidth() - 10f).left().get().setEllipsis(true); t.row(); t.add("[lightgray]" + (Core.bundle.format("players" + (host.players == 1 ? ".single" : ""), (host.players == 0 ? "[lightgray]" : "[accent]") + host.players + (host.playerLimit > 0 ? "[lightgray]/[accent]" + host.playerLimit : "")+ "[lightgray]"))).left(); @@ -268,6 +272,9 @@ public class JoinDialog extends FloatingDialog{ local.background((Drawable)null); local.table("button", t -> t.label(() -> "[accent]" + Core.bundle.get("hosts.discovering") + Strings.animated(Time.time(), 4, 10f, ".")).pad(10f)).growX(); Net.discoverServers(this::addLocalHost, this::finishLocalHosts); + for(String host : defaultServers){ + Net.pingHost(host, port, this::addLocalHost, e -> {}); + } } void finishLocalHosts(){ @@ -292,12 +299,10 @@ public class JoinDialog extends FloatingDialog{ local.row(); - TextButton button = local.addButton("[accent]" + host.name, "clear", () -> connect(host.address, port)) - .width(w).height(80f).pad(4f).get(); - button.left(); - button.row(); - button.add("[lightgray]" + (host.players != 1 ? Core.bundle.format("players", host.players) : - Core.bundle.format("players.single", host.players))).padBottom(5); + TextButton button = local.addButton("", "clear", () -> connect(host.address, port)) + .width(w).pad(5f).get(); + button.clearChildren(); + buildServer(host, button); } void connect(String ip, int port){