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