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:
thesupersoup 2019-06-19 21:17:53 -07:00
parent cb06574820
commit ade772d195

View File

@ -37,7 +37,7 @@ namespace Steamworks
{ {
LobbyInvite_t.Install( x => OnLobbyInvite?.Invoke( new Friend( x.SteamIDUser ), new Lobby( x.SteamIDLobby ) ) ); LobbyInvite_t.Install( x => OnLobbyInvite?.Invoke( new Friend( x.SteamIDUser ), new Lobby( x.SteamIDLobby ) ) );
LobbyEnter_t.Install( x => OnLobbyEntered?.Invoke( new Lobby(x.SteamIDLobby ) ) ); LobbyEnter_t.Install( x => OnLobbyEntered?.Invoke( new Lobby(x.SteamIDLobby ) ) );
LobbyDataUpdate_t.Install( x => LobbyDataUpdate_t.Install( x =>
{ {
@ -92,10 +92,10 @@ namespace Steamworks
/// </summary> /// </summary>
public static event Action<Friend, Lobby> OnLobbyInvite; public static event Action<Friend, Lobby> OnLobbyInvite;
/// <summary> /// <summary>
/// You joined a lobby /// You joined a lobby
/// </summary> /// </summary>
public static event Action<Lobby> OnLobbyEntered; public static event Action<Lobby> OnLobbyEntered;
/// <summary> /// <summary>
/// The lobby metadata has changed /// The lobby metadata has changed
@ -150,16 +150,16 @@ namespace Steamworks
return new Lobby { Id = lobby.Value.SteamIDLobby }; return new Lobby { Id = lobby.Value.SteamIDLobby };
} }
/// <summmary> /// <summmary>
/// Attempts to directly join the specified lobby /// Attempts to directly join the specified lobby
/// </summmary> /// </summmary>
public static async Task<Lobby?> JoinLobbyAsync( SteamId lobbyId ) public static async Task<Lobby?> JoinLobbyAsync( SteamId lobbyId )
{ {
var lobby = await Internal.JoinLobby( lobbyId ); var lobby = await Internal.JoinLobby( lobbyId );
if ( !lobby.HasValue ) return null; if ( !lobby.HasValue ) return null;
return new Lobby { Id = lobby.Value.SteamIDLobby }; return new Lobby { Id = lobby.Value.SteamIDLobby };
} }
/// <summary> /// <summary>
/// Get a list of servers that are on your favorites list /// Get a list of servers that are on your favorites list