Jump to: navigation, search

Social System API

Setting Listener

Social system has callback info. and needs to set listener and override listening method.

class PluginChannel:public cocos::plugin::SocialListener
{
public:
	virtual void onSocialResult(SocialRetCode code, const char* msg);
}
Developers need to override onActionResult method
 if(AgentManager::getInstance()->getSocialPlugin())
    {
    	AgentManager::getInstance()->getSocialPlugin()->setListener(this);
    }

Related APIs

Callback Messages

Callback Messages code msg
Submitting succeeds kScoreSubmitSucceed null or simple description of error
Submitting fails kScoreSubmitfail null or simple description of error
Unlocking achievement succeeds kAchUnlockSucceed null or simple description of error
Unlocking achievement fails kAchUnlockFail null or simple description of error

Submitting Score

API: void submitScore(const char* leadboardID, long score) ; score can be submitted through this API;leadboardID stands for ID of ranking list and score stands for the value of score.

Acquiring Ranking List

API: void showLeaderboard(const char* leaderboardID); acquires ranking list; leadboardID stands for ID of ranking list

Unlocking Achievement List

API: void unlockAchievement(TAchievementInfo achInfo); Achievement List can be unlocked through this API; achInfo stands for related information, TAchievementInfo stands for the type of std::map<std::string, std::string>.

Displaying Achievement List

API: void showAchievements(); score can be set through this API