![]() |
CloudBuilder C++ SDK
v3.0.0
Making social games is easy !
|
#include <CMatchManager.h>
Public Member Functions | |
void | Terminate () |
void | HLCreateMatch (CMatchResultHandler *aHandler, const CHJSON *aConfiguration) |
void | HLJoinMatch (CMatchResultHandler *aHandler, const CHJSON *aConfiguration) |
void | HLRestoreMatch (CMatchResultHandler *aHandler, const CHJSON *aConfiguration) |
void | HLDestroyMatch (CMatch *aMatch) |
void | CreateMatch (const CHJSON *aConfiguration, CResultHandler *aHandler) |
void | ListMatches (const CHJSON *aConfiguration, CResultHandler *aHandler) |
void | FetchMatch (const CHJSON *aConfiguration, CResultHandler *aHandler) |
void | JoinMatch (const CHJSON *aConfiguration, CResultHandler *aHandler) |
void | InvitePlayer (const CHJSON *aConfiguration, CResultHandler *aHandler) |
void | DismissInvitation (const CHJSON *aConfiguration, CResultHandler *aHandler) |
void | PostMove (const CHJSON *aConfiguration, CResultHandler *aHandler) |
void | DrawFromShoe (const CHJSON *aConfiguration, CResultHandler *aHandler) |
void | LeaveMatch (const CHJSON *aConfiguration, CResultHandler *aHandler) |
void | FinishMatch (const CHJSON *aConfiguration, CResultHandler *aHandler) |
void | DeleteMatch (const CHJSON *aConfiguration, CResultHandler *aHandler) |
DEPRECATED void | DeleteMatch (CResultHandler *aHandler, const CHJSON *aConfiguration) |
DEPRECATED void | FinishMatch (CResultHandler *aHandler, const CHJSON *aConfiguration) |
DEPRECATED void | LeaveMatch (CResultHandler *aHandler, const CHJSON *aConfiguration) |
DEPRECATED void | DrawFromShoe (CResultHandler *aHandler, const CHJSON *aConfiguration) |
DEPRECATED void | PostMove (CResultHandler *aHandler, const CHJSON *aConfiguration) |
DEPRECATED void | DismissInvitation (CResultHandler *aHandler, const CHJSON *aConfiguration) |
DEPRECATED void | InvitePlayer (CResultHandler *aHandler, const CHJSON *aConfiguration) |
DEPRECATED void | JoinMatch (CResultHandler *aHandler, const CHJSON *aConfiguration) |
DEPRECATED void | FetchMatch (CResultHandler *aHandler, const CHJSON *aConfiguration) |
DEPRECATED void | ListMatches (CResultHandler *aHandler, const CHJSON *aConfiguration) |
DEPRECATED void | CreateMatch (CResultHandler *aHandler, const CHJSON *aConfiguration) |
Static Public Member Functions | |
static CMatchManager * | Instance () |
Friends | |
struct | singleton_holder< CMatchManager > |
The CMatchManager class is used to manage matches in a raw way. It also provides a higher level class which can be used to easily run a match at an higher level. Some methods accept a parameter named osn
. This parameter can be used to forward a push notification to the users who are not active at the moment. It is typically a JSON with made of attributes which represent language -> message pairs. Here is an example: {"en": "Help me!", "fr": "Aidez moi!"}.
void CloudBuilder::CMatchManager::CreateMatch | ( | const CHJSON * | aConfiguration, |
CResultHandler * | aHandler | ||
) |
Creates a match, available for joining by others players.
aConfiguration | is a JSON object holding the parameters of the match to create. It may contain the following:
|
aHandler | result handler whenever the call finishes (it might also be synchronous) |
void CloudBuilder::CMatchManager::DeleteMatch | ( | const CHJSON * | aConfiguration, |
CResultHandler * | aHandler | ||
) |
Deletes a match. Only works if you are the one who created it and it is already finished.
aConfiguration | is a JSON object. The mandatory keys are:
|
aHandler | result handler whenever the call finishes (it might also be synchronous) |
void CloudBuilder::CMatchManager::DismissInvitation | ( | const CHJSON * | aConfiguration, |
CResultHandler * | aHandler | ||
) |
Dismisses a pending invitation on a given match. Fails if the currently logged in player was not invited.
aConfiguration | is a JSON object. Must contain:
|
aHandler | result handler whenever the call finishes (it might also be synchronous) |
void CloudBuilder::CMatchManager::DrawFromShoe | ( | const CHJSON * | aConfiguration, |
CResultHandler * | aHandler | ||
) |
Draws one or more randomized items from the shoe (see CreateMatch).
aConfiguration | is a JSON object. The following attributes are mandatory:
|
aHandler | result handler whenever the call finishes (it might also be synchronous) |
lastEventId
for next requests. void CloudBuilder::CMatchManager::FetchMatch | ( | const CHJSON * | aConfiguration, |
CResultHandler * | aHandler | ||
) |
Fetches the latest info about a match.
aConfiguration | is a JSON object. The mandatory keys are:
|
aHandler | result handler whenever the call finishes (it might also be synchronous) |
void CloudBuilder::CMatchManager::FinishMatch | ( | const CHJSON * | aConfiguration, |
CResultHandler * | aHandler | ||
) |
Finishes a match. Only works if you are the one who created it in the first place. Other players will be notified in the form of an event of type 'match.finish'.
aConfiguration | is a JSON object. The mandatory keys are:
|
aHandler | result handler whenever the call finishes (it might also be synchronous) |
delete
attribute was passed. void CloudBuilder::CMatchManager::HLCreateMatch | ( | CMatchResultHandler * | aHandler, |
const CHJSON * | aConfiguration | ||
) |
High level method which creates a match and passes it to the result handler in the form of a CMatch. Memory management of #CMatch objects is described on the class itself.
aHandler | match result handler, to be called when the operation is completed |
aConfiguration | configuration of the match, as described in CMatchManager::CreateMatch |
void CloudBuilder::CMatchManager::HLDestroyMatch | ( | CMatch * | aMatch | ) |
Destroys a match object (not actually deleting the match or anything, just freeing the resource associated with the match).
aMatch | match object to be dismissed |
void CloudBuilder::CMatchManager::HLJoinMatch | ( | CMatchResultHandler * | aHandler, |
const CHJSON * | aConfiguration | ||
) |
High level method to join a match, resulting in a CMatch object allowing for easy manipulation on the match.
aHandler | match result handler, to be called when the operation is completed |
aConfiguration | is a JSON object. The mandatory keys are:
|
void CloudBuilder::CMatchManager::HLRestoreMatch | ( | CMatchResultHandler * | aHandler, |
const CHJSON * | aConfiguration | ||
) |
High level method to fetch a CMatch object corresponding to a match which the player already belongs to. It basically allows to continue the game in the same state as when the match has initially been created or joined to, all in a transparent manner.
aHandler | match result handler, to be called when the operation is completed |
aConfiguration | is a JSON object. It may contain the following keys:
|
void CloudBuilder::CMatchManager::InvitePlayer | ( | const CHJSON * | aConfiguration, |
CResultHandler * | aHandler | ||
) |
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 for private matches as described in the chapter Working with matches.
aConfiguration | is a JSON object. The manadatory keys are:
|
aHandler | result handler whenever the call finishes (it might also be synchronous) |
void CloudBuilder::CMatchManager::JoinMatch | ( | const CHJSON * | aConfiguration, |
CResultHandler * | aHandler | ||
) |
Joins a match. Other players will be notified in the form of an event of type 'match.join'.
aConfiguration | is a JSON object. The mandatory keys are:
|
aHandler | result handler whenever the call finishes (it might also be synchronous) |
lastEventId
contained. void CloudBuilder::CMatchManager::LeaveMatch | ( | const CHJSON * | aConfiguration, |
CResultHandler * | aHandler | ||
) |
Leaves a match. Only works if you have joined it prior to calling this. Other players will be notified in the form of an event of type 'match.leave'.
aConfiguration | is a JSON object. The mandatory keys are:
|
aHandler | result handler whenever the call finishes (it might also be synchronous) |
void CloudBuilder::CMatchManager::ListMatches | ( | const CHJSON * | aConfiguration, |
CResultHandler * | aHandler | ||
) |
Lists the matches available to join.
aConfiguration | is a JSON object allowing to filter the matches to be returned. You may pass any of these:
|
aHandler | result handler whenever the call finishes (it might also be synchronous) |
void CloudBuilder::CMatchManager::PostMove | ( | const CHJSON * | aConfiguration, |
CResultHandler * | aHandler | ||
) |
Posts a move in the match, notifying other players in the form of an event of type 'match.move'.
aConfiguration | is a JSON object. It may contain the following:
|
aHandler | result handler whenever the call finishes (it might also be synchronous) |
lastEventId
contained.