com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch |
![]() |
Data interface for turn-based specific match functionality.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | MATCH_STATUS_ACTIVE | Constant returned by getStatus() indicating that the match has started. |
|||||||||
int | MATCH_STATUS_AUTO_MATCHING | Constant returned by getStatus() indicating that one or more slots are waiting to be
filled by auto-matching. |
|||||||||
int | MATCH_STATUS_CANCELED | Constant returned by getStatus() indicating that the match was canceled by one of
the participants. |
|||||||||
int | MATCH_STATUS_COMPLETE | Constant returned by getStatus() indicating that the match has finished. |
|||||||||
int | MATCH_STATUS_EXPIRED | Constant returned by getStatus() indicating that the match expired. |
|||||||||
int | MATCH_TURN_STATUS_COMPLETE | Turn status constant for matches which have been completed. | |||||||||
int | MATCH_TURN_STATUS_INVITED | Turn status constant for matches which the current player has been invited to. | |||||||||
int | MATCH_TURN_STATUS_MY_TURN | Turn status constant for matches where it is the current player's turn. | |||||||||
int | MATCH_TURN_STATUS_THEIR_TURN | Turn status constant for matches where it is not the current player's turn. | |||||||||
int | MATCH_VARIANT_DEFAULT | Constant used to indicate that the variant for a match is unspecified. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
MATCH_TURN_STATUS_ALL | Array of all the turn status constants. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return whether or not this match can be rematched.
| |||||||||||
Retrieves the automatch criteria used to create or join this match, if any.
| |||||||||||
Return the maximum number of available automatch slots for this match.
| |||||||||||
Return the current (game-specific) data for this match.
| |||||||||||
Loads the match description into the given
CharArrayBuffer . | |||||||||||
Get the participant representing the primary opponent in the match.
| |||||||||||
Get the ID of another participant in the match that can be used when describing the
participants the user is playing with.
| |||||||||||
Return the timestamp at which the match was last modified.
| |||||||||||
Return the ID of the participant who updated the match most recently.
| |||||||||||
Return the match sequence number for this match.
| |||||||||||
Get a participant in a match by its ID.
| |||||||||||
Get the participant ID for a given player.
| |||||||||||
Get the IDs of the participants of the given match.
| |||||||||||
Get the status of a participant in a match.
| |||||||||||
Return the ID of the participant that is considered pending.
| |||||||||||
Return the match data from the previous match, if available.
| |||||||||||
Return the match ID of the rematch that was created from this match, if any.
| |||||||||||
Return the current version of the match.
| |||||||||||
Return whether or not this match has been locally modified.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
Constant returned by getStatus()
indicating that the match has started.
Constant returned by getStatus()
indicating that one or more slots are waiting to be
filled by auto-matching.
Constant returned by getStatus()
indicating that the match was canceled by one of
the participants.
Constant returned by getStatus()
indicating that the match has finished.
Constant returned by getStatus()
indicating that the match expired.
Turn status constant for matches which have been completed.
Turn status constant for matches which the current player has been invited to.
Turn status constant for matches where it is the current player's turn.
Turn status constant for matches where it is not the current player's turn.
Constant used to indicate that the variant for a match is unspecified.
Array of all the turn status constants.
Return whether or not this match can be rematched. This will return true when the match has complete and has not already been rematched.
Returns | |
---|---|
boolean |
Whether or not this match can be rematched. |
Retrieves the automatch criteria used to create or join this match, if any. May be null if the match has no automatch properties.
Returns | |
---|---|
Bundle |
A bundle containing the automatch criteria for this match. |
Return the maximum number of available automatch slots for this match. If automatch criteria were not specified during match creation, or if all slots have been filled, this will return 0.
Returns | |
---|---|
int |
The maximum number of additional players that can be added to this match. |
Returns | |
---|---|
long |
The server timestamp at which the match was created. |
Returns | |
---|---|
String |
The ID of the participant who created this Match. |
Return the current (game-specific) data for this match.
Returns | |
---|---|
byte[] |
Byte array representing the current (game-specific) match state data. |
Returns | |
---|---|
String |
Description of this match. |
Loads the match description into the given CharArrayBuffer
.
Parameters | |
---|---|
dataOut |
CharArrayBuffer :
The buffer to load the data into.
|
Get the participant representing the primary opponent in the match.
Note that this will return null
if there is no primary opponent. This could happen if
an automatch slot has not been filled.
Returns | |
---|---|
Participant |
The participant representing the primary opponent in the match. |
Get the ID of another participant in the match that can be used when describing the participants the user is playing with. For example, in a four player match this might be used to state "Martha (and 2 others)".
Note that this will return null
if there is no primary opponent. This could happen if
an automatch slot has not been filled.
Returns | |
---|---|
String |
The participant ID of the primary opponent in the match. |
Return the timestamp at which the match was last modified.
Returns | |
---|---|
long |
The server timestamp at which the match was last modified. |
Return the ID of the participant who updated the match most recently.
Returns | |
---|---|
String |
The ID of the last participant who updated this Match object. |
Returns | |
---|---|
String |
The ID of this Match. |
Return the match sequence number for this match. This number starts at 1, and increases every time a rematch is created.
Returns | |
---|---|
int |
The match sequence number for this match. |
Get a participant in a match by its ID. Note that the participant ID must correspond to a participant in this match, or this method will throw an exception.
Parameters | |
---|---|
participantId |
String :
Match-local ID of the participant to retrieve status for. |
Returns | |
---|---|
Participant |
The participant corresponding to the given ID. |
Throws | |
---|---|
|
IllegalStateException} if the participant is not a participant in this match. |
Get the participant ID for a given player. This will only return a non-null ID if the player is actually a participant in the match and that player's identity is visible to the current player. Note that this will always return non-null for the current player.
To find the player ID for the current player, use getCurrentPlayerId(GoogleApiClient)
.
Parameters | |
---|---|
playerId |
String :
Player ID to find participant ID for. |
Returns | |
---|---|
String |
The participant ID corresponding to given player, or null if none found. |
Get the IDs of the participants of the given match.
Returns | |
---|---|
ArrayList<String> |
The IDs of the participants in this match. These are returned in the participant order of the match. Note that these are not stable across matches. |
Get the status of a participant in a match. Note that the participant ID must correspond to a participant in this match, or this method will throw an exception.
Parameters | |
---|---|
participantId |
String :
Match-local ID of the participant to retrieve status for. |
Returns | |
---|---|
int |
The current status of the participant in this match. One of
STATUS_INVITED , STATUS_JOINED ,
STATUS_DECLINED , STATUS_LEFT ,
or STATUS_NOT_INVITED_YET . |
Throws | |
---|---|
|
IllegalStateException} if the participant is not a participant in this match. |
Return the ID of the participant that is considered pending. If no participant is considered pending (ie, the match is over, etc), this function will return null.
Returns | |
---|---|
String |
The ID of the participant that is considered pending, if any. Returns null if no participant is pending. |
Return the match data from the previous match, if available. Note that this is only provided on the first turn of a rematched match.
Returns | |
---|---|
byte[] |
Byte array of data from the previous match of a rematch, or null if not available. |
Return the match ID of the rematch that was created from this match, if any. This will only be non-null if a rematch has been created.
Returns | |
---|---|
String |
The match ID of the rematch, or null if no rematch exists. |
Returns | |
---|---|
int |
The current status of the match. One of MATCH_STATUS_AUTO_MATCHING ,
MATCH_STATUS_ACTIVE , MATCH_STATUS_COMPLETE ,
MATCH_STATUS_EXPIRED , or MATCH_STATUS_CANCELED .
|
Returns | |
---|---|
int |
The turn status of the match for the current player. One of
MATCH_TURN_STATUS_INVITED , MATCH_TURN_STATUS_MY_TURN ,
MATCH_TURN_STATUS_THEIR_TURN , or MATCH_TURN_STATUS_COMPLETE .
|
Returns | |
---|---|
int |
Variant specified for this match, if any. A variant is an optional
developer-controlled parameter describing the type of game to play, ranging from
1-1023 (inclusive). If this match had no variant specified, returns
MATCH_VARIANT_DEFAULT .
|
Return the current version of the match.
Returns | |
---|---|
int |
The current version of the match. |
Return whether or not this match has been locally modified. If this is true, the local device
has match state which has not successfully synced to the server yet. In this state, further
mutations to the match will fail with a status of
STATUS_MATCH_ERROR_LOCALLY_MODIFIED
.
Returns | |
---|---|
boolean |
Whether this match has local modifications or not. |