本文整理汇总了C++中CLabel::setVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ CLabel::setVisible方法的具体用法?C++ CLabel::setVisible怎么用?C++ CLabel::setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLabel
的用法示例。
在下文中一共展示了CLabel::setVisible方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onTouchItem
void CStrengthenItem::onTouchItem(CCObject* pSender)
{
if(isVisible())
{
PlayEffectSound(SFX_Button);
}
CImageView * img = (CImageView*)pSender;
m_item = (CItem*)img->getUserData();
m_pItemTip->showItemProperty(m_item);
CLayout *attribute = (CLayout*)(m_ui->findWidgetById("attr"));
attribute->setVisible(true);
m_selectCellImg->removeFromParent();
img->addChild(m_selectCellImg);
m_selectCellImg->setVisible(true);
m_selectCellImg->setPosition(ccp(img->getContentSize().width/2,0/*img->getContentSize().height/2*/));
CButton *select = (CButton*)(m_ui->findWidgetById("select")); //sel_font
CLabel *selfont = (CLabel*)(m_ui->findWidgetById("sel_font"));
if (m_toHero==m_item->armor.hero&&m_toHero>0)
{
select->setVisible(true);
selfont->setVisible(false);
}
else if (m_toHero>0&&!m_item->canUse)
{
select->setVisible(false);
selfont->setVisible(false);
}
else
{
select->setVisible(true);
selfont->setVisible(true);
}
if (m_type==2)
{
if (m_toHero>0)
{
CImageView *uninstall = (CImageView*)(m_ui->findWidgetById("uninstall"));
CImageView *change = (CImageView*)(m_ui->findWidgetById("change"));
CImageView *selfont = (CImageView*)(m_ui->findWidgetById("sel_font"));
uninstall->setVisible(m_toHero==m_item->armor.hero);
change->setVisible(m_toHero!=m_item->armor.hero&&m_item->armor.hero>0&&m_item->canUse);
selfont->setVisible(m_item->armor.hero==0&&m_item->canUse);
}
}
}
示例2: updateSignDays
void CSignLayer::updateSignDays()
{
//更新已签天数
CLabel * pSignNum = (CLabel*)m_ui->findWidgetById("qiandao_num");
pSignNum->setString(ToString(m_signData.sign));
if(!m_signData.bCanSign)
{
//更新已签天数
CButton * pSignBtn = (CButton*)m_ui->findWidgetById("qiandao_btn");
pSignBtn->setEnabled(false);
pSignBtn->getDisabledImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
}
//未补签天数
CLabel* pRemainResignNum = (CLabel*)m_ui->findWidgetById("buqian_num");
pRemainResignNum->setString(ToString(m_signData.resign));
if(!m_signData.bCanResign || m_signData.resign==0)
{
//更新已签天数
//CButton * pReSignBtn = (CButton*)m_ui->findWidgetById("buqian_btn");
//pReSignBtn->setEnabled(false);
//pReSignBtn->getDisabledImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
pRemainResignNum->setVisible(false);
CLabel* pRemainResignText = (CLabel*)m_ui->findWidgetById("buqian_text");
pRemainResignText->setVisible(false);
CLabel* pRemainResignBg = (CLabel*)m_ui->findWidgetById("buqian_bg");
pRemainResignBg->setVisible(false);
CLabel* pRemainResignBtn = (CLabel*)m_ui->findWidgetById("buqian_btn");
pRemainResignBtn->setVisible(false);
CLabel* pRemainResignBtnText = (CLabel*)m_ui->findWidgetById("buqian_btn_text");
pRemainResignBtnText->setVisible(false);
}
////totalSign
//for (int i = 0; i < m_signData.totalList.size()&&i<4; i++)
//{
// CSign &sign = m_signData.totalList.at(i);
// if (m_signData.sign >= sign.day)
// {
// CCSprite *getspr = (CCSprite*)(m_ui->findWidgetById(CCString::createWithFormat("get%d",i+1)->getCString()));
// getspr->setVisible(true);
// }
//}
}
示例3: showTipsOnNextTotalSign
void CSignLayer::showTipsOnNextTotalSign()
{
m_pYellowTip->setVisible(false);
//遍历阶段签到
for (int i = 0; i < m_signData.totalList.size()&&i<4; i++)
{
CSign &sign = m_signData.totalList.at(i);
//未领取
if(sign.status==2)
{
if(sign.day>m_signData.sign)
{
//当前底加高亮
CCSprite* pBg = (CCSprite*)m_ui->findWidgetById(CCString::createWithFormat("bg%d",i+1)->getCString());
//pBg->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
pBg->setTexture(CCTextureCache::sharedTextureCache()->addImage("sign/arrival_02.png"));
//pBg->setScale(0.85f);
//拿到当前宝箱
CImageView *mask = (CImageView*)m_ui->findWidgetById(CCString::createWithFormat("mask%d",i+1)->getCString());
//隐藏自己的日期
CLabel *day = (CLabel*)(m_ui->findWidgetById(CCString::createWithFormat("day%d",i+1)->getCString()));
day->setVisible(false);
//加黄标提示
m_pYellowTip->setVisible(true);
m_pYellowTip->setPosition(ccp(mask->getPositionX()+mask->getContentSize().width/2, mask->getPositionY()+mask->getContentSize().height-60));
m_pYellowTipText->setString(day->getString());
break;
}
}
else
{
//当前底加高亮
CCSprite* pBg = (CCSprite*)m_ui->findWidgetById(CCString::createWithFormat("bg%d",i+1)->getCString());
//pBg->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault));
pBg->setTexture(CCTextureCache::sharedTextureCache()->addImage("sign/arrival_01.png"));
//pBg->setScale(1.0f);
//天数
CLabel *day = (CLabel*)(m_ui->findWidgetById(CCString::createWithFormat("day%d",i+1)->getCString()));
day->setVisible(true);
}
}
}
示例4: addTableCell
void CHandBookHeroLayer::addTableCell( unsigned int uIdx, CTableViewCell * pCell )
{
//先克隆外框条
CLayout *pLay = UICloneMgr::cloneLayout(m_pCellBlank);
//对应数据
AtlasIns *pAtlasIns = m_AtlasResponse.mutable_atlas_list()->Mutable(uIdx);
//赋值
for (unsigned int i=1; i<=10; i++)
{
CCNode *child = pLay->getChildByTag(i);
pLay->removeChild(child);
child->setTag(i);
pCell->addChild(child);
pCell->setTag(uIdx);
}
//1-活动底板
{
CImageView* pBoard = dynamic_cast<CImageView*>(pCell->getChildByTag(1));
pBoard->setTouchEnabled(true);
pBoard->setOnClickListener(this, ccw_click_selector(CHandBookHeroLayer::onClickBlank));
if ( uIdx==m_iSelectIndex )
{
pBoard->setTexture(CCTextureCache::sharedTextureCache()->addImage("handBook/bookbg_2.png"));
}
else
{
pBoard->setTexture(CCTextureCache::sharedTextureCache()->addImage("handBook/bookbg_1.png"));
}
}
//2-组合名字
{
CLabel* pLabel = dynamic_cast<CLabel*>(pCell->getChildByTag(2));
}
//3-//组合描述
{
CLabel* pLabel = dynamic_cast<CLabel*>(pCell->getChildByTag(3));
}
//4-礼品背景
//5-礼品
//10-文字
{
CImageView* pGiftBg = dynamic_cast<CImageView*>(pCell->getChildByTag(4));
CImageView* pGift = dynamic_cast<CImageView*>(pCell->getChildByTag(5));
CLabel* pLabel = dynamic_cast<CLabel*>(pCell->getChildByTag(10));
pLabel->setVisible(false);
pGift->stopAllActions();
//奖励领取标志 0未领取(不可领取),1未领取(可领取状态),2 已领取
switch (pAtlasIns->get_prize())
{
case 0:
{
pGiftBg->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
pGift->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
}break;
case 1:
{
pGiftBg->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault));
pGift->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault));
ResetAnchorPointAndKeepSamePos(pGift, CCPointCenter);
pGift->runAction(CCRepeatForever::create(CCSequence::createWithTwoActions(CCScaleTo::create(0.3f, 0.75f), CCScaleTo::create(0.3f, 0.7f))));
}break;
case 2:
{
pGiftBg->setVisible(false);
pGift->setVisible(false);
pLabel->setVisible(true);
}break;
default:
break;
}
}
//7-进度条
//8-进度数字
//9-进度图标
{
CProgressBar* pProgress = dynamic_cast<CProgressBar*>(pCell->getChildByTag(7));
CLabel* pLabel = dynamic_cast<CLabel*>(pCell->getChildByTag(8));
pLabel->setTouchEnabled(true);
pLabel->setOnClickListener(this, ccw_click_selector(CHandBookHeroLayer::onClickScoreIcon));
CImageView* pIcon = dynamic_cast<CImageView*>(pCell->getChildByTag(9));
pIcon->setTouchEnabled(true);
pIcon->setOnClickListener(this, ccw_click_selector(CHandBookHeroLayer::onClickScoreIcon));
}
//.........这里部分代码省略.........
示例5: addTableCell
void CStrengthenItem::addTableCell(unsigned int uIdx, CTableViewCell * pCell)
{
CLayout *lay = UICloneMgr::cloneLayout(m_cell);
CItem &item = *(m_itemList.at(uIdx));// m_itemData.itemList.at(uIdx);
pCell->setTag(uIdx);
const ItemData * itemData = DataCenter::sharedData()->getItemDesc()->getCfg(item.itemId);
for (int i = 1; i <=11; i++)
{
CCNode *child = lay->getChildByTag(i);
if (!child) continue;
lay->removeChild(child);
pCell->addChild(child);
if (i==1)
{
CImageView *bgImg = (CImageView*)child;
if (m_toHero>0)
{
if (!item.canUse&&item.armor.hero!=m_toHero)
{
CColorView *colorView = CColorView::create(ccc4(0,0,0,100));
colorView->setContentSize(bgImg->getContentSize());
colorView->setPosition(bgImg->getPosition());
pCell->addChild(colorView,1);
}
if(item.armor.hero<=0)
{
//记录库存
m_iCountEquipStock++;
}
}
bgImg->setTouchEnabled(true);
bgImg->setUserData(m_itemList.at(uIdx));
bgImg->setOnClickListener(this,ccw_click_selector(CStrengthenItem::onTouchItem));
}
else if (i==2)
{
((CButton*)child)->setEnabled(false);
CCSprite *mask = CCSprite::createWithTexture(setItemQualityTexture(item.quality));
mask->setPosition(ccp(child->getContentSize().width/2,child->getContentSize().height/2));
child->addChild(mask, 10);
CCSprite *prop = CCSprite::create(GetImageName(1, item.quality, item.iconId).c_str());
if (!prop)
{
prop = CImageView::create("prop/32003.png");
}
prop->setPosition(ccp(child->getContentSize().width/2,child->getContentSize().height/2));
child->addChild(prop);
//添加星星
CLayout* pStarLayout = getStarLayout(item.iStar);
child->addChild(pStarLayout, 10);
}
else if (i==3)
{
CLabel *label = (CLabel*)child;
if(itemData)
{
label->setString(itemData->itemName.c_str());
}
}
else if (i==4)
{
CLabel *label = (CLabel*)child;
if (item.itemLevel==0)
{
label->removeFromParent();
}
else
{
label->setString(CCString::createWithFormat("+%d",item.itemLevel)->getCString());
label->setPositionX(pCell->getChildByTag(3)->getPositionX()+pCell->getChildByTag(3)->getContentSize().width+10);
}
}
else if (i==5)
{
CLabel *label = (CLabel*)child;
if (item.itemLevel==0)
{
label->setVisible(false);
}
else
{
label->setVisible(true);
//if (item.itemLevel==item.armor.strenLv)
//{
// label->setString(CCString::createWithFormat("Lv.%s",GETLANGSTR(229))->getCString());
//}
//else
//{
// label->setString(CCString::createWithFormat("Lv.%d",item.itemLevel)->getCString());
//}
//.........这里部分代码省略.........
示例6: hideErrorCode
void CVipCard::hideErrorCode()
{
CLabel* pLabel = (CLabel*)m_ui->findWidgetById("error_code");
pLabel->setVisible(false);
}
示例7: 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");
}