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


C++ CButton::removeChildByTag方法代码示例

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


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

示例1: updateHero

void CCommandLayer::updateHero(const TMessage& tMsg)
{
	//清空
	if (tMsg.nMsg ==0)
	{
		CButton *btn = (CButton*)(m_garrsionLayer->getChildByTag(m_selectHero));
		btn->removeChildByTag(1);
		CHero hero;
		hero.id= 0;
		// 		memset((void*)&hero,0,sizeof(CHero));
		m_city.heroList[m_selectHero-1] = hero;
		// 
		CCNode *lab = (CCNode*)m_garrsionLayer->findWidgetById(CCString::createWithFormat("lab%d",m_selectHero)->getCString());
		lab->setVisible(true);
	}
	else
	{
		CButton *btn = (CButton*)(m_garrsionLayer->getChildByTag(m_selectHero));
		CHero *hero = (CHero*)tMsg.lParam;
		string icon = ToString(hero->thumb);

		btn->removeChildByTag(1);
		CCNode *lab = (CCNode*)m_garrsionLayer->findWidgetById(CCString::createWithFormat("lab%d",m_selectHero)->getCString());
		lab->setVisible(false);

		CCSprite *head = CCSprite::create(CCString::createWithFormat("headImg/%d.png",hero->thumb)->getCString());
		if (!head)
		{
			head = CCSprite::create("headImg/101.png");
			CCLOG("[ ERROR ] CCommandLayer::updateHero Lost Image = %d",hero->thumb);
		}
		head->setPosition(ccp(btn->getContentSize().width/2, btn->getContentSize().height/2));
		head->setTag(1);
		head->setScale(82.0f/100.0f);
		btn->addChild(head);

		btn->setEnabled(false);
		head->setColor(RGB_GRAY_COLOR);

		if (m_selectHero>m_city.heroList.size())
		{
			m_city.heroList.push_back(*hero);
		}
		else
		{
			m_city.heroList[m_selectHero-1] = *hero;
		}
		delete hero;
	}
}
开发者ID:54993306,项目名称:Classes,代码行数:50,代码来源:CommandLayer.cpp

示例2: updateStar

void CSmeltArmor::updateStar( const TMessage& tMsg )
{
	//加号
	CItem* pData = (CItem*)tMsg.lParam;
	if(pData)
	{
		//自己的数据不更新
		if(&(m_armor) == pData)
		{
			return;
		}
		CCSprite *why = dynamic_cast<CCSprite*>(m_ui->findWidgetById("why"));
		if(why->isVisible())
		{
			return;
		}
		CButton *btn = dynamic_cast<CButton*>(m_ui->findWidgetById("select"));
		btn->removeChildByTag(415);
		CLayout* pStarLayout = getStarLayout(pData->iStar);
		btn->addChild(pStarLayout, 415, 415);
	}
}
开发者ID:54993306,项目名称:Classes,代码行数:22,代码来源:SmeltArmor.cpp

示例3: showSmeltDataToUI

void CSmeltArmor::showSmeltDataToUI()
{
	const ItemData * itemData = DataCenter::sharedData()->getItemDesc()->getCfg(m_armor.itemId);

	//贴图
	CCSprite *prop = getItemSprite(&m_armor);
	if (!prop)
	{
		prop = CImageView::create("prop/32003.png");
	}

	//选择按钮
	CButton *btn = dynamic_cast<CButton*>(m_ui->findWidgetById("select"));
	btn->removeChildByTag(1);
	prop->setPosition(ccp(btn->getContentSize().width/2,btn->getContentSize().height/2));
	prop->setTag(1);
	btn->addChild(prop, -1);
	((CCSprite*)btn->getNormalImage())->setTexture(setItemQualityTexture(m_armor.quality));

	//添加星星层
	btn->removeChildByTag(415);
	CLayout* pStarLayout = getStarLayout(m_armor.iStar);
	btn->addChild(pStarLayout, 415, 415);

	//更新名字
	CLabel *name = dynamic_cast<CLabel*>(m_ui->findWidgetById("name"));
	CCString *str = CCString::create("XXX");
	if(itemData)
	{
		str = CCString::createWithFormat("%s",itemData->itemName.c_str());
	}
	name->setString(str->getCString());
	name->setVisible(true);

	//加号
	CCSprite *why = dynamic_cast<CCSprite*>(m_ui->findWidgetById("why"));
	why->setVisible(false);

	//设置等级
	CLabel* pLevel = dynamic_cast<CLabel*>(m_ui->findWidgetById("level"));
	CCNode* pLevelBg = dynamic_cast<CCNode*>(m_ui->findWidgetById("level_mask"));
	if(m_armor.itemLevel>0)
	{
		pLevel->setVisible(true);
		pLevelBg->setVisible(true);

		pLevel->setString(CCString::createWithFormat("+%d", m_armor.itemLevel)->getCString());
	}
	else
	{
		pLevel->setVisible(false);
		pLevelBg->setVisible(false);
	}


	m_attr->setVisible(true);

	//显示背景框等等
	CCNode* pNode4 = (CCNode*)m_ui->findWidgetById("tip");
	pNode4->setVisible(false);

	m_pSpineHero->setVisible(false);


	initSpandAndCheckBox();

	showArmorAttr();

	//更新钱
	onCheckAttr(nullptr, false);

	//设置动作
	showMoveAction("box_bg");
	showMoveAction("select");
	showMoveAction("why");
	showMoveAction("level");
	showMoveAction("level_mask");
}
开发者ID:54993306,项目名称:Classes,代码行数:78,代码来源:SmeltArmor.cpp


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