Class LobbiesService
public class LobbiesService
- Inheritance
-
LobbiesService
Constructors
LobbiesService(CloudCredentialsPair, IRuntimeSettings)
public LobbiesService(CloudCredentialsPair credentialsPair = null, IRuntimeSettings runtimeSettings = null)
Parameters
credentialsPair
CloudCredentialsPairruntimeSettings
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
CreateLobbyOptionsOptions 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
CreateLobbyOptionsOptions that will be used to create a Lobby.
Returns
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
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
FindLobbyOptionsOptional 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
FindLobbyOptionsOptional parameter to filter the returned Lobbies.
Returns
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
FindLobbyOptionsOptions that will be used to try to find a suitable Lobby.
createOptions
CreateLobbyOptionsOptions 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
FindLobbyOptionsOptions that will be used to try to find a suitable Lobby.
createOptions
CreateLobbyOptionsOptions that will be used to create a Lobby if no suitable Lobby is found.
Returns
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
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
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
LobbyDataonRequestFinished
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
stringOptional 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
LobbyDataplayerAttr
List<CloudAttribute>Optional parameter to add player attributes to the joined Lobby.
secret
stringOptional parameter to specify the Secret to join a private Lobby.
Returns
RefreshLobby(LobbyData, Action<RequestResponse<LobbyData>>)
Refresh the current data for the supplied Lobby.
public void RefreshLobby(LobbyData lobby, Action<RequestResponse<LobbyData>> onRequestFinished)
Parameters
lobby
LobbyDataLobby 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
stringLobby 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
LobbyDataLobby you want to refresh the data of.
Returns
RefreshLobbyAsync(string)
Refresh the current data for the Lobby with the supplied id.
public Task<LobbyData> RefreshLobbyAsync(string lobbyId)
Parameters
lobbyId
stringLobby ID you want to refresh the data of.
Returns
Events
OnPlaySessionStarted
Callback that will be invoked when a Lobby owner you're a part of starts a game. The Callback contains 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<RoomData> OnPlaySessionStarted