CloudBuilder  2.8.4
Making social games is easy !
Public Member Functions | Static Public Member Functions | Friends | List of all members
CloudBuilder::CGameManager Class Reference

#include <CGameManager.h>

Public Member Functions

void Score (CResultHandler *aHandler, long long aHighScore, const char *aMode, const char *aScoreType, const char *aInfoScore, bool aForce, const char *aDomain="private")
 
DEPRECATED void Score (long long aHighScore, const char *aMode, const char *aScoreType, const char *aInfoScore, bool aMayVary, CResultHandler *aHandler)
 
void GetRank (CResultHandler *aHandler, long long aHighScore, const char *aMode, const char *aDomain="private")
 
DEPRECATED void GetRank (long long aHighScore, const char *aMode, CResultHandler *aHandler)
 
void BestHighScore (CResultHandler *aHandler, int aCount, int aPage, const char *aMode, const char *aDomain="private")
 
DEPRECATED void BestHighScore (int aCount, int aPage, const char *aMode, CResultHandler *aHandler)
 
void CenteredScore (CResultHandler *aHandler, int aCount, const char *aMode, const char *aDomain="private")
 
DEPRECATED void CenteredScore (int aCount, const char *aMode, CResultHandler *aHandler)
 
void UserBestScores (CResultHandler *aHandler, const char *aDomain="private")
 
void KeyValueRead (const CotCHelpers::CHJSON *aConfiguration, CResultHandler *aHandler)
 
void BinaryRead (const CotCHelpers::CHJSON *aConfiguration, CResultHandler *aHandler)
 
void Batch (CResultHandler *aHandler, const CotCHelpers::CHJSON *aConfiguration, const CotCHelpers::CHJSON *aParameters)
 

Static Public Member Functions

static CGameManagerInstance ()
 

Friends

class CClan
 
struct singleton_holder< CGameManager >
 

Detailed Description

The CGameManager class is helpful when you want to store global data for your application. These data will be accessible to all users who have installed and are using this application. It can be useful for introducing new levels, new assets, or anything that you wish to add to the application in future updates. It also provides helper methods to store and retrieve high scores.

Member Function Documentation

void CloudBuilder::CGameManager::Batch ( CResultHandler aHandler,
const CotCHelpers::CHJSON aConfiguration,
const CotCHelpers::CHJSON aParameters 
)

Method to insert or modify a single key represented by binary data

Parameters
aConfigurationJSON allowing for extensible configuration, that may contain:
  • domain: the domain on which the action is to be taken (if not passed, the private domain is used)
  • key: name of the key to retrieve
aPointeris the binary array you want to save.
aSizeis the size of the binary array, in bytes.
aHandlerresult handler whenever the call finishes (it might also be synchronous)
Returns
if noErr, the json passed to the handler may contain : { "url" : "<signed URL>", } void BinaryWrite(const CotCHelpers::CHJSON *aConfiguration, const void *aPointer, size_t aSize, CResultHandler *aHandler); For security raison this method has been removed, please use the Backoffice to do this Method to remove data pointed by a single key.
Parameters
aConfigurationJSON allowing for extensible configuration, that may contain:
  • domain: the domain on which the action is to be taken (if not passed, the private domain is used)
  • key: name of the key to delete
aHandlerresult handler whenever the call finishes (it might also be synchronous)
Returns
if noErr, the json passed to the handler may contain : { "done" : 1, } void BinaryDelete(const CHJSON *aConfiguration, CResultHandler *aHandler); For security raison this method has been removed, please use the Backoffice to do this Run a batch on the server side. Batch is edited on BackOffice server.
Parameters
aConfigurationJSON data describing the dat to pass to the batch
  • domain: the domain on which the action is to be taken (if not passed, the private domain is used)
  • name: the name identifying the batch
aParametersJSON data describing the data to pass to the batch
  • input: user defined data
aHandlerthe handler called with the result when the call completes
Returns
if noErr, the json passed to the handler will contain the result of the executed batch
void CloudBuilder::CGameManager::BestHighScore ( CResultHandler aHandler,
int  aCount,
int  aPage,
const char *  aMode,
const char *  aDomain = "private" 
)

Method used to retrieve the best High Scores for this application.

