online game working

This commit is contained in:
2025-10-05 19:31:52 +02:00
parent dd89012919
commit 73595994d1
2 changed files with 23 additions and 1 deletions

View File

@@ -121,6 +121,27 @@ namespace MegaKoop.Game.Networking
p2pTransport?.Send(target, type, payload, sendType);
}
public void SynchronizeWithLobby(MegaKoop.Steam.SteamLobbyService steamService)
{
if (steamService == null)
{
return;
}
isConnected = steamService.IsInLobby;
isHost = steamService.IsHost;
#if STEAMWORKSNET
if (steamService.IsInLobby && p2pTransport != null)
{
if (ulong.TryParse(steamService.LobbyIdString, out ulong lobbyValue) && lobbyValue != 0)
{
p2pTransport.SetActiveLobby(new CSteamID(lobbyValue));
}
}
#endif
}
private void DispatchMessage(NetworkMessage message)
{
if (handlers.TryGetValue(message.Type, out Action<NetworkMessage> handler))