void U8SDKNativeCallback::OnU8InitSuc(cocos2d::Node *sender, cocos2d::Value data) { if (data.isNull() || data.getType() != cocos2d::Value::Type::MAP) { CCLOG("OnU8InitSuc Data Type Error:: curr data type is not map."); return; } cocos2d::ValueMap json = data.asValueMap(); bool exit = json["isSupportExit"].asBool(); bool accountCenter = json["isSupportAccountCenter"].asBool(); bool logout = json["isSupportLogout"].asBool(); U8SDKInterface::getInstance()->setSupports(exit, accountCenter, logout); if (this->gameCallback != nullptr) { this->gameCallback->OnInitSuc(); } }
void U8SDKNativeCallback::OnU8LoginSuc(cocos2d::Node *sender, cocos2d::Value data) { if (data.isNull() || data.getType() != cocos2d::Value::Type::MAP) { CCLOG("OnU8LoginSuc Data Type Error:: curr data type is not map."); return; } U8LoginResult* result = U8LoginResult::create(); cocos2d::ValueMap json = data.asValueMap(); result->isSuc = json["isSuc"].asBool(); result->isSwitchAccount = json["isSwitchAccount"].asBool(); result->userId = json["userID"].asString(); result->sdkUserId = json["sdkUserID"].asString(); result->username = json["username"].asString(); result->sdkUsername = json["sdkUsername"].asString(); result->token = json["token"].asString(); if (this->gameCallback != nullptr) { this->gameCallback->OnLoginSuc(result); } }