本文整理汇总了C++中BaseSprite::setTag方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseSprite::setTag方法的具体用法?C++ BaseSprite::setTag怎么用?C++ BaseSprite::setTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseSprite
的用法示例。
在下文中一共展示了BaseSprite::setTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: menuItemClicked_jiesuoHero
void MainLayerHerosBaseBody::menuItemClicked_jiesuoHero(CCObject *pSender)
{
int idx = ((CCMenuItemImage*)pSender)->getTag();
char buf[128];
if (mHerosVec.at(idx)->canUnlock())
{
mJieSuo_HeroId = mHerosVec.at(idx)->getId();
//弹框背景
BaseSprite* dialog = BaseSprite::create("shangpin_goumai_tishikuang.png");
dialog->setPosition(ccp(mWinSize.width/2, mWinSize.height/2));
dialog->setTag(Tag_Window_JieSuo);
//label
CCString temp;
//解锁此助手需要花费\n%d荣誉值\n(当前荣誉:%d)
temp.initWithFormat(LFStrings::getValue("JieSuoZhuShouXuYao_RongYuZhi").c_str(),
CS::AssistantUnLockNeedHonor(MyselfManager::getManager()->getTeamActors_ZhenShen(Actor_All, LF_Locked).size()),
MyselfManager::getManager()->getEdiableArenaTeamBasicInfo()->jifen);
CCLabelTTF *label = CCLabelTTF::create(temp.getCString(), fontStr_kaiti, 30, CCSize(400, 0), kCCTextAlignmentCenter);
dialog->addChild(label);
label->setAnchorPoint(ccp(0.5, 1));
label->setPosition(ccp(dialog->getContentSize().width/2, 278));
//按键
CCMenu* menu;
{
CCMenuItemImage* menuItemMakeSure = CCMenuItemImage::create(
"shangpin_goumai_queren.png",
"shangpin_goumai_queren_select.png",
this,SEL_MenuHandler(&MainLayerHerosBaseBody::menuItemClicked_LockHero_OkCancel));
CCMenuItemImage* menuItemCacel = CCMenuItemImage::create(
"shangpin_goumai_quxiao.png",
"shangpin_goumai_quxiao_select.png",
this,SEL_MenuHandler(&MainLayerHerosBaseBody::menuItemClicked_LockHero_OkCancel));
menu = CCMenu::create(menuItemMakeSure, menuItemCacel, NULL);
menu->setPosition(CCPointZero);
menuItemMakeSure->setTag(10);
menuItemCacel->setTag(20);
menuItemMakeSure->setPosition(ccp(dialog->getContentSize().width/3*2,70));
menuItemCacel->setPosition(ccp(dialog->getContentSize().width/3, 70));
}
//弹框
{
LFAlert* lfAlert = new LFAlert();
lfAlert->setTag(Tag_Window_JieSuo);
lfAlert->setBaseContainer(dialog,menu);
CCDirector::sharedDirector()->getRunningScene()->addChild(lfAlert, 128, Tag_Window_JieSuo);
lfAlert->release();
}
}
else
{
sprintf(buf, LFStrings::getValue("XuYaoZhuJueDengJi_jiesuo").c_str(), 15);
MessageDisplay *layer = MessageDisplay::create(buf);
CCDirector::sharedDirector()->getRunningScene()->addChild(layer);
return;
}
}