From cb06574820be4413d88377cf0c0609d788fc031f Mon Sep 17 00:00:00 2001 From: thesupersoup <40295603+thesupersoup@users.noreply.github.com> Date: Wed, 19 Jun 2019 21:14:35 -0700 Subject: [PATCH 1/2] 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 --- Facepunch.Steamworks/SteamMatchmaking.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Facepunch.Steamworks/SteamMatchmaking.cs b/Facepunch.Steamworks/SteamMatchmaking.cs index 1e1aa36..342f3a4 100644 --- a/Facepunch.Steamworks/SteamMatchmaking.cs +++ b/Facepunch.Steamworks/SteamMatchmaking.cs @@ -37,6 +37,8 @@ namespace Steamworks { 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 @@ namespace Steamworks /// public static event Action OnLobbyInvite; + /// + /// You joined a lobby + /// + public static event Action OnLobbyEntered; + /// /// The lobby metadata has changed /// @@ -143,6 +150,17 @@ namespace Steamworks 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 /// From ade772d195d0f14af6209169c5a6ecd4b3cbdbc5 Mon Sep 17 00:00:00 2001 From: thesupersoup <40295603+thesupersoup@users.noreply.github.com> Date: Wed, 19 Jun 2019 21:17:53 -0700 Subject: [PATCH 2/2] 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 --- Facepunch.Steamworks/SteamMatchmaking.cs | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Facepunch.Steamworks/SteamMatchmaking.cs b/Facepunch.Steamworks/SteamMatchmaking.cs index 342f3a4..8a3e2ec 100644 --- a/Facepunch.Steamworks/SteamMatchmaking.cs +++ b/Facepunch.Steamworks/SteamMatchmaking.cs @@ -37,7 +37,7 @@ namespace Steamworks { 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 => { @@ -92,10 +92,10 @@ namespace Steamworks /// public static event Action OnLobbyInvite; - /// - /// You joined a lobby - /// - public static event Action OnLobbyEntered; + /// + /// You joined a lobby + /// + public static event Action OnLobbyEntered; /// /// The lobby metadata has changed @@ -150,16 +150,16 @@ namespace Steamworks 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; + /// + /// 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 }; - } + return new Lobby { Id = lobby.Value.SteamIDLobby }; + } /// /// Get a list of servers that are on your favorites list