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


C++ CCMenuItemLabel::getTag方法代码示例

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


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

示例1: eventMenuCallback

void VirtualCurrencyLayer::eventMenuCallback(CCObject* pSender) {
	CCMenuItemLabel* pMenuItem = (CCMenuItemLabel*)pSender;
    int i = pMenuItem->getTag();
    EventParamMap paramMap;
    pthread_t thread;
    switch (i) {
    case ONREQUEST:
    	TDCCVirtualCurrency::onChargeRequest("o_1", "iap", 10, "CN", 20, "T1");
        break;
            
    case ONSUCCESS:

    	pthread_create(&thread, NULL, runThread, NULL);

        break;
            
    case ONREWARD:
        TDCCVirtualCurrency::onReward(100, "reason");
        break;

    case ONEVENT:
    	paramMap.insert(EventParamPair("type", "popular"));
		paramMap.insert(EventParamPair("artist", "JJLin"));
        paramMap["aa"] = "bb";
		TDCCTalkingDataGA::onEvent("music", &paramMap);

    	break;

    default:
        break;
    }

}
开发者ID:CaiZhongda,项目名称:game-analytics-cocos2dx,代码行数:33,代码来源:VirtualCurrencyScene.cpp

示例2: eventMenuCallback

void HelloWorld::eventMenuCallback(CCObject* pSender)
{
	CCMenuItemLabel* pMenuItem = (CCMenuItemLabel*)pSender;
    TShareInfo pInfo;
    pInfo["SharedText"] = "Share message : HelloSocial!";
    // pInfo["SharedImagePath"] = "Full/path/to/image";
    MySocialManager::MyShareMode mode = (MySocialManager::MyShareMode) (pMenuItem->getTag() - TAG_SHARE_BY_TWWITER + 1);
    MySocialManager::sharedSocialManager()->shareByMode(pInfo, mode);
}
开发者ID:JinChow,项目名称:CocostudioIronCity,代码行数:9,代码来源:HelloWorldScene.cpp

示例3: eventMenuCallback

void HelloWorld::eventMenuCallback(CCObject* pSender)
{
    CCMenuItemLabel* pMenuItem = (CCMenuItemLabel*)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::sharedPurchase()->payByMode(pInfo, mode);
}
开发者ID:524777134,项目名称:cocos2d-x,代码行数:11,代码来源:HelloWorldScene.cpp

示例4: eventMenuCallback

void AccountLayer::eventMenuCallback(CCObject* pSender) {
    CCMenuItemLabel* pMenuItem = (CCMenuItemLabel*)pSender;
    char buf[64];
    int i = pMenuItem->getTag();
    
    CCLog("DeviceId:%s", TDCCTalkingDataGA::getDeviceId());

    sprintf(buf, s_EventMenuItem[i].id.c_str(), ++_indexes[i]);
    CCLabelTTF* label = (CCLabelTTF*)pMenuItem->getLabel();
    label->setString(buf);
    switch (i) {
    case CREATE_USER_ID:
    	mTDGAaccount = TDCCAccount::setAccount(label->getString());
        break;
            
    case ADD_LEVEL:
        if (mTDGAaccount) mTDGAaccount->setLevel(_indexes[i]);
        break;
            
    case UPDATE_GAME_SERVER:
        if (mTDGAaccount) mTDGAaccount->setGameServer(label->getString());
        break;
            
    case UPDATE_USER_NAME:
        if (mTDGAaccount) mTDGAaccount->setAccountName(label->getString());
        break;

    case UPDATE_GENDER:
    	if (mTDGAaccount) mTDGAaccount->setGender(mTDGAaccount->kGenderMale);
    	break;

    case UPDATE_TYPE:
    	if (mTDGAaccount) mTDGAaccount->setAccountType(mTDGAaccount->kAccountType1);
    	break;

    default:
        break;
    }
}
开发者ID:CaiZhongda,项目名称:game-analytics-cocos2dx,代码行数:39,代码来源:AccountScene.cpp

示例5: if

