当前位置: 首页>>代码示例>>C++>>正文


C++ PluginProtocol类代码示例

本文整理汇总了C++中PluginProtocol的典型用法代码示例。如果您正苦于以下问题:C++ PluginProtocol类的具体用法?C++ PluginProtocol怎么用?C++ PluginProtocol使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PluginProtocol类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Java_org_cocos2dx_plugin_InterfaceAds_nativeOnPlayerGetPoints

	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);
			}
		}
	}
开发者ID:SpycWolf,项目名称:cocos2d-x-1,代码行数:13,代码来源:ProtocolAds.cpp

示例2: Java_org_cocos2dx_plugin_InterfaceAds_nativeOnAdsResult

	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());
			}
		}
	}
开发者ID:SpycWolf,项目名称:cocos2d-x-1,代码行数:14,代码来源:ProtocolAds.cpp

示例3:

JNIEXPORT void JNICALL Java_org_cocos2dx_plugin_IAPWrapper_nativeOnRequestProductsResult
        (JNIEnv* env, jobject thiz, jstring className, jint ret, jobjectArray stringArray)
{
    std::string strClassName = PluginJniHelper::jstring2string(className);
    PluginProtocol* pPlugin = PluginUtils::getPluginPtr(strClassName);
    PluginUtils::outputLog("ProtocolIAP", "onRequestProductsResult(), Get plugin ptr : %p", pPlugin);

    if (pPlugin != NULL)
    {
        PluginUtils::outputLog("ProtocolIAP", "onRequestProductsResult(), Get plugin name : %s", pPlugin->getPluginName());
        ProtocolIAP* pIAP = dynamic_cast<ProtocolIAP*>(pPlugin);

        if (pIAP != NULL)
        {
            TProductList tplist;

            if(stringArray != NULL)
            {
                int stringCount = env->GetArrayLength(stringArray);

                for (int i=0; i<stringCount; i++)
                {
                    jstring string = (jstring) env->GetObjectArrayElement(stringArray, i);
                    auto map = PluginJniHelper::jsonString2Map(string);

                    tplist.push_back(*map);
                    env->DeleteLocalRef(string);
                }
            }

            pIAP->onRequestProductsResult((IAPProductRequest)ret, tplist);
        }
    }
}
开发者ID:colaholicu,项目名称:custom-cocos2dx,代码行数:34,代码来源:ProtocolIAP.cpp

示例4: Java_org_cocos2dx_plugin_ShareWrapper_nativeOnShareResult

    JNIEXPORT void JNICALL Java_org_cocos2dx_plugin_ShareWrapper_nativeOnShareResult(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("ProtocolShare", "nativeOnShareResult(), Get plugin ptr : %p", pPlugin);
        if (pPlugin != NULL)
        {
            PluginUtils::outputLog("ProtocolShare", "nativeOnShareResult(), Get plugin name : %s", pPlugin->getPluginName());
            ProtocolShare* pShare = dynamic_cast<ProtocolShare*>(pPlugin);
            if (pShare != NULL)
            {
                ShareResultListener* listener = pShare->getResultListener();
                ProtocolShare::ProtocolShareCallback callback = pShare->getListener();
                if (NULL != listener)
                {
                    ShareResultCode cRet = (ShareResultCode) ret;
                    listener->onShareResult(cRet, strMsg.c_str());
                }else if(callback){
                    callback(ret, strMsg);
                }else
                {
                    PluginUtils::outputLog("ProtocolShare", "Can't find the listener of plugin %s", pPlugin->getPluginName());
                }
            }

        }
    }
开发者ID:cocoTM,项目名称:xumc_demos,代码行数:28,代码来源:ProtocolShare.cpp

示例5: Java_org_cocos2dx_plugin_AdsWrapper_nativeOnAdsResult

	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);
			    	}
			    }
			}
		}
	}
开发者ID:nickflink,项目名称:plugin-x,代码行数:27,代码来源:ProtocolAds.cpp

示例6: Java_com_opensdk_framework_NativeInvoker_nativeGetLoginInfo

 JNIEXPORT jobject JNICALL Java_com_opensdk_framework_NativeInvoker_nativeGetLoginInfo(JNIEnv*  env, jobject thiz, jstring pluginKey)
 {
     std::string strPluginKey = PluginJniHelper::jstring2string(pluginKey);
     PluginProtocol* pPlugin = PluginUtils::getPluginPtr(strPluginKey);
     PluginUtils::outputLog("ProtocolUser", "nativeOnActionResult(), Get plugin ptr : %p", pPlugin);
     UserObject* userObject = dynamic_cast<UserObject*>(pPlugin);
     jobject loginInfo;
     if (userObject != NULL)
     {
         loginInfo=PluginUtils::createJavaMapObject(userObject->getLoginInfo());
     }else{           
         PluginUtils::outputLog("ProtocolUser", "plugin %s is null", pPlugin->getPluginName());
         loginInfo=PluginUtils::createJavaMapObject(NULL);
     }
     
     return loginInfo;
 }
开发者ID:trarck,项目名称:opensdk,代码行数:17,代码来源:Java_com_opensdk_framework_User.cpp

示例7: tolua_anysdk_PluginProtocol_callFuncWithParam

static int tolua_anysdk_PluginProtocol_callFuncWithParam(lua_State* tolua_S)
{
    if (NULL == tolua_S)
        return 0;

    int argc = 0;
    PluginProtocol* self = nullptr;

#if COCOS2D_DEBUG >= 1
    tolua_Error tolua_err;
    if (!tolua_isusertype(tolua_S,1,"ccanysdk.PluginProtocol",0,&tolua_err)) goto tolua_lerror;
#endif

    self = static_cast<PluginProtocol*>(tolua_tousertype(tolua_S,1,0));

#if COCOS2D_DEBUG >= 1
    if (nullptr == self) {
        tolua_error(tolua_S,"invalid 'self' in function 'tolua_anysdk_PluginProtocol_callFuncWithParam'\n", NULL);
        return 0;
    }
#endif

    argc = lua_gettop(tolua_S) - 1;

    if (argc < 7)
    {
        const char* funName = lua_tostring(tolua_S, 2);

        std::vector<PluginParam*> vecParam;
        luavals_to_stdvector(tolua_S, argc + 1, &vecParam);
        self->callFuncWithParam(funName, vecParam);
        releaseVecContent(&vecParam);

        return 0;
    }

    CCLOG("'callFuncWithParam' function of PluginProtocol has wrong number of arguments: %d, max %d\n", argc, 5);
    return 0;

#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'callFuncWithParam'.",&tolua_err);
    return 0;
#endif
}
开发者ID:zhangf911,项目名称:v3quick-classic,代码行数:45,代码来源:lua_anysdk_manual.cpp

示例8: Java_com_opensdk_framework_NativeInvoker_nativeOnActionResult

    JNIEXPORT void JNICALL Java_com_opensdk_framework_NativeInvoker_nativeOnActionResult(JNIEnv*  env, jobject thiz, jstring pluginKey, jint ret, jstring msg)
    {
        std::string strMsg = PluginJniHelper::jstring2string(msg);
        std::string strPluginKey = PluginJniHelper::jstring2string(pluginKey);
        PluginProtocol* pPlugin = PluginUtils::getPluginPtr(strPluginKey);
        PluginUtils::outputLog("ProtocolUser", "nativeOnActionResult(), Get plugin ptr : %p", pPlugin);
        UserObject* userObject = dynamic_cast<UserObject*>(pPlugin);
        if (userObject != NULL)
        {
            PluginUtils::outputLog("ProtocolUser", "nativeOnActionResult(), Get plugin name : %s", pPlugin->getPluginName());

            UserActionListener* listener = userObject->getActionListener();
            if (NULL != listener)
            {
                listener->onActionResult(userObject, (UserActionResultCode) ret, strMsg.c_str());
            }
            else
            {
                UserActionResult result={
                    (UserActionResultCode)ret,
                    strMsg,
                    strPluginKey
                };
                
                UserObject::pushActionResult(result);
                
                PluginUtils::outputLog("ProtocolUser","Listener of plugin %s not set correctly", pPlugin->getPluginName());
            }

        }else{
            
            UserActionResult result={
                (UserActionResultCode)ret,
                strMsg,
                strPluginKey
            };
            
            UserObject::pushActionResult(result);
            
            PluginUtils::outputLog("ProtocolUser", "plugin %s is null", pPlugin->getPluginName());
        }
    }
开发者ID:trarck,项目名称:opensdk,代码行数:42,代码来源:Java_com_opensdk_framework_User.cpp

示例9: Java_com_opensdk_framework_NativeInvoker_nativeOnSocialResult

    JNIEXPORT void JNICALL Java_com_opensdk_framework_NativeInvoker_nativeOnSocialResult(JNIEnv*  env, jobject thiz, jstring pluginKey, jint ret, jstring msg)
    {
        std::string strMsg = PluginJniHelper::jstring2string(msg);
        std::string strPluginKey = PluginJniHelper::jstring2string(pluginKey);
        PluginProtocol* pPlugin = PluginUtils::getPluginPtr(strPluginKey);
        PluginUtils::outputLog("ProtocolSocial", "nativeOnSocialResult(), Get plugin ptr : %p", pPlugin);
        SocialObject* socialObject = dynamic_cast<SocialObject*>(pPlugin);
        if (socialObject != NULL)
        {
            PluginUtils::outputLog("ProtocolSocial", "nativeOnSocialResult(), Get plugin name : %s", pPlugin->getPluginName());            
    
            SocialListener* pListener = socialObject->getListener();
            if (NULL != pListener)
            {
                pListener->onSocialResult((SocialRetCode) ret, strMsg.c_str());
            }
            else
            {
                SocialActionResult result={
                    (SocialRetCode)ret,
                    strMsg,
                    strPluginKey
                };
                
                SocialObject::pushActionResult(result);
                PluginUtils::outputLog("ProtocolSocial", "Can't find the nativeOnSocialResult listener of plugin %s", pPlugin->getPluginName());
            }

        }else{
            
            SocialActionResult result={
                (SocialRetCode)ret,
                strMsg,
                strPluginKey
            };
            
            SocialObject::pushActionResult(result);
            
            PluginUtils::outputLog("ProtocolSocial", "plugin %s is null", pPlugin->getPluginName());
        }
    }
