Package com.bitheads.braincloud.services
Class AsyncMatchService
java.lang.Object
com.bitheads.braincloud.services.AsyncMatchService
public class AsyncMatchService extends Object
-
Constructor Summary
Constructors Constructor Description AsyncMatchService(BrainCloudClient client) -
Method Summary
Modifier and Type Method Description voidabandonMatch(String ownerId, String matchId, IServerCallback callback)Marks the given match as abandoned.voidabandonMatchWithSummaryData(String ownerId, String matchId, String pushContent, String summary, IServerCallback callback)Marks the given match as abandoned.voidcompleteMatch(String ownerId, String matchId, IServerCallback callback)Marks the given match as complete.voidcompleteMatchWithSummaryData(String ownerId, String matchId, String pushContent, String summary, IServerCallback callback)Marks the given match as abandoned.voidcreateMatch(String jsonOpponentIds, String pushNotificationMessage, IServerCallback callback)Creates an instance of an asynchronous match.voidcreateMatchWithInitialTurn(String jsonOpponentIds, String jsonMatchState, String pushNotificationMessage, String nextPlayer, String jsonSummary, IServerCallback callback)Creates an instance of an asynchronous match with an initial turn.voiddeleteMatch(String ownerId, String matchId, IServerCallback callback)Removes the match and match history from the server.voidfindCompleteMatches(IServerCallback callback)Returns all matches that are in a COMPLETE state for which the player is involved.voidfindMatches(IServerCallback callback)Returns all matches that are NOT in a COMPLETE state for which the player is involved.voidreadMatch(String ownerId, String matchId, IServerCallback callback)Returns the current state of the given match.voidreadMatchHistory(String ownerId, String matchId, IServerCallback callback)Returns the match history of the given match.voidsubmitTurn(String ownerId, String matchId, BigInteger version, String jsonMatchState, String pushNotificationMessage, String nextPlayer, String jsonSummary, String jsonStatistics, IServerCallback callback)Submits a turn for the given match.voidupdateMatchSummaryData(String ownerId, String matchId, BigInteger version, String jsonSummary, IServerCallback callback)Allows the current player (only) to update Summary data without having to submit a whole turn.
-
Constructor Details
-
AsyncMatchService
-
-
Method Details
-
createMatch
public void createMatch(String jsonOpponentIds, String pushNotificationMessage, IServerCallback callback)Creates an instance of an asynchronous match. Service Name - AsyncMatch Service Operation - Create- Parameters:
jsonOpponentIds- JSON string identifying the opponent platform and id for this match. Platforms are identified as: BC - a brainCloud profile id FB - a Facebook id An exmaple of this string would be: [ { "platform": "BC", "id": "some-braincloud-profile" }, { "platform": "FB", "id": "some-facebook-id" } ]pushNotificationMessage- Optional push notification message to send to the other party. Refer to the Push Notification functions for the syntax required.callback- Optional instance of IServerCallback to call when the server response is received.
-
createMatchWithInitialTurn
public void createMatchWithInitialTurn(String jsonOpponentIds, String jsonMatchState, String pushNotificationMessage, String nextPlayer, String jsonSummary, IServerCallback callback)Creates an instance of an asynchronous match with an initial turn. Service Name - AsyncMatch Service Operation - Create- Parameters:
jsonOpponentIds- JSON string identifying the opponent platform and id for this match. Platforms are identified as: BC - a brainCloud profile id FB - a Facebook id An exmaple of this string would be: [ { "platform": "BC", "id": "some-braincloud-profile" }, { "platform": "FB", "id": "some-facebook-id" } ]jsonMatchState- JSON string blob provided by the callerpushNotificationMessage- Optional push notification message to send to the other party. Refer to the Push Notification functions for the syntax required.nextPlayer- Optionally, force the next player player to be a specific playerjsonSummary- Optional JSON string defining what the other player will see as a summary of the game when listing their gamescallback- Optional instance of IServerCallback to call when the server response is received.
-
submitTurn
public void submitTurn(String ownerId, String matchId, BigInteger version, String jsonMatchState, String pushNotificationMessage, String nextPlayer, String jsonSummary, String jsonStatistics, IServerCallback callback)Submits a turn for the given match. Service Name - AsyncMatch Service Operation - SubmitTurn- Parameters:
ownerId- Match owner identfiermatchId- Match identifierversion- Game state version to ensure turns are submitted once and in orderjsonMatchState- JSON string provided by the callerpushNotificationMessage- Optional push notification message to send to the other party. Refer to the Push Notification functions for the syntax required.nextPlayer- Optionally, force the next player player to be a specific playerjsonSummary- Optional JSON string that other players will see as a summary of the game when listing their gamesjsonStatistics- Optional JSON string blob provided by the callercallback- Optional instance of IServerCallback to call when the server response is received.
-
updateMatchSummaryData
public void updateMatchSummaryData(String ownerId, String matchId, BigInteger version, String jsonSummary, IServerCallback callback)Allows the current player (only) to update Summary data without having to submit a whole turn. Service Name - AsyncMatch Service Operation - UpdateMatchSummary- Parameters:
ownerId- Match owner identfiermatchId- Match identifierversion- Game state version to ensure turns are submitted once and in orderjsonSummary- JSON string that other players will see as a summary of the game when listing their gamescallback- Optional instance of IServerCallback to call when the server response is received.
-
completeMatch
Marks the given match as complete. Service Name - AsyncMatch Service Operation - Complete- Parameters:
ownerId- Match owner identifiermatchId- Match identifiercallback- Optional instance of IServerCallback to call when the server response is received.
-
readMatch
Returns the current state of the given match. Service Name - AsyncMatch Service Operation - ReadMatch- Parameters:
ownerId- Match owner identifiermatchId- Match identifiercallback- Optional instance of IServerCallback to call when the server response is received.
-
readMatchHistory
Returns the match history of the given match. Service Name - AsyncMatch Service Operation - ReadMatchHistory- Parameters:
ownerId- Match owner identifiermatchId- Match identifiercallback- Optional instance of IServerCallback to call when the server response is received.
-
findMatches
Returns all matches that are NOT in a COMPLETE state for which the player is involved. Service Name - AsyncMatch Service Operation - FindMatches- Parameters:
callback- Optional instance of IServerCallback to call when the server response is received.
-
findCompleteMatches
Returns all matches that are in a COMPLETE state for which the player is involved. Service Name - AsyncMatch Service Operation - FindMatchesCompleted- Parameters:
callback- Optional instance of IServerCallback to call when the server response is received.
-
abandonMatch
Marks the given match as abandoned. Service Name - AsyncMatch Service Operation - Abandon- Parameters:
ownerId- Match owner identifiermatchId- Match identifiercallback- Optional instance of IServerCallback to call when the server response is received.
-
deleteMatch
Removes the match and match history from the server. DEBUG ONLY, in production it is recommended the user leave it as completed. Service Name - AsyncMatch Service Operation - Delete- Parameters:
ownerId- Match owner identifiermatchId- Match identifiercallback- Optional instance of IServerCallback to call when the server response is received.
-
completeMatchWithSummaryData
public void completeMatchWithSummaryData(String ownerId, String matchId, String pushContent, String summary, IServerCallback callback)Marks the given match as abandoned. Service Name - AsyncMatch Service Operation - CompleteMatch- Parameters:
ownerId- Match owner identifiermatchId- Match identifierpushContent- Optional push notification message to send to the other party. Refer to the Push Notification functions for the syntax required.summary- Optional JSON string defining what the other player will see as a summary of the game when listing their games.callback- Optional instance of IServerCallback to call when the server response is received.
-
abandonMatchWithSummaryData
public void abandonMatchWithSummaryData(String ownerId, String matchId, String pushContent, String summary, IServerCallback callback)Marks the given match as abandoned. This call can send a notification message. Service Name - AsyncMatch Service Operation - AbandonMatch- Parameters:
ownerId- Match owner identifiermatchId- Match identifierpushContent- Optional push notification message to send to the other party. Refer to the Push Notification functions for the syntax required.summary- Optional JSON string defining what the other player will see as a summary of the game when listing their games.callback- Optional instance of IServerCallback to call when the server response is received.
-