void
MCSkillLayer::selectSkillType(CCObject *anObject)
{
    CCMenuItemLabel *menuItem = dynamic_cast<CCMenuItemLabel *>(anObject);
    MCSkillType skillType = (MCSkillType) menuItem->getTag();
    MCSkillManager *skillManager = MCSkillManager::sharedSkillManager();
    const char *weapon = NULL;
    mc_proficiency_t proficiency;
    
    if (skillType == MCSwordSkill) {
        weapon = "剑";
        proficiency = skillManager->getSwordProficiency();
    } else if (skillType == MCHammerSkill) {
        weapon = "锤";
        proficiency = skillManager->getHammerProficiency();
    } else if (skillType == MCAxeSkill) {
        weapon = "斧";
        proficiency = skillManager->getAxeProficiency();
    } else if (skillType == MCSpearSkill) {
        weapon = "枪";
        proficiency = skillManager->getSpearProficiency();
    } else if (skillType == MCBowSkill) {
        weapon = "弓";
        proficiency = skillManager->getBowProficiency();
    } else {
        proficiency = 0;
    }
    icon_->setVisible(false);
    contentTableView_->setVisible(false);
    if (weapon != NULL) {
        proficiency_->setString(CCString::createWithFormat("%s的熟练度: %hu",
                                                           weapon,
                                                           proficiency)->getCString());
    }
    proficiency_->setVisible(true);
    skills_ = MCSkillManager::sharedSkillManager()->skillsForSkillType(skillType);
    tableView_->reloadData();
}
开发者ID:edison9888,项目名称:__graduation_project,代码行数:38,代码来源:MCSkillLayer.cpp

示例6: eventMenuCallback

void MissionLayer::eventMenuCallback(CCObject* pSender) {
	CCMenuItemLabel* pMenuItem = (CCMenuItemLabel*)pSender;
    int i = pMenuItem->getTag();
    
    switch (i) {
    case ONBEGIN:
    	TDCCMission::onCompleted(missionid);

        break;
            
    case ONCOMPLETED:
    	TDCCMission::onCompleted(missionid);
        break;
            
    case ONFAILED:
    	TDCCMission::onFailed(missionid, NULL);
        break;

    default:
        break;
    }

}
开发者ID:CaiZhongda,项目名称:cocos2dx-talkingdata,代码行数:23,代码来源:MissionScene.cpp

示例7: eventMenuCallback

void HelloWorld::eventMenuCallback(CCObject* pSender)
{
    CCMenuItemLabel* pMenuItem = (CCMenuItemLabel*)pSender;
    AnalyticsUmeng* pUmeng = dynamic_cast<AnalyticsUmeng*>(g_pAnalytics);
    AnalyticsFlurry* pFlurry = dynamic_cast<AnalyticsFlurry*>(g_pAnalytics);

    switch (pMenuItem->getTag())
    {
    case TAG_LOG_EVENT_ID:
        {
            g_pAnalytics->logEvent("click");
            g_pAnalytics->logEvent("music");
        }
        break;
    case TAG_LOG_EVENT_ID_KV:
        {
            LogEventParamMap paramMap;
            paramMap.insert(LogEventParamPair("type", "popular"));
            paramMap.insert(LogEventParamPair("artist", "JJLin"));
            g_pAnalytics->logEvent("music", &paramMap);
        }
        break;
    case TAG_LOG_ONLINE_CONFIG:
        {
            if (pUmeng != NULL)
            {
                CCLog("Online config = %s", pUmeng->getConfigParams("abc"));           
            }
            else
            {
                CCLog("Now is not using umeng!");
            }
        }
        break;
    case TAG_LOG_EVENT_ID_DURATION:
        {
            if (pUmeng != NULL)
            {
                pUmeng->logEventWithDuration("book", 12000);
                pUmeng->logEventWithDuration("book", 23000, "chapter1");
                LogEventParamMap paramMap;
                paramMap.insert(LogEventParamPair("type", "popular"));
                paramMap.insert(LogEventParamPair("artist", "JJLin"));
                pUmeng->logEventWithDuration("music", 2330000, &paramMap);
            }
            else
            {
                CCLog("Now is not using umeng!");
            }
        }
        break;
    case TAG_LOG_EVENT_BEGIN:
        {
            g_pAnalytics->logTimedEventBegin("music");

            LogEventParamMap paramMap;
            paramMap.insert(LogEventParamPair("type", "popular"));
            paramMap.insert(LogEventParamPair("artist", "JJLin"));

            if (pUmeng != NULL)
            {
                pUmeng->logTimedEventWithLabelBegin("music", "one");
                pUmeng->logTimedKVEventBegin("music", "flag0", &paramMap);
            }
            else if (pFlurry != NULL)
            {
                pFlurry->logTimedEventBegin("music-kv", &paramMap);
            }
        }
        break;
    case TAG_LOG_EVENT_END:
        {
            g_pAnalytics->logTimedEventEnd("music");
            if (pUmeng != NULL)
            {          
                pUmeng->logTimedEventWithLabelEnd("music", "one");
                pUmeng->logTimedKVEventEnd("music", "flag0");
            }
            else if (pFlurry != NULL)
            {
                pFlurry->logTimedEventEnd("music-kv");
            }
        }
        break;
    case TAG_MAKE_ME_CRASH:
        {
            char* pNull = NULL;
            *pNull = 0;
        }
        break;
    default:
        break;
    }
}
开发者ID:DuJiang,项目名称:cocos2d-x,代码行数:94,代码来源:HelloWorldScene.cpp


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