本文整理汇总了C++中CCMenuItemSprite::removeChildByTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItemSprite::removeChildByTag方法的具体用法?C++ CCMenuItemSprite::removeChildByTag怎么用?C++ CCMenuItemSprite::removeChildByTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenuItemSprite
的用法示例。
在下文中一共展示了CCMenuItemSprite::removeChildByTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adjustMap
void LevelMap::adjustMap(bool isResetLevel)
{
int num = floor(offsetY/442);
currentMap = -num;
int offnum = num%3;
float tmpoff = offsetY - num*442;
mapLayer->setPosition(ccp(0, (offnum-1)*442 + tmpoff));
if(isResetLevel)
{
int offlevel = 1000 + currentMap*3 -3;
for (int i = 0; i < 9 ; i++)
{
MapItem* tmpLevelItemData = NULL;
tmpLevelItemData = CData::getCData()->getConfigOfMapLevel(offlevel + i);
CCMenuItemSprite* tmp = (CCMenuItemSprite*)levelSpDic->objectForKey(i);
tmp->removeChildByTag(9999);
if (tmpLevelItemData!= NULL && tmpLevelItemData->bid < currentLevelId)
{
CCSize tmpsz = tmp->getContentSize();
CCSprite* ssp = CCSprite::create();
int num = data["citylist"][tmpLevelItemData->bid - 1000].asInt();
for (int k = 0; k<num; k++)
{
CCSprite * star = CCSprite::create("zjm_star.png");
star->setPosition(ccp(k*30, 0));
ssp->addChild(star);
}
ssp->setPosition(ccp(tmpsz.width/2-15*num+15, 0));
ssp->setTag(9999);
tmp->addChild(ssp, 0);
}
if(tmpLevelItemData != NULL)
{
if(tmpLevelItemData->bid > currentLevelId)
{
tmp->setEnabled(false);
}
else
{
tmp->setEnabled(true);
}
tmp->setUserObject(tmpLevelItemData);
}
//for (int j = 1001; j<=1005; j++)
//{
CCLabelTTF* tmpName = (CCLabelTTF*)(tmp->getChildByTag(1002));
if(tmpLevelItemData)
{
tmpName->setString(tmpLevelItemData->nickname.c_str());
}
//}
}
}
levelsMenu->setPosition(ccp(0, -442 + tmpoff));
}
示例2: initPet
void PrepareLayer::initPet(int leftOrRight)
{
///**初始化已经出战的左边的宠物**///
int petId = -1;
for (int i =0;i !=6; ++i )
{
if (GameConfigData::initialGameData().getPetStateById(i) == "2")
{
if (GameConfigData::initialGameData().getPetPosById(i) == leftOrRight)
{
petId = i;
}
}
}
CCMenuItemSprite *petAddLeft = (CCMenuItemSprite *)m_menu->getChildByTag(100+4+leftOrRight);
if (petAddLeft->getChildByTag(1000))
{
petAddLeft->removeChildByTag(1000);
}
CCPoint leftPoint[6] = {petAddLeft->getContentSize()/2+ccp(20*gScaleX,0),petAddLeft->getContentSize()/2+ccp(20*gScaleX,0),petAddLeft->getContentSize()/2+ccp(30*gScaleX,0),
petAddLeft->getContentSize()/2+ccp(30*gScaleX,0),petAddLeft->getContentSize()/2+ccp(30*gScaleX,0),petAddLeft->getContentSize()/2+ccp(30*gScaleX,0)};
float scale[6] = {0.4*PRE_SCALE,0.4*PRE_SCALE,0.5*PRE_SCALE,0.5*PRE_SCALE,0.5*PRE_SCALE,0.5*PRE_SCALE};
CCSprite *sp = NULL;
if (petId != -1)
{
char petFile[48];
sprintf(petFile,"ui/petUI/pet%d_0.png",petId);
sp = CCSprite::create(petFile);
sp->setScale(scale[petId]);
if(leftOrRight ==0)
{
sp->setPosition(leftPoint[petId]);
m_leftPitId = petId;
}
else
{
sp->setPosition(leftPoint[petId]);
m_rightPetId =petId;
}
showHeroPet(leftOrRight,petId);
}
else
{
sp = CCSprite::create("ui/shared/plus.png");
sp->setPosition(petAddLeft->getContentSize()/2+ccp(20*gScaleX,0));
if(leftOrRight ==0)
{
if(this->getChildByTag(45456)!=NULL)
{
this->getChildByTag(45456)->setVisible(false);
}
}
else
{
if(this->getChildByTag(45457)!=NULL)
{
this->getChildByTag(45457)->setVisible(false);
}
}
}
petAddLeft->addChild(sp,1,1000);
}