本文整理汇总了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", ¶mMap);
break;
default:
break;
}
}
示例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);
}
示例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);
}
示例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;
}
}
示例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();
}
示例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;
}
}
示例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", ¶mMap);
}
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, ¶mMap);
}
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", ¶mMap);
}
else if (pFlurry != NULL)
{
pFlurry->logTimedEventBegin("music-kv", ¶mMap);
}
}
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;
}
}