Class LobbiesService
public class LobbiesService
- Inheritance
-
LobbiesService
Constructors
LobbiesService(CloudCredentialsPair, IRuntimeSettings)
public LobbiesService(CloudCredentialsPair credentialsPair = null, IRuntimeSettings runtimeSettings = null)
Parameters
credentialsPairCloudCredentialsPairruntimeSettingsIRuntimeSettings
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
createOptionsCreateLobbyOptionsOptions that will be used to create a Lobby.
onRequestFinishedAction<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
createOptionsCreateLobbyOptionsOptions 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
onRequestFinishedAction<RequestResponse<LobbyStats>>Callback that will be invoked when the request finished.
tagsList<string>Optional list of tags to filter the fetched stats.
regionsList<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
tagsList<string>Optional list of tags to filter the fetched stats.
regionsList<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
onRequestFinishedAction<RequestResponse<IReadOnlyList<LobbyData>>>Callback that will be invoked when the request finished.
findOptionsFindLobbyOptionsOptional 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
findOptionsFindLobbyOptionsOptional 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
findOptionsFindLobbyOptionsOptions that will be used to try to find a suitable Lobby.
createOptionsCreateLobbyOptionsOptions that will be used to create a Lobby if no suitable Lobby is found.
onRequestFinishedAction<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
findOptionsFindLobbyOptionsOptions that will be used to try to find a suitable Lobby.
createOptionsCreateLobbyOptionsOptions 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
lobbyIdstring
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
lobbyLobbyDataonRequestFinishedAction<RequestResponse<LobbySession>>Callback that will be invoked when the request finished.
playerAttrList<CloudAttribute>Optional parameter to add player attributes to the joined Lobby.
secretstringOptional 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
lobbyLobbyDataplayerAttrList<CloudAttribute>Optional parameter to add player attributes to the joined Lobby.
secretstringOptional 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
lobbyLobbyDataLobby you want to refresh the data of.
onRequestFinishedAction<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
lobbyIdstringLobby ID you want to refresh the data of.
onRequestFinishedAction<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
lobbyLobbyDataLobby 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
lobbyIdstringLobby 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 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