Fixed lobby joining
This commit is contained in:
@@ -135,6 +135,7 @@ disconnect.error = Connection error.
|
||||
disconnect.closed = Connection closed.
|
||||
disconnect.timeout = Timed out.
|
||||
disconnect.data = Failed to load world data!
|
||||
cantconnect = Unable to join game ([accent]{0}[]).
|
||||
connecting = [accent]Connecting...
|
||||
connecting.data = [accent]Loading world data...
|
||||
server.port = Port:
|
||||
|
||||
@@ -206,7 +206,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
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();
|
||||
t.add("[lightgray]" + (Core.bundle.format("players" + (host.players == 1 && host.playerLimit <= 0 ? ".single" : ""), (host.players == 0 ? "[lightgray]" : "[accent]") + host.players + (host.playerLimit > 0 ? "[lightgray]/[accent]" + host.playerLimit : "")+ "[lightgray]"))).left();
|
||||
t.row();
|
||||
t.add("[lightgray]" + Core.bundle.format("save.map", host.mapname) + "[lightgray] / " + host.mode.toString()).width(targetWidth() - 10f).left().get().setEllipsis(true);
|
||||
}).expand().left().bottom().padLeft(12f).padBottom(8);
|
||||
|
||||
@@ -159,7 +159,7 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
||||
@Override
|
||||
public void hostServer(int port) throws IOException{
|
||||
provider.hostServer(port);
|
||||
smat.createLobby(Core.settings.getBool("publichost") ? LobbyType.Public : LobbyType.FriendsOnly, 32);
|
||||
smat.createLobby(Core.settings.getBool("publichost") ? LobbyType.Public : LobbyType.FriendsOnly, 16);
|
||||
}
|
||||
|
||||
public void updateLobby(){
|
||||
@@ -218,6 +218,13 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
||||
@Override
|
||||
public void onLobbyEnter(SteamID steamIDLobby, int chatPermissions, boolean blocked, ChatRoomEnterResponse response){
|
||||
Log.info("enter lobby {0} {1}", steamIDLobby.getAccountID(), response);
|
||||
|
||||
if(response != ChatRoomEnterResponse.Success){
|
||||
ui.loadfrag.hide();
|
||||
ui.showErrorMessage(Core.bundle.format("cantconnect", response.toString()));
|
||||
return;
|
||||
}
|
||||
|
||||
currentLobby = steamIDLobby;
|
||||
currentServer = smat.getLobbyOwner(steamIDLobby);
|
||||
|
||||
@@ -275,7 +282,7 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
||||
SteamID lobby = smat.getLobbyByIndex(i);
|
||||
Host out = new Host(
|
||||
smat.getLobbyData(lobby, "name"),
|
||||
"steam:" + lobby.getAccountID(),
|
||||
"steam:" + SteamNativeHandle.getNativeHandle(lobby),
|
||||
smat.getLobbyData(lobby, "mapname"),
|
||||
Strings.parseInt(smat.getLobbyData(lobby, "wave"), -1),
|
||||
smat.getNumLobbyMembers(lobby),
|
||||
|
||||
Reference in New Issue
Block a user