Class AsyncMatchService

java.lang.Object
com.bitheads.braincloud.services.AsyncMatchService

public class AsyncMatchService
extends Object
  • Constructor Details

  • 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 caller
      pushNotificationMessage - 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 player
      jsonSummary - 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.
    • 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 identfier
      matchId - Match identifier
      version - Game state version to ensure turns are submitted once and in order
      jsonMatchState - JSON string provided by the caller
      pushNotificationMessage - 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 player
      jsonSummary - Optional JSON string that other players will see as a summary of the game when listing their games
      jsonStatistics - Optional JSON string blob provided by the caller
      callback - 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 identfier
      matchId - Match identifier
      version - Game state version to ensure turns are submitted once and in order
      jsonSummary - JSON string that other players 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.
    • completeMatch

      public void completeMatch​(String ownerId, String matchId, IServerCallback callback)
      Marks the given match as complete. Service Name - AsyncMatch Service Operation - Complete
      Parameters:
      ownerId - Match owner identifier
      matchId - Match identifier
      callback - Optional instance of IServerCallback to call when the server response is received.
    • readMatch

      public void readMatch​(String ownerId, String matchId, IServerCallback callback)
      Returns the current state of the given match. Service Name - AsyncMatch Service Operation - ReadMatch
      Parameters:
      ownerId - Match owner identifier
      matchId - Match identifier
      callback - Optional instance of IServerCallback to call when the server response is received.
    • readMatchHistory

      public void readMatchHistory​(String ownerId, String matchId, IServerCallback callback)
      Returns the match history of the given match. Service Name - AsyncMatch Service Operation - ReadMatchHistory
      Parameters:
      ownerId - Match owner identifier
      matchId - Match identifier
      callback - Optional instance of IServerCallback to call when the server response is received.
    • findMatches

      public void findMatches​(IServerCallback callback)
      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

      public void findCompleteMatches​(IServerCallback callback)
      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

      public void abandonMatch​(String ownerId, String matchId, IServerCallback callback)
      Marks the given match as abandoned. Service Name - AsyncMatch Service Operation - Abandon
      Parameters:
      ownerId - Match owner identifier
      matchId - Match identifier
      callback - Optional instance of IServerCallback to call when the server response is received.
    • deleteMatch

      public void deleteMatch​(String ownerId, String matchId, IServerCallback callback)
      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 identifier
      matchId - Match identifier
      callback - 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 identifier
      matchId - Match identifier
      pushContent - 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 identifier
      matchId - Match identifier
      pushContent - 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.