本文整理汇总了C++中AppDelegate::SaveUserScoreDiff方法的典型用法代码示例。如果您正苦于以下问题:C++ AppDelegate::SaveUserScoreDiff方法的具体用法?C++ AppDelegate::SaveUserScoreDiff怎么用?C++ AppDelegate::SaveUserScoreDiff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppDelegate
的用法示例。
在下文中一共展示了AppDelegate::SaveUserScoreDiff方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onSyncCompleted
void GameWin::onSyncCompleted(HttpClient *sender, HttpResponse *response){
if (!response)
{
updateLocalFlow();
return;
}
// You can get original request type from: response->request->reqType
if (0 != strlen(response->getHttpRequest()->getTag()))
{
log("%s completed", response->getHttpRequest()->getTag());
}
int statusCode = response->getResponseCode();
char statusString[64] = {};
sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag());
// _labelStatusCode->setString(statusString);
log("response code: %d", statusCode);
if (!response->isSucceed())
{
log("response failed");
log("error buffer: %s", response->getErrorBuffer());
updateLocalFlow();
return;
}
if (statusCode != 200){
log("response code failed");
log("error buffer: %s", response->getErrorBuffer());
updateLocalFlow();
return;
}
clearLocalFlow();
// dump data
AppDelegate *app = (AppDelegate*)Application::getInstance();
std::vector<char> *buffer = response->getResponseData();
string sXml(buffer->begin(), buffer->end());
pugi::xml_document doc;
pugi::char_t cXml[1024];
strcpy(cXml, sXml.c_str());
pugi::xml_parse_result result = doc.load_string(cXml);
pugi::xml_node nodes = doc.child("mobileAppSyncPoint");
std::string strResult = nodes.child_value("result");
char p[100];
strcpy(p, strResult.c_str());
int iScore = atoi(p);
if (iScore==0)
{
//get TotalPoints
strResult = nodes.child_value("TotalPoints");
app->SaveUserScoreDiff(atoi(strResult.c_str()));
//get TotalTools
strResult = nodes.child_value("TotalTools");
app->SaveUserToolsDiff(atoi(strResult.c_str()));
}
}