本文整理汇总了C++中CButton::getNormalImage方法的典型用法代码示例。如果您正苦于以下问题:C++ CButton::getNormalImage方法的具体用法?C++ CButton::getNormalImage怎么用?C++ CButton::getNormalImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CButton
的用法示例。
在下文中一共展示了CButton::getNormalImage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateOpenState
void CMainCityUI::updateOpenState(CityData *cityData)
{
int size = cityData->cityList.size();
for (int i = 0; i <size; i++)
{
CCity *city = &cityData->cityList.at(i);
//是否刚打开功
bool justOpen = false;
if (city->cityId>20)
{
justOpen = CMainCityControl::getInstance()->isJustOpen(city);
}
if ((city->cityId>20&&!city->isOpen)||justOpen)
{
CCNode *child = m_ui->getChildByTag(city->cityId-20);
if (child)
{
CButton *btn = dynamic_cast<CButton*>(child->getChildByTag(city->cityId-20));
if (btn)
{
//btn->setEnabled(false);
btn->getNormalImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
btn->getSelectedImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
}
}
}
m_cityMap[city->cityId] = *city;
}
}
示例2: addTableCell
void CSharpTollgate::addTableCell(unsigned int uIdx, CTableViewCell * pCell)
{
const vector<StageWidget> *data = DataCenter::sharedData()->getStageData()
->getStageWidgets(m_chapter);
CStage &stage = m_stageList.at(uIdx);
for (int i = 0; i < 2; i++)
{
CCNode * node = (CCNode*)m_cell->getChildren()->objectAtIndex(i);
if (node->getTag()==1)
{
const StageWidget *widget = nullptr;
CCString *strId = CCString::createWithFormat("hero%d",uIdx+1);
for (int j=0; j<data->size();++j)
{
widget = &data->at(j);
if (widget->widgetId!=""&&widget->widgetId.compare(strId->getCString())==0)
{
CButton *btn = CButton::create(widget->normalImage.c_str());
btn->setScaleX(widget->scaleX);
btn->setScaleY(widget->scaleY);
btn->setPosition(ccp(100, 80/*btn->boundingBox().size.height*/));
btn->setAnchorPoint(ccp(0.5, 0.0));
btn->setUserData(&m_stageList.at(uIdx));
btn->setOnClickListener(this,ccw_click_selector(CSharpTollgate::onBattle));
btn->setTag(1);
pCell->addChild(btn);
if (!stage.isOpen)
{
btn->getNormalImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
// btn->getSelectedImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
}
break;
}
}
}
else if (node->getTag()==2)
{
CImageView *image = UICloneMgr::cloneImageView((CImageView*)node);
if (stage.star>0)
{
image->setTexture(CCTextureCache::sharedTextureCache()->addImage(CCString::createWithFormat("tollgate/star_%d.png",stage.star)->getCString()));
}
else
{
image->setTexture(CCTextureCache::sharedTextureCache()->addImage("tollgate/star_3.png"));
image->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
}
image->setAnchorPoint(ccp(0.5f,0));
pCell->addChild(image);
}
}
pCell->setVisible(false);
pCell->setScale(1.15f);
pCell->runAction(CCSequence::create(CCDelayTime::create(0.1f+0.15f*uIdx),CCShow::create(),CCScaleTo::create(0.05f,1.0f),CCCallFuncN::create(this,callfuncN_selector(CSharpTollgate::heroCall)),nullptr));
}
示例3: 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));
}
}
}
}
示例4: 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");
}
示例5: onEnter
void CMainCityUI::onEnter()
{
BaseLayer::onEnter();
UserData *user = DataCenter::sharedData()->getUser()->getUserData();
//角色信息相对位置处理
CLayout* headPart = (CLayout*)m_ui->findWidgetById("head_part");
headPart->setPosition(m_ui->convertToNodeSpace(ccp(VLEFT+headPart->getContentSize().width/2, VTOP-headPart->getContentSize().height/2)));
//显示角色名,等级,体力,金币
CLabel *nameLabel = (CLabel*)headPart->getChildByTag(10);
nameLabel->setString(user->getRoleName().c_str());
nameLabel->setColor(RGB_ROLE_COLOR);
CLabel *level = (CLabel*)(headPart->findWidgetById("level"));
level->setString(CCString::createWithFormat("Lv%d",user->getLevel())->getCString());
CProgressBar *progressBar = (CProgressBar*)(headPart->getChildByTag(11));
progressBar->setMaxValue(user->getNextExp());
progressBar->startProgress(user->getExp(),0.3f);
CLabelAtlas *vip_level = (CLabelAtlas*)(headPart->findWidgetById("level_vip"));
vip_level->setString(ToString(user->getVip()));
if (user->getVip()==0)
{
vip_level->setVisible(false);
CLabelAtlas *vip_font = (CLabelAtlas*)(headPart->findWidgetById("vip_font"));
vip_font->setVisible(false);
}
CImageView *headbg = (CImageView *)(headPart->findWidgetById("headbg"));
headbg->setTouchEnabled(true);
headbg->setOnClickListener(this, ccw_click_selector(CMainCityUI::onHeadImgBtn));
CButton *button = nullptr;
int i = 1;
for (; i<=9; ++i)
{
CCNode *lay = dynamic_cast<CCNode*>( m_ui->getChildByTag(i));
button = dynamic_cast<CButton*>(lay->getChildByTag(i));
// button->setEnabled(false);
button->setOnClickListener(this, ccw_click_selector(CMainCityUI::onClickBtn));
button->setSelectedTexture(((CCSprite*)(button->getNormalImage()))->getTexture());
button->getSelectedImage()->setScale(1.1f);
m_btnPos[i] = button->getPosition();
}
CCSprite* head = (CCSprite*)headPart->getChildByTag(15);
if (user->getThumb()>0)
{
CCTexture2D *texture = CCTextureCache::sharedTextureCache()
->addImage(CCString::createWithFormat("headIcon/%d.png", user->getThumb())->getCString());
if (texture)
{
head->setTexture(texture);
}
}
else
{
string fbName = user->getFbId()+".jpg";
string fullName = CCFileUtils::sharedFileUtils()->fullPathForFilename(fbName.c_str());
bool isFileExist = CCFileUtils::sharedFileUtils()->isFileExist(fullName);
if(isFileExist)
{
CCSprite *headBg = (CCSprite *)(headPart->findWidgetById("headbg"));
CCSprite *sp = CCSprite::create(fbName.c_str());
CCSprite* spr = MakeFaceBookHeadToCircle(sp);
spr->setPosition(headBg->getPosition());
headPart->removeChild(head);
spr->setTag(15);
headPart->addChild(spr);
}
else
{
HttpLoadImage::getInstance()->bindUiTarget(this);
CCString *imgUrl = CCString::createWithFormat(FACEBOOKIMG_106,user->getFbId().c_str());
HttpLoadImage::getInstance()->requestUrlImage(imgUrl->getCString(),user->getFbId().c_str());
}
}
CImageView* vip = (CImageView*)headPart->findWidgetById("vip");
vip->setTouchEnabled(true);
vip->setOnClickListener(this,ccw_click_selector(CMainCityUI::onVip));
//添加签到,充值等其他入口
CAccessLayer* pAccess = CAccessLayer::create();
this->addChild(pAccess, 99);
CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_HERO,this,GameMsghandler_selector(CMainCityUI::updateRoleProperty));
CSceneManager::sharedSceneManager()->addMsgObserver(TASK_NOTICE,this,GameMsghandler_selector(CMainCityUI::updateTaskNotice));
CSceneManager::sharedSceneManager()->addMsgObserver(MAIL_NOTICE,this,GameMsghandler_selector(CMainCityUI::updateMailNotice));
CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_FUNCTIONOPEN,this,GameMsghandler_selector(CMainCityUI::updateFuctionOpen));
CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_GAMETIP,this,GameMsghandler_selector(CMainCityUI::updateGameTip));
CSceneManager::sharedSceneManager()->addMsgObserver(SHOW_HEAD,this,GameMsghandler_selector(CMainCityUI::showHead));
CCSprite *red = (CCSprite*)(m_ui->findWidgetById("redPoint"));
CCSprite *mailPoint = (CCSprite*)(m_ui->findWidgetById("mailPoint"));
//.........这里部分代码省略.........