コード例 #1
0
ファイル: ProtocolAds.cpp プロジェクト: nickflink/plugin-x
	JNIEXPORT void JNICALL Java_org_cocos2dx_plugin_AdsWrapper_nativeOnAdsResult(JNIEnv*  env, jobject thiz, jstring className, jint ret, jstring msg) {
		std::string strMsg = PluginJniHelper::jstring2string(msg);
		std::string strClassName = PluginJniHelper::jstring2string(className);
		PluginProtocol* pPlugin = PluginUtils::getPluginPtr(strClassName);
		PluginUtils::outputLog("ProtocolAds", "nativeOnAdsResult(), Get plugin ptr : %p", pPlugin);
		if (pPlugin != NULL)
		{
			PluginUtils::outputLog("ProtocolAds", "nativeOnAdsResult(), Get plugin name : %s", pPlugin->getPluginName());
			ProtocolAds* pAds = dynamic_cast<ProtocolAds*>(pPlugin);
			if (pAds != NULL)
			{
			    AdsListener* listener = pAds->getAdsListener();
			    if (listener)
				{
			        listener->onAdsResult((AdsResultCode) ret, strMsg.c_str());
				}
			    else
			    {
			    	ProtocolAds::ProtocolAdsCallback callback = pAds->getCallback();
			    	if(callback)
			    	{
			    		callback(ret, strMsg);
			    	}
			    }
			}
		}
	}
コード例 #2
0
ファイル: AdsObject.cpp プロジェクト: trarck/opensdk
void AdsObject::popActionResult()
{
    for(std::vector<AdsActionResult>::iterator iter=_actionResultList.begin();iter!=_actionResultList.end();){
        
        AdsObject* pAds = dynamic_cast<AdsObject*>(PluginUtils::getPluginPtr(iter->pluginKey));
        if(pAds){
            AdsListener* listener = pAds->getAdsListener();
            if(listener){
                listener->onAdsResult(iter->resultCode, iter->msg.c_str());
                
                //remove from record
                iter=_actionResultList.erase(iter);
                
                continue;
            }
        }
        
        ++iter;
    }
}