![]() |
CotC C# SDK for Unity
v1.4.0.1
Making social games is easy !
|
Some methods accept a PushNotification parameter. This parameter can be used to forward a push notification to the users who are not active at the moment.
Properties | |
Action< MatchInviteEvent > | OnMatchInvitation |
Public Member Functions | |
Promise< Match > | Create (int maxPlayers, string description=null, Bundle customProperties=null, Bundle shoe=null, Bundle globalState=null) |
Creates a match, available for join by other players. If you would like to make your match private, please read the general documentation about matches. More... | |
Promise< Done > | Delete (string matchId) |
Deletes a match. Only works if you are the one who created it and it is already finished. More... | |
Promise< Done > | DismissInvitation (string matchId) |
Dismisses an invitation to a match. More... | |
void | DiscardEventHandlers () |
Clears all event handlers subscribed, ensuring that a match object can be dismissed without causing further actions in the background. More... | |
GamerMatches | Domain (string domain) |
Changes the domain affected by the next operations. You should typically use it this way: gamer.Matches.Domain("private").List(...); More... | |
Promise< Match > | Fetch (string matchId) |
Fetches a Match object corresponding to a match which the player already belongs to. It can be used either to obtain additional information about a running match (by inspecting the resulting match object), or to continue an existing match (by keeping the match object which corresponds to the one that was returned by the Create method). This call is not scoped by domain (it uses the Match ID directly). More... | |
Promise< Match > | Join (string matchId, PushNotification notification=null) |
Asks to join the match with a given ID. Do not use this if you are already part of the match. This call is not scoped by domain (it uses the Match ID directly). More... | |
Promise< PagedList< MatchListResult > > | List (bool participating=false, bool invited=false, bool finished=false, bool full=false, int limit=30, int offset=0) |
Can be used to list the active matches for this game. In general, it is not recommended to proceed this way if your goal is to display the games that may be joined. The indexing API is better suited to this use case (index the match along with properties and look for matches matching the desired properties). More... | |
Promise<Match> CotcSdk.GamerMatches.Create | ( | int | maxPlayers, |
string | description = null , |
||
Bundle | customProperties = null , |
||
Bundle | shoe = null , |
||
Bundle | globalState = null |
||
) |
Creates a match, available for join by other players. If you would like to make your match private, please read the general documentation about matches.
maxPlayers | The maximum number of players who may be in the game at a time. |
description | String describing the match (available for other who want to join). |
customProperties | Freeform object containing the properties of the match, which may be used by other players to search for a suited match. |
shoe | Freeform object containing a list of objects which will be shuffled upon match creation. This offers an easy way to make a random generator that is safe, unbiased (since made on the server) and can be verified by all players once the game is finished. This bundle needs to be an array (use Bundle.CreateArray). |
globalState | Global state you want to attach to the match. |
Deletes a match. Only works if you are the one who created it and it is already finished.
matchId | ID of the match to delete. |
void CotcSdk.GamerMatches.DiscardEventHandlers | ( | ) |
Clears all event handlers subscribed, ensuring that a match object can be dismissed without causing further actions in the background.
Dismisses an invitation to a match.
matchId | ID of the match where invitation is dismissed. |
GamerMatches CotcSdk.GamerMatches.Domain | ( | string | domain | ) |
Changes the domain affected by the next operations. You should typically use it this way: gamer.Matches.Domain("private").List(...);
domain | Domain on which to scope the matches. Default to private if unmodified. |
Fetches a Match object corresponding to a match which the player already belongs to. It can be used either to obtain additional information about a running match (by inspecting the resulting match object), or to continue an existing match (by keeping the match object which corresponds to the one that was returned by the Create method). This call is not scoped by domain (it uses the Match ID directly).
matchId | The ID of an existing match to resume. It can be fetched from the Match object (MatchId). |
Promise<Match> CotcSdk.GamerMatches.Join | ( | string | matchId, |
PushNotification | notification = null |
||
) |
Asks to join the match with a given ID. Do not use this if you are already part of the match. This call is not scoped by domain (it uses the Match ID directly).
matchId | The ID of an existing match to join. It can be fetched from the Match object (MatchId). |
notification | Optional push notification to be sent to inactive players (see class definition). |
Promise<PagedList<MatchListResult> > CotcSdk.GamerMatches.List | ( | bool | participating = false , |
bool | invited = false , |
||
bool | finished = false , |
||
bool | full = false , |
||
int | limit = 30 , |
||
int | offset = 0 |
||
) |
Can be used to list the active matches for this game. In general, it is not recommended to proceed this way if your goal is to display the games that may be joined. The indexing API is better suited to this use case (index the match along with properties and look for matches matching the desired properties).
participating | Set to true to only list matches to which this user is participating. |
invited | Set to true to filter by matches you are invited to (only include them). |
finished | Set to true to also include finished matchs (which are filtered out by default). |
full | Set to true to also include games where the maximum number of players has been reached. |
limit | For pagination, allows to set a greater or smaller page size than the default 30. |
offset | For pagination, avoid using it explicitly. |