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

#include <CClan.h>

Public Member Functions

virtual ~CClan ()
 
bool isSetup ()
 
bool isUserLogged ()
 
void Setup (const CHJSON *aConfiguration, CResultHandler *handler)
 
void Suspend ()
 
void Resume ()
 
void Terminate ()
 
void Ping (CResultHandler *handler)
 
void HandleURL (const CHJSON *aOptions, CResultHandler *handler)
 
void ProcessIdleTasks ()
 

Static Public Member Functions

static CClanInstance ()
 

Detailed Description

The CloudBuilder::CClan class is the most important class. This is your primary entry point in the CloudBuilder SDK. All the setup is done in this class.

Constructor & Destructor Documentation

virtual CloudBuilder::CClan::~CClan ( )
virtual

Destructor

Member Function Documentation

void CloudBuilder::CClan::HandleURL ( const CHJSON aOptions,
CResultHandler handler 
)

Method to handle launch app with url: used to connect with facebook and google Also used , in case the url match with "://cotc/", for sponsorship and anonymous login on a new device.

Parameters
aOptionsis a json containing field "url" with the url. On iOS, for GooglePlus, a field "source" must contains sourceApplication as defined in the method:
  • (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
handlerresult handler whenever the call finishes (it might also be synchronous)
static CClan* CloudBuilder::CClan::Instance ( )
static

Function which returns the only instance of this class.

Returns
is the only instance of the CClan class.
bool CloudBuilder::CClan::isSetup ( )

Method to be called in order to know if the CloudBuilder SDK has been correctly setup or not.

Returns
is a boolean. True if setup is correct, false otherwise.
bool CloudBuilder::CClan::isUserLogged ( )

Method to be called in order to know if the user is logged in or not.

Returns
is a boolean. True if user is logged in, false otherwise.
void CloudBuilder::CClan::Ping ( CResultHandler handler)

Method to ping the server For now it returns the server time in utc key.

void CloudBuilder::CClan::ProcessIdleTasks ( )

Call this in your main loop when you are in an idle state. Allows to process some events and callbacks pending and run them in your main thread.

void CloudBuilder::CClan::Resume ( )

Method you must call when your application is going to the foreground, so we can ensure data integrity when the application is getting the focus again.

void CloudBuilder::CClan::Setup ( const CHJSON aConfiguration,
CResultHandler handler 
)

This method is the first to call just after the constructor. This will prepare everything so you can make requests later. It is identical to the previous one except that instead of several parameters, all the necessary data are contained in a JSON object.

Parameters
aConfigurationis a JSON object holding the necessary connection details. The mandatory keys are:
  • "key": string containing the community key.
  • "secret": string containing the community secret.
  • "env": string containing the environment.
  • "appVersion": string containing the application version.

The optional keys are:

  • "gamecenter": boolean to control if the application can create profiles linked to GameCenter ID.
  • "facebook": boolean to control if the application can create profiles linked to Facebook.
  • "googleplus": boolean to control if the application can create profiles linked to GooglePlus.
  • "appFolder": used with the default CFileSystemHandler to set the folder in which the data will be saved. On Windows, it would be USERPROFILE%<appFolder>.
  • "autoresume" : boolean to control if after a Setup the system has to proceed an automatic resumesession when possible.
  • "autoRegisterForNotification": by default, RegisterForNotification is called right after login. By setting this key to 'false', you can manage when you want to register for notifications by calling the CUserManager::RegisterForNotification at your convenience.
  • "connectTimeout": sets a custom timeout allowed when connecting to the servers. Defaults to 5.
  • "httpTimeout": sets a custom timeout for all requests. Defaults to no limit.
  • "eventLoopTimeout": sets a custom timeout for the long polling event loop. Should be used with care and set to a high value (at least 60). Defaults to 590.
  • "httpVerbose": set to true to output detailed information about the requests performed to CotC servers. Can be used for debugging, though it will pollute the logs very much.
  • "forceFacebookSdk": on iOS, uses the facebook SDK instead of the native iOS. This means that the facebook app will be used for log in / publish instead of the system.
    Parameters
    handlerresult handler whenever the call finishes (it might also be synchronous)
    Returns
    if noErr, the json passed to the handler may contain : { "_error" : 0}
void CloudBuilder::CClan::Suspend ( )

Method you must call when your application is going to the background, so we can ensure data integrity when the application is not active.

void CloudBuilder::CClan::Terminate ( )

Method to call before quitting the application, so the CloudBuilder can leave in a clean state. Warning: invalidates all pointers to objects returned by CloudBuilder as memory is freed, including those returned by Instance().


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