Interface IRealTimeMultiplayerClient
Real-Time Multiplayer API.
Namespace: EasyMobile
Assembly: cs.temp.dll.dll
Syntax
public interface IRealTimeMultiplayerClient
Methods
AcceptInvitation(Invitation, Boolean, IRealTimeMultiplayerListener)
Accepts a real-time match invitation.
Declaration
void AcceptInvitation(Invitation invitation, bool showWaitingRoomUI, IRealTimeMultiplayerListener listener)
Parameters
Type | Name | Description |
---|---|---|
Invitation | invitation | Invitation to accept. |
System.Boolean | showWaitingRoomUI | Whether to show the waiting room UI. |
IRealTimeMultiplayerListener | listener | The listener to handle relevant events of the accepted match. |
Remarks
The listener's OnRoomSetupProgress(Single) will be called to report room setup progress, and eventually OnRoomConnected(Boolean) will be called to indicate that the room setup is either complete or has failed (check the success parameter of the callback). You can optionally show the standard waiting room UI during the room setup process using the "showWaitingRoomUI" parameter.
CreateQuickMatch(MatchRequest, IRealTimeMultiplayerListener)
Creates a real-time match with randomly selected opponent(s). No UI will be shown.
Declaration
void CreateQuickMatch(MatchRequest request, IRealTimeMultiplayerListener listener)
Parameters
Type | Name | Description |
---|---|---|
MatchRequest | request | The match request. |
IRealTimeMultiplayerListener | listener | The listener for this match. |
CreateWithMatchmakerUI(MatchRequest, IRealTimeMultiplayerListener)
Creates a real-time match with the standard matchmaker UI where the initiating player can invite friends, nearby players or pick random opponents to join the match.
Declaration
void CreateWithMatchmakerUI(MatchRequest request, IRealTimeMultiplayerListener listener)
Parameters
Type | Name | Description |
---|---|---|
MatchRequest | request | The match request. |
IRealTimeMultiplayerListener | listener | The listener for this match. |
DeclineInvitation(Invitation)
Declines a real-time match invitation.
Declaration
void DeclineInvitation(Invitation invitation)
Parameters
Type | Name | Description |
---|---|---|
Invitation | invitation | Invitation to decline. |
GetConnectedParticipants()
Gets the connected participants in the room, including self (the local player).
Declaration
List<Participant> GetConnectedParticipants()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<Participant> | The connected participants, including self. This list is guaranteed to be ordered lexicographically by Participant ID, which means the ordering will be the same to all participants. |
GetParticipant(String)
Gets a connected participant by ID.
Declaration
Participant GetParticipant(string participantId)
Parameters
Type | Name | Description |
---|---|---|
System.String | participantId | Participant identifier. |
Returns
Type | Description |
---|---|
Participant | The participant, or |
GetSelf()
Gets the participant that represents the local player in the room.
Declaration
Participant GetSelf()
Returns
Type | Description |
---|---|
Participant | The participant representing the local player. |
IsRoomConnected()
Returns whether or not the room is connected, which means all participants have joined and it's ready to play.
Declaration
bool IsRoomConnected()
Returns
Type | Description |
---|---|
System.Boolean |
|
LeaveRoom()
Leaves the room.
Declaration
void LeaveRoom()
Remarks
Call this method to leave the room after you have
started room setup. Leaving the room is not an immediate operation - you
must wait for
SendMessage(Boolean, String, Byte[])
Sends a message to a particular participant.
Declaration
void SendMessage(bool reliable, string participantId, byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | reliable | If set to true, reliable messaging is used; otherwise, it is unreliable. Unreliable messages are faster, but are not guaranteed to arrive and may arrive out of order. |
System.String | participantId | Identifier of the participant to whom the message will be sent. |
System.Byte[] | data | The data to send. |
SendMessage(Boolean, String, Byte[], Int32, Int32)
Same as SendMessage(Boolean, String, Byte[]), but allows you to specify the offset and length of the data buffer. A typical use of this method is to send a large amount of data as smaller chunks of reliable messages.
Declaration
void SendMessage(bool reliable, string participantId, byte[] data, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | reliable | If set to true, reliable messaging is used; otherwise, it is unreliable. Unreliable messages are faster, but are not guaranteed to arrive and may arrive out of order. |
System.String | participantId | Identifier of the participant to whom the message will be sent. |
System.Byte[] | data | The data to send. |
System.Int32 | offset | Offset of the data buffer where data starts. |
System.Int32 | length | Length of data (from offset). |
SendMessageToAll(Boolean, Byte[])
Sends a message to all other participants.
Declaration
void SendMessageToAll(bool reliable, byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | reliable | If set to true, reliable messaging is used; otherwise, it is unreliable. Unreliable messages are faster, but are not guaranteed to arrive and may arrive out of order. |
System.Byte[] | data | The data to send. |
SendMessageToAll(Boolean, Byte[], Int32, Int32)
Same as SendMessageToAll(Boolean, Byte[]), but allows you to specify offset and length of the data buffer. A typical use of this method is to broadcast a large amount of data as smaller chunks of reliable messages.
Declaration
void SendMessageToAll(bool reliable, byte[] data, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | reliable | If set to true, reliable messaging is used; otherwise, it is unreliable. Unreliable messages are faster, but are not guaranteed to arrive and may arrive out of order. |
System.Byte[] | data | The data to send. |
System.Int32 | offset | Offset of the data buffer where data starts. |
System.Int32 | length | Length of data (from offset). |
ShowInvitationsUI(IRealTimeMultiplayerListener)
[Google Play Games only] Shows the standard UI where the user can accept or decline real-time match invitations. This UI is only available on Google Play Games platform as invitations are communicated via the iMessage app on iOS (Game Center platform).
Declaration
void ShowInvitationsUI(IRealTimeMultiplayerListener listener)
Parameters
Type | Name | Description |
---|---|---|
IRealTimeMultiplayerListener | listener | The listener to handle relevant events of the accepted match. |
Remarks
On the invitations screen, the player can select an invitation to accept, in which case the room setup process will start. The listener's OnRoomSetupProgress(Single) will be called to report room setup progress, and eventually OnRoomConnected(Boolean) will be called to indicate that the room setup is either complete or has failed (check the success parameter of the callback).