Table of Contents

Class LobbiesService

Namespace
Coherence.Cloud
Assembly
Coherence.Runtime.dll
public class LobbiesService
Inheritance
LobbiesService

Constructors

LobbiesService(CloudCredentialsPair, IRuntimeSettings)

public LobbiesService(CloudCredentialsPair credentialsPair = null, IRuntimeSettings runtimeSettings = null)

Parameters

credentialsPair CloudCredentialsPair
runtimeSettings IRuntimeSettings

Methods

CreateLobby(CreateLobbyOptions, Action<RequestResponse<LobbySession>>)

Endpoint to create a Lobby directly without doing matchmaking.

public void CreateLobby(CreateLobbyOptions createOptions, Action<RequestResponse<LobbySession>> onRequestFinished)

Parameters

createOptions CreateLobbyOptions

Options that will be used to create a Lobby.

onRequestFinished Action<RequestResponse<LobbySession>>

Callback that will be invoked when the request finished.

CreateLobbyAsync(CreateLobbyOptions)

Endpoint to create a Lobby directly without doing matchmaking.

public Task<LobbySession> CreateLobbyAsync(CreateLobbyOptions createOptions)

Parameters

createOptions CreateLobbyOptions

Options that will be used to create a Lobby.

Returns

Task<LobbySession>

Dispose()

public void Dispose()

FetchLobbyStats(Action<RequestResponse<LobbyStats>>, List<string>, List<string>)

Get stats for the usage of Lobbies for your current coherence Project.

public void FetchLobbyStats(Action<RequestResponse<LobbyStats>> onRequestFinished, List<string> tags = null, List<string> regions = null)

Parameters

onRequestFinished Action<RequestResponse<LobbyStats>>

Callback that will be invoked when the request finished.

tags List<string>

Optional list of tags to filter the fetched stats.

regions List<string>

Optional list of regions to filter the fetched stats.

FetchLobbyStatsAsync(List<string>, List<string>)

Get stats for the usage of Lobbies for your current coherence Project.

public Task<LobbyStats> FetchLobbyStatsAsync(List<string> tags = null, List<string> regions = null)

Parameters

tags List<string>

Optional list of tags to filter the fetched stats.

regions List<string>

Optional list of regions to filter the fetched stats.

Returns

Task<LobbyStats>

FindLobbies(Action<RequestResponse<IReadOnlyList<LobbyData>>>, FindLobbyOptions)

Find current active Lobbies that you will be able to join.

public void FindLobbies(Action<RequestResponse<IReadOnlyList<LobbyData>>> onRequestFinished, FindLobbyOptions findOptions = null)

Parameters

onRequestFinished Action<RequestResponse<IReadOnlyList<LobbyData>>>

Callback that will be invoked when the request finished.

findOptions FindLobbyOptions

Optional parameter to filter the returned Lobbies.

FindLobbiesAsync(FindLobbyOptions)

Find current active Lobbies that you will be able to join.

public Task<IReadOnlyList<LobbyData>> FindLobbiesAsync(FindLobbyOptions findOptions = null)

Parameters

findOptions FindLobbyOptions

Optional parameter to filter the returned Lobbies.

Returns

Task<IReadOnlyList<LobbyData>>

FindOrCreateLobby(FindLobbyOptions, CreateLobbyOptions, Action<RequestResponse<LobbySession>>)

Endpoint to do matchmaking and find a suitable Lobby. If no suitable Lobby is found, one will be created using the CreateLobbyOptions.

public void FindOrCreateLobby(FindLobbyOptions findOptions, CreateLobbyOptions createOptions, Action<RequestResponse<LobbySession>> onRequestFinished)

Parameters

findOptions FindLobbyOptions

Options that will be used to try to find a suitable Lobby.

createOptions CreateLobbyOptions

Options that will be used to create a Lobby if no suitable Lobby is found.

onRequestFinished Action<RequestResponse<LobbySession>>

Callback that will be invoked when the request finished.

FindOrCreateLobbyAsync(FindLobbyOptions, CreateLobbyOptions)

Endpoint to do matchmaking and find a suitable Lobby. If no suitable Lobby is found, one will be created using the CreateLobbyOptions.

public Task<LobbySession> FindOrCreateLobbyAsync(FindLobbyOptions findOptions, CreateLobbyOptions createOptions)

