mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-25 22:58:47 +07:00
Sort Steam server lists, ignore version when unimportant
This commit is contained in:
parent
a815763833
commit
2019196f65
@ -202,11 +202,13 @@ public class JoinDialog extends FloatingDialog{
|
||||
}else if(host.version > Version.build && Version.build != -1){
|
||||
versionString = Core.bundle.get("server.outdated.client") + "\n" +
|
||||
Core.bundle.format("server.version", host.version, "");
|
||||
}else if(host.version == Version.build && Version.type.equals(host.versionType)){
|
||||
//not important
|
||||
versionString = "";
|
||||
}else{
|
||||
versionString = Core.bundle.format("server.version", host.version, host.versionType);
|
||||
}
|
||||
|
||||
|
||||
content.table(t -> {
|
||||
t.add("[lightgray]" + host.name + " " + versionString).width(targetWidth() - 10f).left().get().setEllipsis(true);
|
||||
t.row();
|
||||
|
@ -7,14 +7,13 @@ import com.codedisaster.steamworks.SteamNetworking.*;
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.function.*;
|
||||
import io.anuke.arc.input.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.pooling.*;
|
||||
import io.anuke.mindustry.game.EventType.*;
|
||||
import io.anuke.mindustry.game.Version;
|
||||
import io.anuke.mindustry.game.*;
|
||||
import io.anuke.mindustry.net.*;
|
||||
import io.anuke.mindustry.net.ArcNetImpl.*;
|
||||
import io.anuke.mindustry.net.*;
|
||||
import io.anuke.mindustry.net.Net.*;
|
||||
import io.anuke.mindustry.net.Packets.*;
|
||||
|
||||
@ -302,6 +301,7 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
||||
Log.info("found {0} matches {1}", matches, lobbyDoneCallback);
|
||||
|
||||
if(lobbyDoneCallback != null){
|
||||
Array<Host> hosts = new Array<>();
|
||||
for(int i = 0; i < matches; i++){
|
||||
try{
|
||||
SteamID lobby = smat.getLobbyByIndex(i);
|
||||
@ -316,13 +316,15 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
||||
Gamemode.valueOf(smat.getLobbyData(lobby, "gamemode")),
|
||||
smat.getLobbyMemberLimit(lobby)
|
||||
);
|
||||
|
||||
lobbyCallback.accept(out);
|
||||
hosts.add(out);
|
||||
}catch(Exception e){
|
||||
Log.err(e);
|
||||
}
|
||||
}
|
||||
|
||||
hosts.sort(Structs.comparingInt(h -> -h.players));
|
||||
hosts.each(lobbyCallback);
|
||||
|
||||
lobbyDoneCallback.run();
|
||||
}
|
||||
}
|
||||
@ -344,7 +346,7 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
||||
currentLobby = steamID;
|
||||
|
||||
smat.setLobbyData(steamID, "name", player.name);
|
||||
smat.setLobbyData(steamID, "mapname", world.getMap() == null ? "Unknown" : world.getMap().name());
|
||||
smat.setLobbyData(steamID, "mapname", world.getMap() == null ? "Unknown" : state.rules.zone == null ? world.getMap().name() : state.rules.zone.localizedName);
|
||||
smat.setLobbyData(steamID, "version", Version.build + "");
|
||||
smat.setLobbyData(steamID, "versionType", Version.type);
|
||||
smat.setLobbyData(steamID, "wave", state.wave + "");
|
||||
|
Loading…
Reference in New Issue
Block a user