online game working

This commit is contained in:
2025-10-05 19:54:30 +02:00
parent 73595994d1
commit 807e8fc5f3
4 changed files with 89 additions and 6 deletions

View File

@@ -132,11 +132,23 @@ namespace MegaKoop.Game.Networking
isHost = steamService.IsHost;
#if STEAMWORKSNET
if (steamService.IsInLobby && p2pTransport != null)
if (p2pTransport != null)
{
if (ulong.TryParse(steamService.LobbyIdString, out ulong lobbyValue) && lobbyValue != 0)
if (steamService.IsInLobby)
{
p2pTransport.SetActiveLobby(new CSteamID(lobbyValue));
CSteamID lobbyId = steamService.LobbyId;
if (lobbyId != CSteamID.Nil)
{
p2pTransport.SetActiveLobby(lobbyId);
}
else if (ulong.TryParse(steamService.LobbyIdString, out ulong lobbyValue) && lobbyValue != 0)
{
p2pTransport.SetActiveLobby(new CSteamID(lobbyValue));
}
}
else
{
p2pTransport.SetActiveLobby(CSteamID.Nil);
}
}
#endif