本文整理汇总了C++中MenuItemLabel::getTag方法的典型用法代码示例。如果您正苦于以下问题:C++ MenuItemLabel::getTag方法的具体用法?C++ MenuItemLabel::getTag怎么用?C++ MenuItemLabel::getTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItemLabel
的用法示例。
在下文中一共展示了MenuItemLabel::getTag方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eventMenuCallback
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: eventMenuCallback
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: OnClickMenu
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);
}
示例4: menuEventCallback
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;
}
}
示例5: eventMenuCallback
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", ¶mMap);
}
break;
case TAG_LOG_ONLINE_CONFIG:
{
PluginParam param("abc");
log("Online config = %s", _pluginAnalytics->callStringFuncWithParam("getConfigParams", ¶m, 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;
}
}