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); } } } } }
JNIEXPORT void JNICALL Java_org_cocos2dx_plugin_InterfaceAds_nativeOnPlayerGetPoints(JNIEnv* env, jobject thiz, jobject obj, jint points) { PluginProtocol* pPlugin = PluginUtils::getPluginPtr(obj); LOGD("nativeOnPlayerGetPoints(), Get plugin ptr : %p", pPlugin); if (pPlugin != NULL) { LOGD("nativeOnPlayerGetPoints(), Get plugin name : %s", pPlugin->getPluginName()); ProtocolAds* pAds = dynamic_cast<ProtocolAds*>(pPlugin); if (pAds != NULL) { pAds->onPlayerGetPoints(points); } } }
JNIEXPORT void JNICALL Java_org_cocos2dx_plugin_InterfaceAds_nativeOnAdsResult(JNIEnv* env, jobject thiz, jobject obj, jint ret, jstring msg) { std::string strMsg = PluginJniHelper::jstring2string(msg); PluginProtocol* pPlugin = PluginUtils::getPluginPtr(obj); LOGD("nativeOnAdsResult(), Get plugin ptr : %p", pPlugin); if (pPlugin != NULL) { LOGD("nativeOnAdsResult(), Get plugin name : %s", pPlugin->getPluginName()); ProtocolAds* pAds = dynamic_cast<ProtocolAds*>(pPlugin); if (pAds != NULL) { pAds->onAdsResult((AdsResultCode) ret, strMsg.c_str()); } } }
JNIEXPORT void JNICALL Java_org_cocos2dx_plugin_AdsWrapper_nativeOnPlayerGetPoints(JNIEnv* env, jobject thiz, jstring className, jint points) { std::string strClassName = PluginJniHelper::jstring2string(className); PluginProtocol* pPlugin = PluginUtils::getPluginPtr(strClassName); PluginUtils::outputLog("ProtocolAds", "nativeOnPlayerGetPoints(), Get plugin ptr : %p", pPlugin); if (pPlugin != NULL) { PluginUtils::outputLog("ProtocolAds", "nativeOnPlayerGetPoints(), Get plugin name : %s", pPlugin->getPluginName()); ProtocolAds* pAds = dynamic_cast<ProtocolAds*>(pPlugin); if (pAds != NULL) { pAds->onPlayerGetPoints(points); } } }
JNIEXPORT void JNICALL Java_org_cocos2dx_plugin_AdsAdColonyWrapper_nativeOnPlayerGetPoints(JNIEnv* env, jobject thiz, jstring className, jstring zoneID, jboolean success, jstring name, jint points) { std::string strClassName = PluginJniHelper::jstring2string(className); std::string strZoneIds = PluginJniHelper::jstring2string(zoneID); std::string strName = PluginJniHelper::jstring2string(name); PluginProtocol* pPlugin = PluginUtils::getPluginPtr(strClassName); PluginUtils::outputLog("ProtocolAds", "nativeOnPlayerGetPoints(), Get plugin ptr : %p", pPlugin); if (pPlugin != NULL) { PluginUtils::outputLog("ProtocolAds", "nativeOnPlayerGetPoints(), Get plugin name : %s", pPlugin->getPluginName()); ProtocolAds* pAds = dynamic_cast<ProtocolAds*>(pPlugin); if (pAds != NULL) { AdColonyAdsIntenelListener* listener = (AdColonyAdsIntenelListener*)pAds->getAdsListener(); if (listener) { listener->onPlayerGetPoints(pAds, strZoneIds.c_str(), success, strName.c_str(), points); } } } }