![]() |
CotC C# SDK for Unity
v1.4.0.1
Making social games is easy !
|
Represents a match with which you can interact through high level functionality. A match object is returned when you create a match, join it and so on. You should subscribe to ReceivedEvent right after you got this object.
Properties | |
GamerInfo | Creator [get] |
Describes the creator of the match. More... | |
Bundle | CustomProperties [get] |
Custom properties, as passed at the creation of the match. More... | |
string | Domain [get] |
The domain to which the match belongs (default is private ). More... | |
string | Description [get] |
Description of the match, as defined by the user upon creation. More... | |
Gamer | Gamer [get] |
Parent gamer object. More... | |
Bundle | GlobalState [get] |
The global state of the game, which may be modified using a move. More... | |
bool | IsCreator [get] |
string | LastEventId [get] |
The ID of the last event happened during this game; keep this for later, you might need it for some calls. More... | |
string | MatchId [get] |
The ID of the match. Keep this for later as it is useful to continue a match. More... | |
int | MaxPlayers [get] |
Maximum number of players, as passed. More... | |
List< MatchMove > | Moves [get] |
List of existing events, which may be used to reproduce the state of the game. More... | |
Action< Match, MatchFinishEvent > | OnMatchFinished |
Event raised when the match is marked as finished. As with most match events, this event is delivered to all users currently participating to the match except the user who initiated it (that is, oneself). More... | |
Action< Match, MatchJoinEvent > | OnPlayerJoined |
Event raised when a player joins the match (excluding us obviously). More... | |
Action< Match, MatchLeaveEvent > | OnPlayerLeft |
Event raised when a player leaves the match (excluding us obviously). More... | |
Action< Match, MatchMoveEvent > | OnMovePosted |
Event raised when a move is posted by any player except us in the match. More... | |
Action< Match, MatchShoeDrawnEvent > | OnShoeDrawn |
Event raised when an element is drawn from the shoe. More... | |
List< GamerInfo > | Players [get] |
IDs of players participating to the match, including the creator (which is reported alone there at creation). More... | |
int | Seed [get] |
A random seed that can be used to ensure consistent state across players of the game. This is a 31 bit number. More... | |
MatchStatus | Status [get] |
The current state of the match (running, finished). More... | |
Bundle | Shoe [get] |
An array of objects that are shuffled when the match starts. You can put anything you want inside and use it as values for your next game. This field is only returned when finishing a match. More... | |
![]() | |
Bundle | this[string key] [get] |
Allows to query additional properties via an indexer (can be enriched via hooks). More... | |
Public Member Functions | |
void | DiscardEventHandlers () |
Clears all event handlers subscribed, ensuring that a match object can be dismissed without causing further actions in the background. More... | |
Promise< DrawnItemsResult > | DrawFromShoe (int count=1, PushNotification notification=null) |
Draws an item from the shoe. More... | |
Promise< Done > | Finish (bool deleteToo=false, PushNotification notification=null) |
Terminates the match. You need to be the creator of the match to perform this operation. More... | |
Promise< Done > | InvitePlayer (string playerId, PushNotification notification=null) |
Allows to invite a player to join a match. You need to be part of the match to send an invitation. This can be used to invite an opponent to a match that is not shown publicly. More... | |
Promise< Done > | Leave (PushNotification notification=null) |
Leaves the match. More... | |
void | Lock (Action block) |
Protects the match against concurrent modification. Please look at the tutorial for more information on this subject. Basically, you should use it to protect your game state from race conditions. More... | |
Promise< Done > | PostMove (Bundle moveData, Bundle updatedGameState=null, PushNotification notification=null) |
Posts a move to other players. More... | |
![]() | |
Bundle | AsBundle () |
Gets the underlying Bundle. Dangerous, only use internally, when you want to put the contents of a properties object into an existing bundle. More... | |
Dictionary< string, Bundle >.KeyCollection | Keys () |
Allows to browse all keys (might include some that are already exposed as typed properties in the object). More... | |
Dictionary< string, Bundle >.Enumerator | GetEnumerator () |
Allows to browse all keys (might include some that are already exposed as typed properties in the object). More... | |
override string | ToString () |
You may use this to debug what is inside this property object. More... | |
string | ToJson () |
Builds a JSON representation of this object, same as ToString actually. More... | |
Additional Inherited Members | |
![]() | |
PropertiesObject (Bundle baseData) | |
![]() | |
Bundle | Props |
|
get |
Describes the creator of the match.
|
get |
Custom properties, as passed at the creation of the match.
|
get |
Description of the match, as defined by the user upon creation.
|
get |
The domain to which the match belongs (default is private
).
|
get |
Parent gamer object.
|
get |
The global state of the game, which may be modified using a move.
|
get |
|
get |
The ID of the last event happened during this game; keep this for later, you might need it for some calls.
|
get |
The ID of the match. Keep this for later as it is useful to continue a match.
|
get |
Maximum number of players, as passed.
|
get |
List of existing events, which may be used to reproduce the state of the game.
|
addremove |
Event raised when the match is marked as finished. As with most match events, this event is delivered to all users currently participating to the match except the user who initiated it (that is, oneself).
|
addremove |
Event raised when a move is posted by any player except us in the match.
|
addremove |
Event raised when a player joins the match (excluding us obviously).
|
addremove |
Event raised when a player leaves the match (excluding us obviously).
|
addremove |
Event raised when an element is drawn from the shoe.
|
get |
IDs of players participating to the match, including the creator (which is reported alone there at creation).
|
get |
A random seed that can be used to ensure consistent state across players of the game. This is a 31 bit number.
|
get |
An array of objects that are shuffled when the match starts. You can put anything you want inside and use it as values for your next game. This field is only returned when finishing a match.
|
get |
The current state of the match (running, finished).
void CotcSdk.Match.DiscardEventHandlers | ( | ) |
Clears all event handlers subscribed, ensuring that a match object can be dismissed without causing further actions in the background.
Promise<DrawnItemsResult> CotcSdk.Match.DrawFromShoe | ( | int | count = 1 , |
PushNotification | notification = null |
||
) |
Draws an item from the shoe.
(int)result.Value[0]
to fetch the first value as integer.count | The number of items to draw from the shoe. |
notification | A notification that can be sent to all players currently playing the match (except you). |
Promise<Done> CotcSdk.Match.Finish | ( | bool | deleteToo = false , |
PushNotification | notification = null |
||
) |
Terminates the match. You need to be the creator of the match to perform this operation.
deleteToo | If true, deletes the match if it finishes successfully or is already finished. |
notification | A notification that can be sent to all players currently playing the match (except you). |
Promise<Done> CotcSdk.Match.InvitePlayer | ( | string | playerId, |
PushNotification | notification = null |
||
) |
Allows to invite a player to join a match. You need to be part of the match to send an invitation. This can be used to invite an opponent to a match that is not shown publicly.
playerId | ID of the player to invite to the match. Player IDs can be found in the properties of the match (GamerInfo.GamerId). |
notification | A push notification that can be sent to the invitee. |
Promise<Done> CotcSdk.Match.Leave | ( | PushNotification | notification = null | ) |
Leaves the match.
notification | A push notification that can be sent to all players except you. |
void CotcSdk.Match.Lock | ( | Action | block | ) |
Protects the match against concurrent modification. Please look at the tutorial for more information on this subject. Basically, you should use it to protect your game state from race conditions.
Promise<Done> CotcSdk.Match.PostMove | ( | Bundle | moveData, |
Bundle | updatedGameState = null , |
||
PushNotification | notification = null |
||
) |
Posts a move to other players.
moveData | A freeform object indicating the move data to be posted and transfered to other players. This move data will be kept in the events, and new players should be able to use it to reproduce the local game state. |
updatedGameState | A freeform object replacing the global game state, to be used by players who join from now on. Passing a non null value clears the pending events in the match. |
notification | A push notification that can be sent to all players except you. |