Parameters
aHandlerresult handler whenever the call finishes (it might also be synchronous)
aCountis the number of best scores you want to retrieve, default is 10
aPageis the number of the page to retrieve. the default is 1
aModeis a C string holding the game mode for which you want to retrieve the best High Scores.
aDomainis the domain in which the best scores have to be retrieved. "private" means it's local to this game only.
Returns
if noErr, the json passed to the handler may contain : { <aMode>: { "maxpage" : 10, "rankOfFirst" : 1, "page" : 1, "scores" : [] }
void CloudBuilder::CGameManager::BinaryRead ( const CotCHelpers::CHJSON aConfiguration,
CResultHandler aHandler 
)

Method to write a single key of the global JSON object stored for this user and domain.

Parameters
aConfigurationis a JSON configuration, that may contain
  • domain: the domain on which the action is to be taken (if not passed, the private domain is used)
  • key: name of the key to delete from the global JSON object. BEWARE: if you omit the key, ALL entries will be deleted!
aHandlerresult handler whenever the call finishes (it might also be synchronous)
Returns
if noErr and no binary key was passed in the configuration, the json passed to the handler may contain: { "done": 1 } void KeyValueWrite(const CotCHelpers::CHJSON *aConfiguration, CResultHandler *aHandler); For security raison this method has been removed, please use the Backoffice to do this Method to delete a single key of the global JSON object stored for this game and domain.
Parameters
aConfigurationis a JSON configuration, that may contain
  • domain: the domain on which the action is to be taken (if not passed, the private domain is used)
  • key: name of the key to delete from the global JSON object. BEWARE: if you omit the key, ALL entries will be deleted!
aHandlerresult handler whenever the call finishes (it might also be synchronous)
Returns
if noErr, the json passed to the handler may contain: { "done": 1 } void KeyValueDelete(const CotCHelpers::CHJSON *aConfiguration, CResultHandler *aHandler); For security raison this method has been removed, please use the Backoffice to do this Method to read a single key containing binary data stored for this domain.
Parameters
aConfigurationJSON allowing for extensible configuration, that may contain:
  • domain: the domain on which the action is to be taken (if not passed, the private domain is used)
  • key: name of the key to retrieve
aHandlerresult handler whenever the call finishes (it might also be synchronous)
Returns
if noErr, the json passed to the handler may contain : { "url" : "<signed URL>", } CCloudResult.HasBinary() must be true and you can acces to the data through :
void CloudBuilder::CGameManager::CenteredScore ( CResultHandler aHandler,
int  aCount,
const char *  aMode,
const char *  aDomain = "private" 
)

Method used to retrieve scores centered on the user score for this application.

Parameters
aHandlerresult handler whenever the call finishes (it might also be synchronous)
aCountis the number of best scores you want to retrieve, default is 10
aModeis a C string holding the game mode for which you want to retrieve the best High Scores.
aDomainis the domain in which the best scores have to be retrieved. "private" means it's local to this game only.
Returns
if noErr, the json passed to the handler may contain : { <aMode>: { "maxpage" : 10, "rankOfFirst" : 1, "page" : 1, "scores" : [] }
void CloudBuilder::CGameManager::GetRank ( CResultHandler aHandler,
long long  aHighScore,
const char *  aMode,
const char *  aDomain = "private" 
)

Method used to retrieve the rank of a High Score for this application.

Parameters
aHandlerresult handler whenever the call finishes (it might also be synchronous)
aHighScoreis the score whose rank you want to retrieve.
aModeis a C string holding the game mode for which you want to retrieve rank for this score.
aDomainis the domain in which the rank has to be retrieved. "private" means it's local to this game only.
Returns
if noErr, the json passed to the handler may contain : "rank" : 1
static CGameManager* CloudBuilder::CGameManager::Instance ( )
static

Use this method to obtain a reference to the CGameManager.

Returns
the one and only instance of this manager
void CloudBuilder::CGameManager::KeyValueRead ( const CotCHelpers::CHJSON aConfiguration,
CResultHandler aHandler 
)

Method to read a single key of the global JSON object stored for this game and domain.

Parameters
aConfigurationis a JSON configuration, that may contain
  • domain: the domain on which the action is to be taken (if not passed, the private domain is used)
  • key: name of the key to retrieve from the global JSON object (if not passed, all keys are returned)
aHandlerresult handler whenever the call finishes (it might also be synchronous)
Returns
if noErr and no binary key was passed in the configuration, the json passed to the handler may contain: { "<key1>" : "value1", "<key2>" : "value2", }
void CloudBuilder::CGameManager::Score ( CResultHandler aHandler,
long long  aHighScore,
const char *  aMode,
const char *  aScoreType,
const char *  aInfoScore,
bool  aForce,
const char *  aDomain = "private" 
)

Method used to post a High Score for this application.

Parameters
aHandlerresult handler whenever the call finishes (it might also be synchronous)
aHighScoreis the score you want to post.
aModeis a C string holding the game mode for which this score should be considered.
aScoreTypestring with "hightolow" or "lowtohigh"
aInfoScoreis an optional string wich describe the score
aForceis an optional boolean used in case we authorize the new high score to be inferior to the previous one.
aDomainis the domain in which the score has to be pushed. "private" means it's local to this game only.
Returns
if noErr, the json passed to the handler may contain:
"done" : 1,
"rank" : 123
done means that the score has been recorded as the highest, while rank is the effective rank of the player (returned even if the player has not actually been classed, that is if done is 0).
void CloudBuilder::CGameManager::UserBestScores ( CResultHandler aHandler,
const char *  aDomain = "private" 
)

Method used to retrieve the best Scores of the logged user.

Parameters
aHandlerresult handler whenever the call finishes (it might also be synchronous)
aDomainis the domain in which the best scores have to be retrieved. "private" means it's local to this game only.
Returns
if noErr, the json passed to the handler may contain list of : <modes>: { "timestamp": "2014-09-12T15:30:56.938Z", "score": 100, "info": "some text", "order": "lowtohigh", "rank": 3 }

The documentation for this class was generated from the following file: