예제 #1
0
void TestShare::eventMenuCallback(Object* pSender)
{
	MenuItemLabel* pMenuItem = (MenuItemLabel*)pSender;
    TShareInfo pInfo;
    pInfo["SharedText"] = "Share message : HelloShare!";
    // pInfo["SharedImagePath"] = "Full/path/to/image";
    MyShareManager::MyShareMode mode = (MyShareManager::MyShareMode) (pMenuItem->getTag() - TAG_SHARE_BY_TWWITER + 1);
    MyShareManager::getInstance()->shareByMode(pInfo, mode);
}
예제 #2
0
void TestIAP::eventMenuCallback(Ref* pSender)
{
    MenuItemLabel* pMenuItem = (MenuItemLabel*)pSender;
    TProductInfo pInfo;
    MyPurchase::MyPayMode mode = (MyPurchase::MyPayMode) (pMenuItem->getTag() - TAG_PAY_BY_ALIPAY + 1);
    pInfo["productName"] = "100金币";
	pInfo["productPrice"] = "0.01";
	pInfo["productDesc"] = "100个金灿灿的游戏币哦";
	pInfo["Nd91ProductId"] = "685994";
    MyPurchase::getInstance()->payByMode(pInfo, mode);
}
예제 #3
0
void HelloWorld::OnClickMenu(Ref* pSender)
{
    MenuItemLabel * label = dynamic_cast<MenuItemLabel *>(pSender);
    
    long tag = label->getTag();
        auto  sc = Scene::create();
    
    if (tag==200) {
        
        auto layer = ValueLayer::create();
        sc->addChild(layer);
    }
    
    if (tag==201) {
        auto layer = ArrayLayer::create();
        sc->addChild(layer);
    }
    
    if (tag==202) {
        auto layer = VectorLayer::create();
        sc->addChild(layer);
    }
    
    if (tag==203) {
        auto layer = DictionaryLayer::create();
        sc->addChild(layer);
    }
    if (tag==204) {
        auto layer = ValueVectorLayer::create();
        sc->addChild(layer);
    }
    if (tag==205) {
        auto layer = ValueMapLayer::create();
        sc->addChild(layer);
    }
    
    auto reScene = TransitionSlideInR::create(1.0f, sc);
    Director::getInstance()->replaceScene(reScene);
}
void HelloWorld::menuEventCallback(cocos2d::Ref* pSender){
    MenuItemLabel* pMenuItem = (MenuItemLabel*)pSender;
    char buf[64];
    int i = pMenuItem->getTag();
    
    sprintf(buf, s_EventMenuItem[i].id.c_str(), ++_indexes[i]);
    LabelTTF* label = (LabelTTF*)pMenuItem->getLabel();
    label->setString(buf);
    switch (i) {
        case CREATE_USER_ID:
            mTDGAaccount = TDCCAccount::setAccount(label->getString().c_str());
            break;
            
        case ADD_LEVEL:
            if (mTDGAaccount) mTDGAaccount->setLevel(_indexes[i]);
            break;
            
        case UPDATE_GAME_SERVER:
            if (mTDGAaccount) mTDGAaccount->setGameServer(label->getString().c_str());
            break;
            
        case UPDATE_USER_NAME:
            if (mTDGAaccount) mTDGAaccount->setAccountName(label->getString().c_str());
            break;
            
        case UPDATE_GENDER:
            if (mTDGAaccount) mTDGAaccount->setGender(mTDGAaccount->kGenderMale);
            break;
            
        case UPDATE_TYPE:
            if (mTDGAaccount) mTDGAaccount->setAccountType(mTDGAaccount->kAccountType1);
            break;
            
        default:
            break;
    }
}
void TestAnalytics::eventMenuCallback(Object* pSender)
{
    MenuItemLabel* pMenuItem = (MenuItemLabel*)pSender;

    switch (pMenuItem->getTag())
    {
    case TAG_LOG_EVENT_ID:
        {
            _pluginAnalytics->logEvent("click");
            _pluginAnalytics->logEvent("music");
        }
        break;
    case TAG_LOG_EVENT_ID_KV:
        {
            LogEventParamMap paramMap;
            paramMap.insert(LogEventParamPair("type", "popular"));
            paramMap.insert(LogEventParamPair("artist", "JJLin"));
            _pluginAnalytics->logEvent("music", &paramMap);
        }
        break;
    case TAG_LOG_ONLINE_CONFIG:
        {
            PluginParam param("abc");
            log("Online config = %s", _pluginAnalytics->callStringFuncWithParam("getConfigParams", &param, NULL).c_str());
        }
        break;
    case TAG_LOG_EVENT_ID_DURATION:
        {
            PluginParam event1("book");
            PluginParam dura1(12000);
            _pluginAnalytics->callFuncWithParam("logEventWithDuration", &event1, &dura1, NULL);

            PluginParam event2("book");
            PluginParam dura2(12000);
            PluginParam label("chapter1");
            _pluginAnalytics->callFuncWithParam("logEventWithDurationLabel", &event2, &dura2, &label, NULL);

            PluginParam event3("music");
            PluginParam dura3(2330000);
            LogEventParamMap paramMap;
            paramMap.insert(LogEventParamPair("type", "popular"));
            paramMap.insert(LogEventParamPair("artist", "JJLin"));
            PluginParam mapValue(paramMap);
            _pluginAnalytics->callFuncWithParam("logEventWithDurationParams", &event3, &dura3, &mapValue, NULL);
        }
        break;
    case TAG_LOG_EVENT_BEGIN:
        {
            _pluginAnalytics->logTimedEventBegin("music");

            PluginParam event1("music");
            PluginParam label1("one");
            _pluginAnalytics->callFuncWithParam("logTimedEventWithLabelBegin", &event1, &label1, NULL);

            PluginParam event2("music");
            PluginParam label2("flag0");
            LogEventParamMap paramMap;
            paramMap.insert(LogEventParamPair("type", "popular"));
            paramMap.insert(LogEventParamPair("artist", "JJLin"));
            PluginParam mapValue(paramMap);
            _pluginAnalytics->callFuncWithParam("logTimedKVEventBegin", &event2, &label2, &mapValue, NULL);

            PluginParam event3("music-kv");
            _pluginAnalytics->callFuncWithParam("logTimedEventBeginWithParams", &event3, &mapValue, NULL);
        }
        break;
    case TAG_LOG_EVENT_END:
        {
            _pluginAnalytics->logTimedEventEnd("music");

            PluginParam event1("music");
            PluginParam label1("one");
            _pluginAnalytics->callFuncWithParam("logTimedEventWithLabelEnd", &event1, &label1, NULL);

            PluginParam event2("music");
            PluginParam label2("flag0");
            _pluginAnalytics->callFuncWithParam("logTimedKVEventEnd", &event2, &label2, NULL);

            PluginParam event3("music-kv");
            _pluginAnalytics->callFuncWithParam("logTimedEventEnd", &event3, NULL);
        }
        break;
    case TAG_MAKE_ME_CRASH:
        {
            char* pNull = NULL;
            *pNull = 0;
        }
        break;
    default:
        break;
    }
}