本文整理汇总了C++中CLayout::getChildByTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CLayout::getChildByTag方法的具体用法?C++ CLayout::getChildByTag怎么用?C++ CLayout::getChildByTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLayout
的用法示例。
在下文中一共展示了CLayout::getChildByTag方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addTableCell
void CHeroExpItem::addTableCell(unsigned int uIdx, CTableViewCell * pCell)
{
CLayout *lay = UICloneMgr::cloneLayout(m_cell);
const CEvolQuest &evol = m_evolInfo.questsList.at(uIdx);
const TaskData *task = DataCenter::sharedData()->getTask(Evole_Task)->getCfg(evol.id);
for (int i = 1; i <=4; i++)
{
CCNode *child = lay->getChildByTag(i);
lay->removeChild(child);
pCell->addChild(child);
if (i==1)
{
CImageView *bgView= (CImageView*)child;
bgView->setTouchEnabled(true);
bgView->setUserData(&m_evolInfo.questsList.at(uIdx));
bgView->setOnClickListener(this, ccw_click_selector(CHeroExpItem::onRecvTask));
}
else if (i==2)
{
CLabel *taskName = (CLabel*)child;
taskName->setString(task->taskName.c_str());
}
else if (i==3)
{
CLabel *taskDesc = (CLabel*)child;
taskDesc->setString(task->taskDesc.c_str());
}
else if (i==4)
{
child->setVisible(evol.pass);
}
}
}
示例2: imageLoadSuccessCallBack
void CMainCityUI::imageLoadSuccessCallBack(string sTag, vector<char>* pBuffer)
{
CCImage* img = new CCImage;
img->initWithImageData((unsigned char*)pBuffer->data(), pBuffer->size());
CCTexture2D* texture = new CCTexture2D();
texture->initWithImage(img);
CLayout* headPart = (CLayout*)m_ui->findWidgetById("head_part");
CCSprite* head = (CCSprite*)headPart->getChildByTag(15);
// head->removeFromParent();
//head->setTexture(texture);
string path = HttpLoadImage::getInstance()->getStoragePath("download/fbImg",sTag.c_str())+".jpg";
string buff(pBuffer->begin(), pBuffer->end());
CCLOG("path: %s", path.c_str());
FILE *fp = fopen(path.c_str(), "wb+");
fwrite(buff.c_str(), 1, pBuffer->size(), fp);
fclose(fp);
// CCSprite *headbg = (CCSprite*)(m_ui->findWidgetById("headbg"));
// CCClippingNode *clip = CCClippingNode::create();
// CCSprite *fbimg = CCSprite::createWithTexture(texture);
// clip->addChild(fbimg);
//
// clip->setPosition(headbg->getPosition());
// clip->setContentSize(CCSizeMake(110,110));
//
// static ccColor4F red ={1,0,1};
// float radius = 106;
// const int nCount = 200;
// const float angle = 2.0f* (float)M_PI/nCount;
// CCPoint circle[nCount];
// for(int i=0; i<nCount; i++)
// {
// float radian = i*angle;
// circle[i].x = radius * cosf(radian);
// circle[i].y = radius * sinf(radian);
// }
// CCDrawNode *stencil= CCDrawNode::create();
// stencil->drawPolygon(circle,nCount,red,0,red);
// clip->setStencil(stencil);
// m_ui->addChild(clip);
CCSprite *headBg = (CCSprite *)(headPart->findWidgetById("headbg"));
CCSprite *headSpr = MakeFaceBookHeadToCircle(CCSprite::createWithTexture(texture));
headSpr->setTag(15);
headSpr->setPosition(headBg->getPosition());
headPart->addChild(headSpr);
head->removeFromParent();
img->release();
}
示例3: addGridCell
void CChangeHeadImg::addGridCell(unsigned int uIdx, CGridViewCell* pCell)
{
CLayout *lay = UICloneMgr::cloneLayout(m_cell);
for (int i=1; i<=2; i++)
{
CCNode *child = lay->getChildByTag(i);
lay->removeChild(child);
pCell->addChild(child);
if (i==1)
{
if (m_headIconList.at(uIdx)>0)
{
CImageView* pHead = CImageView::create(CCString::createWithFormat("headImg/%d.png", m_headIconList.at(uIdx))->getCString());
if(!pHead)
{
pHead = CImageView::create("headImg/null.png");
CCLOG("ERROR_____CChangeHeadImg::addGridCell");
}
child->addChild(pHead);
NodeFillParent(pHead);
}
else
{
UserData *data = DataCenter::sharedData()->getUser()->getUserData();
string fbName = data->getFbId() +".jpg";
string fullName = CCFileUtils::sharedFileUtils()->fullPathForFilename(fbName.c_str());
bool isFileExist = CCFileUtils::sharedFileUtils()->isFileExist(fullName);
if(isFileExist)
{
CCSprite* spr =CCSprite::create(fullName.c_str());
child->addChild(spr);
NodeFillParent(spr);
}
}
}
else if(i==2)
{
CImageView* pBtn = (CImageView*)child;
pBtn->setTouchEnabled(true);
pBtn->setUserData(&m_headIconList.at(uIdx));
pBtn->setOnClickListener(this,ccw_click_selector(CChangeHeadImg::onChangHeadImg));
}
}
}
示例4: addTableCell
void LoginLayerUC::addTableCell( unsigned int uIdx, CTableViewCell * pCell )
{
CLayout *lay = UICloneMgr::cloneLayout(m_pCell);
const Server& server = m_serverInfo.server_list().Get(uIdx);
for (unsigned int i=1; i<=4; i++)
{
CCNode *child = lay->getChildByTag(i);
lay->removeChild(child);
child->setTag(i);
pCell->addChild(child);
pCell->setTag(uIdx);
switch (i)
{
case 1:
{
CImageView* pBoard = (CImageView*)child;
pBoard->setTouchEnabled(true);
pBoard->setOnClickListener(this, ccw_click_selector(LoginLayerUC::selectServer));
}
break;
case 3:
{
CLabel* pLabel = (CLabel*)child;
pLabel->setString(server.server_name().c_str());
}
break;
case 4:
{
CLabel* pLabel = (CLabel*)child;
int iShowText[5] = {2002, 1184, 1185, 1186, 1187};
pLabel->setString(GETLANGSTR(iShowText[server.server_status()]));
}
break;
default:
break;
}
}
}
示例5: addGridCell
void CSignLayer::addGridCell(unsigned int uIdx, CGridViewCell* pCell)
{
// CHero *hero = m_currHeroList->at(uIdx);
CSign &sign = m_signData.signList.at(uIdx);
CLayout *lay = UICloneMgr::cloneLayout(m_cell);
pCell->setScale(0.97f);
for (int i = 1; i <=4; i++)
{
CCNode *child = lay->getChildByTag(i);
lay->removeChild(child);
pCell->addChild(child);
}
CImageView *imagView = (CImageView*)pCell->getChildByTag(1);
imagView->setTouchEnabled(true);
imagView->setEnabled(true);
imagView->setUserData(&m_signData.signList.at(uIdx));
imagView->setOnPressListener(this, ccw_press_selector(CSignLayer::onPress));
CCSprite *item = nullptr;
if (sign.prize.thumb>=0)
{
CImageView * pMask = (CImageView*)pCell->getChildByTag(2);
SmartSetRectPrizeColor(pMask, &sign.prize);
item = CCSprite::create(GetImageName(sign.prize.type, sign.prize.color, sign.prize.thumb).c_str());
if(!item)
{
item = CCSprite::create("headImg/101.png");
CCLOG("CSignLayer::addGridCell error load image %d", sign.prize.thumb);
}
item->setPosition(ccp(pMask->getContentSize().width/2, pMask->getContentSize().height/2));
pMask->addChild(item, -1, 2);
item->setScale(0.9f);
//加数字
CCLabelAtlas* haveNum = CCLabelAtlas::create("", "label/no_02.png", 9, 15, 46);
haveNum->setAnchorPoint(ccp(1.0f, 0.0f));
haveNum->setPosition(ccp(85, 5));
pMask->addChild(haveNum, 99, 99);
haveNum->setString(ToString(sign.prize.num));
if(sign.prize.num<=1)
{
haveNum->setVisible(false);
}
//添加星星
if(sign.prize.quality > 0)
{
CLayout* pStarLayout = SmartGetStarLayout(&sign.prize);
pMask->addChild(pStarLayout, 211, 211);
}
}
//vip icon
CCSprite *vip = (CCSprite*)pCell->getChildByTag(3);
if (sign.vip>0)
{
CCTexture2D *texture = CCTextureCache::sharedTextureCache()
->addImage(CCString::createWithFormat("public/vip_%d.png",sign.vip)->getCString());
vip->setVisible(true);
vip->setTexture(texture);
}
else
{
vip->setVisible(false);
}
switch (sign.status)
{
//没签
case 2:
{
//对勾
pCell->getChildByTag(4)->setVisible(false);
//考虑是否加个框标示为可签
if(uIdx == m_signData.sign &&
(m_signData.bCanSign || (m_signData.bCanResign && m_signData.resign>0) ) )
{
CImageView * pMask = (CImageView*)pCell->getChildByTag(2);
CCSprite* pRect = CCSprite::create("common/box_light.png");
pRect->setPosition(ccp(pMask->getPositionX()+pMask->getContentSize().width/2, pMask->getPositionY()+pMask->getContentSize().height/2));
pCell->addChild(pRect, 100);
pRect->runAction(CCRepeatForever::create(CCSequence::createWithTwoActions(CCScaleTo::create(0.3f, 1.03f), CCScaleTo::create(0.3f, 1.0f))));
}
}
break;
//已签
case 1:
{
//对勾
pCell->getChildByTag(4)->setVisible(true);
//变黑
pCell->getChildByTag(1)->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
pCell->getChildByTag(2)->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
//.........这里部分代码省略.........
示例6: 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));
}
//.........这里部分代码省略.........
示例7: 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());
//}
//.........这里部分代码省略.........
示例8: addTableCell
void CCommandLayer::addTableCell(unsigned int uIdx, CTableViewCell * pCell)
{
CCity &data = m_commandData.cityList[uIdx];
CLayout *lay = UICloneMgr::cloneLayout(m_cell);
for (int i=1;i<=6;++i)
{
CCNode *child = lay->getChildByTag(i);
lay->removeChild(child);
pCell->addChild(child);
if (i==1)
{
child->setTag(uIdx+100);
child->setUserData((void*)&m_commandData.cityList[uIdx]);
((CButton*)child)->setOnClickListener(this,ccw_click_selector(CCommandLayer::onSelectCity));
}
else if(i==3)
{
CLabel *name = (CLabel*)child;
name->setString(data.cityName.c_str());
}
else if (i==2)
{
((CButton*)child)->setEnabled(false);
CCSprite *prop = CCSprite::create(CCString::createWithFormat("command/%d.jpg",data.cityId*10)->getCString());
if (prop)
{
prop->setPosition(ccp(child->getContentSize().width/2,child->getContentSize().height/2));
child->addChild(prop,0,1);
}
else
{
prop = CImageView::create("command/30.jpg");
prop->setPosition(ccp(child->getContentSize().width/2,child->getContentSize().height/2));
child->addChild(prop,0,1);
}
}
else if(i==4)
{
CLabel *level = (CLabel*)child;
level->setString(CCString::createWithFormat(GETLANGSTR(230),data.level)->getCString());
}
else if (i==5)
{
UserData *user = DataCenter::sharedData()->getUser()->getUserData();
if (user->getRoleFood()>=data.lvFood)
{
child->setVisible(false);
}
}
else if (i==6)
{
UserData *user = DataCenter::sharedData()->getUser()->getUserData();
if (m_commandData.cityInfo.level>=data.level&&m_commandData.cityInfo.cityId!=data.cityId&&user->getRoleFood()>=data.lvFood)
{
child->setVisible(false);
}
else if(m_commandData.cityInfo.cityId==data.cityId&&user->getRoleFood()>=data.lvFood)
{
child->setVisible(false);
}
}
}
}
示例9: 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"));
//.........这里部分代码省略.........
示例10: updateRoleProperty
void CMainCityUI::updateRoleProperty(const TMessage& tMsg)
{
UserData *user = DataCenter::sharedData()->getUser()->getUserData();
CLayout* headPart = (CLayout*)m_ui->findWidgetById("head_part");
CLabel *nameLabel = (CLabel*)headPart->getChildByTag(10);
nameLabel->setString(user->getRoleName().c_str());
CLabel *level = (CLabel*)(headPart->findWidgetById("level"));
level->setString(CCString::createWithFormat("Lv%d",user->getLevel())->getCString());
CLabelAtlas *vip = (CLabelAtlas*)(headPart->findWidgetById("level_vip"));
vip->setString(ToString(user->getVip()));
if (user->getVip()==0)
{
vip->setVisible(false);
CLabelAtlas *vip_font = (CLabelAtlas*)(headPart->findWidgetById("vip_font"));
vip_font->setVisible(false);
}
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);
// }
// head->setFlipY(false);
CCSprite *headBg = (CCSprite *)(headPart->findWidgetById("headbg"));
CCString *strnName = CCString::createWithFormat("headIcon/%d.png", user->getThumb());
CCSprite *sp = CCSprite::create(strnName->getCString());
sp->setPosition(ccpAdd(headBg->getPosition(),ccp(0,10)));
sp->setScale(0.75f);
headPart->removeChild(head);
sp->setTag(15);
headPart->addChild(sp);
}
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(fullName.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());
}
}
CProgressBar *progressBar = (CProgressBar*)(headPart->getChildByTag(11));
progressBar->setMaxValue(user->getNextExp());
progressBar->startProgress(user->getExp(),0.3f);
}