Parameters

findOptions FindLobbyOptions

Options that will be used to try to find a suitable Lobby.

createOptions CreateLobbyOptions

Options that will be used to create a Lobby if no suitable Lobby is found.

Returns

Task<LobbySession>

GetActiveLobbySessionForLobbyId(string)

Get a LobbySession instance for a Lobby that you have joined and you're a part of.

public Task<LobbySession> GetActiveLobbySessionForLobbyId(string lobbyId)

Parameters

lobbyId string

Returns

Task<LobbySession>

GetCreateLobbyCooldown()

public TimeSpan GetCreateLobbyCooldown()

Returns

TimeSpan

Returns the internal cooldown for the Create Lobby endpoint.

GetFindLobbiesCooldown()

public TimeSpan GetFindLobbiesCooldown()

Returns

TimeSpan

Returns the internal cooldown for the Find Lobbies endpoint.

GetFindOrCreateLobbyCooldown()

public TimeSpan GetFindOrCreateLobbyCooldown()

Returns

TimeSpan

Returns the internal cooldown for the Find Or Create Lobby endpoint.

GetLobbySessions()

Iterate all active LobbySession instances.

public IEnumerable<LobbySession> GetLobbySessions()

Returns

IEnumerable<LobbySession>

Remarks

A LobbySession instance is used to interface with a Lobby that you are a part of.

JoinLobby(LobbyData, Action<RequestResponse<LobbySession>>, List<CloudAttribute>, string)

Join the supplied Lobby.

public void JoinLobby(LobbyData lobby, Action<RequestResponse<LobbySession>> onRequestFinished, List<CloudAttribute> playerAttr = null, string secret = null)

Parameters

lobby LobbyData
onRequestFinished Action<RequestResponse<LobbySession>>

Callback that will be invoked when the request finished.

playerAttr List<CloudAttribute>

Optional parameter to add player attributes to the joined Lobby.

secret string

Optional parameter to specify the Secret to join a private Lobby.

JoinLobbyAsync(LobbyData, List<CloudAttribute>, string)

Join the supplied Lobby.

public Task<LobbySession> JoinLobbyAsync(LobbyData lobby, List<CloudAttribute> playerAttr = null, string secret = null)

Parameters

lobby LobbyData
playerAttr List<CloudAttribute>

Optional parameter to add player attributes to the joined Lobby.

secret string

Optional parameter to specify the Secret to join a private Lobby.

Returns

Task<LobbySession>

RefreshLobby(LobbyData, Action<RequestResponse<LobbyData>>)

Refresh the current data for the supplied Lobby.

public void RefreshLobby(LobbyData lobby, Action<RequestResponse<LobbyData>> onRequestFinished)

Parameters

lobby LobbyData

Lobby you want to refresh the data of.

onRequestFinished Action<RequestResponse<LobbyData>>

Callback that will be invoked when the request finished.

RefreshLobby(string, Action<RequestResponse<LobbyData>>)

Refresh the current data for the Lobby with the supplied id.

public void RefreshLobby(string lobbyId, Action<RequestResponse<LobbyData>> onRequestFinished)

Parameters

lobbyId string

Lobby ID you want to refresh the data of.

onRequestFinished Action<RequestResponse<LobbyData>>

Callback that will be invoked when the request finished.

RefreshLobbyAsync(LobbyData)

Refresh the current data for the supplied Lobby.

public Task<LobbyData> RefreshLobbyAsync(LobbyData lobby)

Parameters

lobby LobbyData

Lobby you want to refresh the data of.

Returns

Task<LobbyData>

RefreshLobbyAsync(string)

Refresh the current data for the Lobby with the supplied id.

public Task<LobbyData> RefreshLobbyAsync(string lobbyId)

Parameters

lobbyId string

Lobby ID you want to refresh the data of.

Returns

Task<LobbyData>

Events

OnPlaySessionStarted

Callback that will be invoked when a Lobby owner you're a part of starts a game. The Callback contains the Lobby ID and the RoomData that you can use to join the game session through CoherenceBridge.JoinRoom. If a Callback is not supplied, coherence will automatically join the specified RoomData.

public event Action<string, RoomData> OnPlaySessionStarted

Event Type

Action<string, RoomData>