diff --git a/Facepunch.Steamworks/SteamMatchmaking.cs b/Facepunch.Steamworks/SteamMatchmaking.cs index 1e1aa36..8a3e2ec 100644 --- a/Facepunch.Steamworks/SteamMatchmaking.cs +++ b/Facepunch.Steamworks/SteamMatchmaking.cs @@ -37,6 +37,8 @@ internal static void InstallEvents() { LobbyInvite_t.Install( x => OnLobbyInvite?.Invoke( new Friend( x.SteamIDUser ), new Lobby( x.SteamIDLobby ) ) ); + LobbyEnter_t.Install( x => OnLobbyEntered?.Invoke( new Lobby(x.SteamIDLobby ) ) ); + LobbyDataUpdate_t.Install( x => { if ( x.Success == 0 ) return; @@ -90,6 +92,11 @@ static private unsafe void OnLobbyChatMessageRecievedAPI( LobbyChatMsg_t callbac /// public static event Action OnLobbyInvite; + /// + /// You joined a lobby + /// + public static event Action OnLobbyEntered; + /// /// The lobby metadata has changed /// @@ -143,6 +150,17 @@ static private unsafe void OnLobbyChatMessageRecievedAPI( LobbyChatMsg_t callbac return new Lobby { Id = lobby.Value.SteamIDLobby }; } + /// + /// Attempts to directly join the specified lobby + /// + public static async Task JoinLobbyAsync( SteamId lobbyId ) + { + var lobby = await Internal.JoinLobby( lobbyId ); + if ( !lobby.HasValue ) return null; + + return new Lobby { Id = lobby.Value.SteamIDLobby }; + } + /// /// Get a list of servers that are on your favorites list ///