本文整理汇总了C++中CButton::setEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ CButton::setEnabled方法的具体用法?C++ CButton::setEnabled怎么用?C++ CButton::setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CButton
的用法示例。
在下文中一共展示了CButton::setEnabled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateSelectCity
void CCommandLayer::updateSelectCity(CCity *data)
{
CCSprite *build = (CCSprite*)(m_comLayer->findWidgetById("build"));
CCTexture2D *textTure = CCTextureCache::sharedTextureCache()->addImage(CCString::createWithFormat("command/%d.jpg",data->cityId*10+1)->getCString());
if (textTure)
{
build->setTexture(textTure);
}
CLabel *food = (CLabel*)(m_comLayer->findWidgetById("food"));
food->setString(ToString(data->lvFood));
CLabel *heronum = (CLabel*)(m_comLayer->findWidgetById("heronum"));
heronum->setString(CCString::createWithFormat("%d/%d",data->haveHeroNum,data->heroNum)->getCString());
CLabel *note1 = (CLabel*)(m_comLayer->findWidgetById("func1"));
CLabel *note2 = (CLabel*)(m_comLayer->findWidgetById("func2"));
CCArray *strArr = strSplit(data->note.c_str(),"|");
if (strArr->count()==1)
{
note1->setString(((CCString*)strArr->objectAtIndex(0))->getCString());
note2->setString("");
}
else if (strArr->count()==2)
{
note1->setString(((CCString*)strArr->objectAtIndex(0))->getCString());
note2->setString(((CCString*)strArr->objectAtIndex(1))->getCString());
}
CButton *command = (CButton*)(m_comLayer->findWidgetById("strengthen"));
UserData *user = DataCenter::sharedData()->getUser()->getUserData();
if (data->cityId != m_commandData.cityInfo.cityId)
{
if (user->getRoleFood()>=data->lvFood&&data->level< m_commandData.cityInfo.level)
{
command->setEnabled(true);
}
else
{
command->setEnabled(false);
}
}
else
{
if (user->getRoleFood()>=data->lvFood)
{
command->setEnabled(true);
}
else
{
command->setEnabled(false);
}
}
}
示例2: evolveTask
void CHeroExpItem::evolveTask(const CEvolInfo& evInfo )
{
CButton *evolve =(CButton*)(m_ui->findWidgetById("evolve"));
evolve->setEnabled(evInfo.canEvol);
m_evolInfo = evInfo;
m_tableView->setCountOfCell(evInfo.questsList.size());
m_tableView->reloadData();
}
示例3: showBuildInfo
void CCommandLayer::showBuildInfo(const CCity& ct)
{
int i=0;
for (; i<ct.heroList.size()&&i<3; i++)
{
CButton *btn = (CButton*)(m_garrsionLayer->getChildByTag(i+1));
const CHero &hero = ct.heroList[i];
if (hero.thumb!=0)
{
CCSprite *head = CCSprite::create(CCString::createWithFormat("headImg/%d.png",hero.thumb)->getCString());
if (!head)
{
head = CCSprite::create("headImg/101.png");
CCLOG("[ ERROR ] CCommandLayer::showBuildInfo 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);
if (!hero.remove)
{
btn->setEnabled(false);
head->setColor(RGB_GRAY_COLOR);
}
}
CCNode *lab = (CCNode*)m_garrsionLayer->findWidgetById(CCString::createWithFormat("lab%d",i+1)->getCString());
lab->setVisible(false);
}
for (i=ct.heroNum;i<3;i++)
{
CButton *btn = (CButton*)(m_garrsionLayer->getChildByTag(i+1));
btn->setEnabled(false);
CCNode *lab = (CCNode*)m_garrsionLayer->findWidgetById(CCString::createWithFormat("lab%d",i+1)->getCString());
lab->setVisible(false);
}
//runFadeAction(ct);
}
示例4: 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;
}
}
示例5: 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);
// }
//}
}
示例6: updateFuctionOpen
void CMainCityUI::updateFuctionOpen(const TMessage& tMsg)
{
int tag = tMsg.nMsg;
if (tag>20)
{
CCNode *child = m_ui->getChildByTag(tag-20);
if (child)
{
CButton *btn = dynamic_cast<CButton*>(child->getChildByTag(tag-20));
if (btn)
{
btn->setEnabled(true);
btn->getNormalImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault));
btn->getSelectedImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault));
}
}
}
}
示例7: setPayEnable
void CVipCard::setPayEnable(bool isEnable)
{
CButton* pConfirm = (CButton*)m_ui->findWidgetById("confirm");
pConfirm->setEnabled(isEnable);
}