Skip to main content
Version: 5.7.0

CreateMatchWithInitialTurn

Creates an instance of an asynchronous match with an initial turn.

Opponent IDs is a JSON array containing objects with a Platform and player ID. Platforms are identified as:

  • BC - a brainCloud profile id
  • FB - a Facebook id
  • STEAM - a Steam id
  • PSN - a Playstation id

An example of this string would be:

[{
"platform":"BC",
"id": "some-braincloud-profile"
},
{
"platform":"FB",
"id": "some-facebook-id"
}]
ServiceOperation
asyncMatchCREATE

Method Parameters

ParameterDescription
jsonOpponentIdsList of objects identifying the opponent platform and id for this match.
jsonMatchStateJSON object provided by the caller
pushNotificationMessageOptional push notification message to send to the other party. Refer to the Push Notification functions for the syntax required.
nextPlayerOptionally, force the next player player to be a specific player
jsonSummaryOptional JSON object defining what the other player will see as a summary of the game when listing their games

Usage

http://localhost:3000
string jsonOpponentIds = "[{\"platform\":\"BC\",\"id\":\"profile ID-1\"},{\"platform\":\"FB\",\"id\":\"Facebook ID-1\"}]";
string jsonMatchState = "{}";
string pushNotificationMessage = "You have been entered into an async-match!";
string nextPlayer = "Facebook ID-1";
string jsonSummary = "{\"Address\": \"South Africa\"}";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.AsyncMatchService.CreateMatchWithInitialTurn(jsonOpponentIds, jsonMatchState, pushNotificationMessage, nextPlayer, jsonSummary, successCallback, failureCallback);
JSON Response
{
"data" : {
"createdAt" : 1449737412088,
"gameId" : "102345",
"matchId" : "af876cc7-1dd1-4fbe-959d-a9awdsab9a1c",
"ownerId" : "c76009c3-ea92-41c5-8560-e1dwasc07ce6b",
"players" : [
{
"pictureUrl" : null,
"playerId" : "c76009c3-ea92-41c5-8560-e1dwasc07ce6b",
"playerName" : "UserA_CPP_96764398"
},
{
"pictureUrl" : null,
"playerId" : "3bb9dwasdd-9c9a-454f-ae17-9703a66973c8",
"playerName" : "UserB_CPP_80148460"
}
],
"status" : {
"currentPlayer" : "3bb9dwasdd-9c9a-454f-ae17-9703a66973c8",
"status" : "PENDING"
},
"summary" : {
"map" : "level01"
},
"updatedAt" : 1449737412092,
"version" : 1
},
"status" : 200
}