mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-27 07:05:50 +03:00
Pull req - OnLobbyEntered Action and JoinLobbyAsync
Added an OnLobbyEntered action with associated LobbyEnter_t event install, and added a JoinLobbyAsync method which returns the joined lobby if successful
This commit is contained in:
parent
1c5cdd2d39
commit
cb06574820
@ -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
|
||||
/// </summary>
|
||||
public static event Action<Friend, Lobby> OnLobbyInvite;
|
||||
|
||||
/// <summary>
|
||||
/// You joined a lobby
|
||||
/// </summary>
|
||||
public static event Action<Lobby> OnLobbyEntered;
|
||||
|
||||
/// <summary>
|
||||
/// The lobby metadata has changed
|
||||
/// </summary>
|
||||
@ -143,6 +150,17 @@ static private unsafe void OnLobbyChatMessageRecievedAPI( LobbyChatMsg_t callbac
|
||||
return new Lobby { Id = lobby.Value.SteamIDLobby };
|
||||
}
|
||||
|
||||
/// <summmary>
|
||||
/// Attempts to directly join the specified lobby
|
||||
/// </summmary>
|
||||
public static async Task<Lobby?> JoinLobbyAsync( SteamId lobbyId )
|
||||
{
|
||||
var lobby = await Internal.JoinLobby( lobbyId );
|
||||
if ( !lobby.HasValue ) return null;
|
||||
|
||||
return new Lobby { Id = lobby.Value.SteamIDLobby };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of servers that are on your favorites list
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user