Class LobbySession
public class LobbySession
- Inheritance
-
LobbySession
Constructors
LobbySession(LobbiesService, LobbyData, IAuthClient, IRequestFactory)
public LobbySession(LobbiesService lobbiesService, LobbyData lobbyData, IAuthClient authClient, IRequestFactory requestFactory)
Parameters
lobbiesService
LobbiesServicelobbyData
LobbyDataauthClient
IAuthClientrequestFactory
IRequestFactory
Fields
OnLobbyAttributesChanged
Callback that will be invoked when the owner of the Lobby adds or updates a Lobby attribute, or when an indexed Attribute gets updated through a Player updating his/her own Attribute.
public Action<LobbySession, IReadOnlyList<CloudAttribute>> OnLobbyAttributesChanged
Field Value
OnLobbyDisposed
Callback that will be invoked when a Lobby its disposed and will no longer be usable. This can happen by manually leaving the Lobby, or logging out from your current user.
public Action<LobbySession> OnLobbyDisposed
Field Value
OnLobbyOwnerChanged
Callback that will be invoked when the Lobby changes active owner.
public Action<LobbySession, Player> OnLobbyOwnerChanged
Field Value
OnLobbyUpdated
Callback that will be invoked when a Lobby its updated by any of the previous cases. For example, if a player leaves or joins or updates the Attributes, this Callback will always be invoked alongside the specific one.
public Action<LobbySession> OnLobbyUpdated
Field Value
OnMessageReceived
Callback that will be invoked when your Player receives one or messages through the Lobby.
public Action<LobbySession, MessagesReceived> OnMessageReceived
Field Value
OnPlayerAttributesChanged
Callback that will be invoked when a Player within the Lobby adds or updates an Attribute.
public Action<LobbySession, Player, IReadOnlyList<CloudAttribute>> OnPlayerAttributesChanged
Field Value
OnPlayerJoined
Callback that will be invoked when a new Player joins the Lobby.
public Action<LobbySession, Player> OnPlayerJoined
Field Value
OnPlayerLeft
Callback that will be invoked when a Player leaves the Lobby.
public Action<LobbySession, Player, string> OnPlayerLeft
Field Value
Properties
IsDisposed
If the current LobbySession is disposed, it means that you're no longer part of this Lobby and this instance cannot be reused. Attempting to use any Endpoint while disposed will throw an exception.
public bool IsDisposed { get; }
Property Value
LobbyData
public LobbyData LobbyData { get; }
Property Value
LobbyOwnerActions
Instance of LobbyOwnerSession that will allow you to call endpoints that are only available for the Owner of the Lobby. If you're not the Owner of the Lobby, this property will return null.
public LobbyOwnerSession LobbyOwnerActions { get; }
Property Value
MyPlayer
Player struct that represents your Player within the Lobby.
public Player? MyPlayer { get; }
Property Value
OwnerPlayer
Player struct that represents the Player who is the Owner of the Lobby.
public Player OwnerPlayer { get; }
Property Value
Methods
AddOrUpdateMyAttributes(List<CloudAttribute>, Action<RequestResponse<bool>>)
Through this method you will be able to add new Attributes or update existing Attributes. Deleting existing Attributes is not supported, the list supplied as parameter will be merged with your current Attributes if the request succeeds with the backend.
public void AddOrUpdateMyAttributes(List<CloudAttribute> attributes, Action<RequestResponse<bool>> onRequestFinished)
Parameters
attributes
List<CloudAttribute>List of Attributes to be added or updated for the current Lobby.
onRequestFinished
Action<RequestResponse<bool>>Callback that will be invoked when the request finished.
AddOrUpdateMyAttributesAsync(List<CloudAttribute>)
Through this method you will be able to add new Attributes or update existing Attributes. Deleting existing Attributes is not supported, the list supplied as parameter will be merged with your current Attributes if the request succeeds with the backend.
public Task<bool> AddOrUpdateMyAttributesAsync(List<CloudAttribute> attributes)
Parameters
attributes
List<CloudAttribute>List of Attributes to be added or updated for the current Lobby.
Returns
Dispose()
public void Dispose()
GetAddOrUpdateMyAttributesCooldown()
public TimeSpan GetAddOrUpdateMyAttributesCooldown()
Returns
- TimeSpan
Returns the internal cooldown for the Add Or Update My Attributes endpoint.
GetSendMessageCooldown()
public TimeSpan GetSendMessageCooldown()
Returns
- TimeSpan
Returns the internal cooldown for the Send Message endpoint.
LeaveLobby(Action<RequestResponse<bool>>)
Leave the active Lobby. The current LobbySession instance will be disposed.
public void LeaveLobby(Action<RequestResponse<bool>> onRequestFinished)
Parameters
onRequestFinished
Action<RequestResponse<bool>>
LeaveLobbyAsync()
Leave the active Lobby. The current LobbySession instance will be disposed.
public Task<bool> LeaveLobbyAsync()
Returns
RefreshLobby(Action)
Refresh the current data for the active Lobby.
public void RefreshLobby(Action onFinished)
Parameters
onFinished
Action
RefreshLobbyAsync()
Refresh the current data for the active Lobby.
public Task RefreshLobbyAsync()
Returns
SendMessage(List<string>, Action<RequestResponse<bool>>, List<Player>)
Send a message to other Players of the current Lobby.
public void SendMessage(List<string> messages, Action<RequestResponse<bool>> onRequestFinished, List<Player> targets = null)
Parameters
messages
List<string>List of messages to be sent to other Players.
onRequestFinished
Action<RequestResponse<bool>>Callback that will be invoked when the request finished.
targets
List<Player>Optional list of Players to send the messages to. If left empty, it will be send to everyone.
SendMessageAsync(List<string>, List<Player>)
Send a message to other Players of the current Lobby.
public Task<bool> SendMessageAsync(List<string> messages, List<Player> targets = null)
Parameters
messages
List<string>List of messages to be sent to other Players.
targets
List<Player>Optional list of Players to send the messages to. If left empty, it will be send to everyone.