开发者ID:trarck,项目名称:opensdk,代码行数:41,代码来源:Java_com_opensdk_framework_Social.cpp

示例10: Java_org_cocos2dx_plugin_AdsWrapper_nativeOnPlayerGetPoints

	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);
			}
		}
	}
开发者ID:bassarisse,项目名称:LostInCaves,代码行数:14,代码来源:ProtocolAds.cpp

示例11: Java_org_cocos2dx_plugin_IAPWrapper_nativeOnPayResult

JNIEXPORT void JNICALL Java_org_cocos2dx_plugin_IAPWrapper_nativeOnPayResult(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("ProtocolIAP", "nativeOnPayResult(), Get plugin ptr : %p", pPlugin);
    if (pPlugin != NULL)
    {
        PluginUtils::outputLog("ProtocolIAP", "nativeOnPayResult(), Get plugin name : %s", pPlugin->getPluginName());
        ProtocolIAP* pIAP = dynamic_cast<ProtocolIAP*>(pPlugin);
        if (pIAP != NULL)
        {
            pIAP->onPayResult((PayResultCode) ret, strMsg.c_str());
        }
        else
        {
            ProtocolIAP::ProtocolIAPCallback callback = pIAP->getCallback();
            if(callback)
                callback(ret, strMsg);
        }
    }
}
开发者ID:colaholicu,项目名称:custom-cocos2dx,代码行数:22,代码来源:ProtocolIAP.cpp

示例12: Java_org_cocos2dx_plugin_AdsAdColonyWrapper_nativeOnPlayerGetPoints

	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);
                }
			}
		}

	}
开发者ID:ken4500,项目名称:zoo,代码行数:22,代码来源:JniProtocolAdColonyAds.cpp

示例13: createPlugin

/** create the plugin by name */
PluginProtocol* PluginFactory::createPlugin(const char* name)
{
    PluginProtocol* pRet = NULL;
    do
    {
        if (name == NULL || strlen(name) == 0) break;

        std::string jClassName = ANDROID_PLUGIN_PACKAGE_PREFIX;
        jClassName.append(name);
        PluginUtils::outputLog("PluginFactory", "Java class name of plugin %s is : %s", name, jClassName.c_str());

        PluginJniMethodInfo t;
        if (! PluginJniHelper::getStaticMethodInfo(t
                , "org/cocos2dx/plugin/PluginWrapper"
                , "initPlugin"
                , "(Ljava/lang/String;)Ljava/lang/Object;"))
        {
            PluginUtils::outputLog("PluginFactory", "Can't find method initPlugin in class org.cocos2dx.plugin.PluginWrapper");
            break;
        }

        jstring clsName = t.env->NewStringUTF(jClassName.c_str());
        jobject jObj = t.env->CallStaticObjectMethod(t.classID, t.methodID, clsName);
        t.env->DeleteLocalRef(clsName);
        t.env->DeleteLocalRef(t.classID);
        if (jObj == NULL)
        {
            PluginUtils::outputLog("PluginFactory", "Can't find java class %s", jClassName.c_str());
            break;
        }

        if (! PluginJniHelper::getStaticMethodInfo(t
                , "org/cocos2dx/plugin/PluginWrapper"
                , "getPluginType"
                , "(Ljava/lang/Object;)I"))
        {
            PluginUtils::outputLog("PluginFactory", "Can't find method getPluginType in class org.cocos2dx.plugin.PluginWrapper");
            break;
        }
        int curType = t.env->CallStaticIntMethod(t.classID, t.methodID, jObj);
        t.env->DeleteLocalRef(t.classID);
        PluginUtils::outputLog("PluginFactory", "The type of plugin %s is : %d", name, curType);

        switch (curType)
        {
        case kPluginAds:
            pRet = new ProtocolAds();
            break;
        case kPluginAnalytics:
            pRet = new ProtocolAnalytics();
            break;
        case kPluginIAP:
            pRet = new ProtocolIAP();
            break;
        case kPluginShare:
            pRet = new ProtocolShare();
            break;
        case kPluginUser:
            pRet = new ProtocolUser();
            break;
        case kPluginSocial:
            pRet = new ProtocolSocial();
            break;
        case kPluginData:
            pRet = new ProtocolData();
            break;
        case kPluginBaaS:
            pRet = new ProtocolBaaS();
            break;
        default:
            break;
        }

        if (pRet != NULL)
        {
            pRet->setPluginName(name);
            PluginUtils::initJavaPlugin(pRet, jObj, jClassName.c_str());
        }
    } while(0);

    return pRet;
}
开发者ID:Senspark,项目名称:CocosXtension,代码行数:83,代码来源:PluginFactory.cpp


注:本文中的PluginProtocol类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。