Table of Contents

Class SteamLobbyManager

Namespace
SteamNetworkLib.Core
Assembly
SteamNetworkLib.dll

Manages Steam lobby operations including creation, joining, leaving, and member management. Provides core functionality for handling Steam lobbies and their associated events.

public class SteamLobbyManager : IDisposable
Inheritance
SteamLobbyManager
Implements
Inherited Members

Constructors

SteamLobbyManager()

Initializes a new instance of the SteamLobbyManager class.

public SteamLobbyManager()

Exceptions

SteamNetworkException

Thrown when Steam is not initialized.

Properties

CurrentLobby

Gets information about the current lobby, or null if not in a lobby.

public LobbyInfo? CurrentLobby { get; }

Property Value

LobbyInfo

IsHost

Gets a value indicating whether the local player is the host of the current lobby.

public bool IsHost { get; }

Property Value

bool

IsInLobby

Gets a value indicating whether the local player is currently in a lobby.

public bool IsInLobby { get; }

Property Value

bool

LocalPlayerID

Gets the Steam ID of the local player.

public CSteamID? LocalPlayerID { get; }

Property Value

CSteamID

Methods

CreateLobbyAsync(ELobbyType, int)

Creates a new Steam lobby with the specified settings.

public Task<LobbyInfo> CreateLobbyAsync(ELobbyType lobbyType = 1, int maxMembers = 4)

Parameters

lobbyType ELobbyType

The type of lobby to create (public, friends only, etc.).

maxMembers int

The maximum number of members allowed in the lobby.

Returns

Task<LobbyInfo>

A task that represents the asynchronous operation. The task result contains the created lobby information.

Exceptions

LobbyException

Thrown when lobby creation fails or is already in progress.

Dispose()

Releases all resources used by the SteamLobbyManager.

public void Dispose()

GetLobbyMembers()

Gets a list of all members currently in the lobby.

public List<MemberInfo> GetLobbyMembers()

Returns

List<MemberInfo>

A list of member information for all players in the lobby, or an empty list if not in a lobby.

InviteFriend(CSteamID?)

Invites a friend to the current lobby.

public void InviteFriend(CSteamID? friendId)

Parameters

friendId CSteamID

The Steam ID of the friend to invite.

Exceptions

LobbyException

Thrown when not in a lobby or the friend ID is invalid.

JoinLobbyAsync(CSteamID)

Joins an existing Steam lobby by its ID.

public Task<LobbyInfo> JoinLobbyAsync(CSteamID lobbyId)

Parameters

lobbyId CSteamID

The Steam ID of the lobby to join.

Returns

Task<LobbyInfo>

A task that represents the asynchronous operation. The task result contains the joined lobby information.

Exceptions

LobbyException

Thrown when the lobby ID is invalid, join fails, or is already in progress.

LeaveLobby()

Leaves the current lobby if the local player is in one.

public void LeaveLobby()

OpenInviteDialog()

Opens the Steam overlay invite dialog for inviting friends to the current lobby.

public void OpenInviteDialog()

Exceptions

LobbyException

Thrown when not in a lobby.

Events

OnLobbyCreated

Occurs when a new lobby is successfully created.

public event EventHandler<LobbyCreatedEventArgs>? OnLobbyCreated

Event Type

EventHandler<LobbyCreatedEventArgs>

OnLobbyJoined

Occurs when the local player joins a lobby.

public event EventHandler<LobbyJoinedEventArgs>? OnLobbyJoined

Event Type

EventHandler<LobbyJoinedEventArgs>

OnLobbyLeft

Occurs when the local player leaves a lobby.

public event EventHandler<LobbyLeftEventArgs>? OnLobbyLeft

Event Type

EventHandler<LobbyLeftEventArgs>

OnMemberJoined

Occurs when a new member joins the current lobby.

public event EventHandler<MemberJoinedEventArgs>? OnMemberJoined

Event Type

EventHandler<MemberJoinedEventArgs>

OnMemberLeft

Occurs when a member leaves the current lobby.

public event EventHandler<MemberLeftEventArgs>? OnMemberLeft

Event Type

EventHandler<MemberLeftEventArgs>