Пример #1
0
CLabelAtlas* TuiManager::createLabelAtlas(float tag, const char* num, const char* imgPath,float x,float y,float w,float h,float rotation){
	CLabelAtlas *pLabAtlas = CLabelAtlas::create(num, imgPath, w / 12, h, 48);
	pLabAtlas->setRotation(rotation);
	pLabAtlas->setPosition(Vec2(x,-y));
	pLabAtlas->setTag(tag);
	return pLabAtlas;
}
Пример #2
0
bool CLabelAtlasTest::onTouchEnded(Ref* pSender, Touch* pTouch, float fDuration)
{
	CLabelAtlas* pText = (CLabelAtlas*) pSender;
	pText->stopActionByTag(1);
	ScaleTo* pScaleTo = ScaleTo::create(0.1f, 1.0f);
	pScaleTo->setTag(1);
	pText->runAction(pScaleTo);

	return true;
}
Пример #3
0
CWidgetTouchModel CLabelAtlasTest::onTouchBegan(Ref* pSender, Touch* pTouch)
{
	CLabelAtlas* pText = (CLabelAtlas*) pSender;
	pText->stopActionByTag(1);
	ScaleTo* pScaleTo = ScaleTo::create(0.1f, 1.3f);
	pScaleTo->setTag(1);
	pText->runAction(pScaleTo);

	return eWidgetTouchTransient;
}
Пример #4
0
void MsgBox::event_slider_test(Ref *pSender,int value)
{
	char buf[128] = {0};
	sprintf(buf,"%d",value);
	CLabelAtlas *pLab = (CLabelAtlas*)this->getControl(PANEL_MSGBOX,LABATLAS_NUM);
	pLab->setString(buf);

	CProgressBar *pProg = (CProgressBar*)this->getControl(PANEL_MSGBOX,PROG_HP);
	pProg->setValue(value);

}
Пример #5
0
CLabelAtlas* CLabelAtlas::create(const char *pString, const char *fntFile)
{
    CLabelAtlas *pRet = new CLabelAtlas();
    if( pRet && pRet->initWithString(pString, fntFile) )
    {
        pRet->autorelease();
        return pRet;
    }
    CC_SAFE_DELETE(pRet);
    return pRet;
}
Пример #6
0
CLabelAtlas* CLabelAtlas::create(const char *pString, const char *charMapFile, unsigned int itemWidth, int unsigned itemHeight, unsigned int startCharMap)
{
    CLabelAtlas *pRet = new CLabelAtlas();
    if( pRet && pRet->initWithString(pString, charMapFile, itemWidth, itemHeight, startCharMap) )
    {
        pRet->autorelease();
        return pRet;
    }
    CC_SAFE_DELETE(pRet);
    return NULL;
}
Пример #7
0
CLabelAtlas* CLabelAtlas::create(const char* pString, const char* fntFile)
{    
    CLabelAtlas *pRet = new CLabelAtlas();
    if( pRet && pRet->initWithString(pString, fntFile) )
    {
		pRet->setTouchEnabled(false);
		pRet->setAnchorPoint(CCWIDGET_BASIC_DEFAULT_ANCHOR_POINT);
		pRet->autorelease();
        return pRet;
    }
	CC_SAFE_DELETE(pRet);
    return pRet;
}
Пример #8
0
CLabelAtlas* CLabelAtlas::create(const char* pString, const char* charMapFile, unsigned int itemWidth, int unsigned itemHeight, unsigned int startCharMap)
{
    CLabelAtlas *pRet = new CLabelAtlas();
    if( pRet && pRet->initWithString(pString, charMapFile, itemWidth, itemHeight, startCharMap) )
    {
		pRet->setTouchEnabled(false);
		pRet->setAnchorPoint(CCWIDGET_BASIC_DEFAULT_ANCHOR_POINT);
        pRet->autorelease();
        return pRet;
    }
    CC_SAFE_DELETE(pRet);
    return NULL;
}
Пример #9
0
CLabelAtlas* CLabelAtlas::create()
{
    // && pRet->initWithString(string, charMapFile, itemWidth, itemHeight, startCharMap)
    CLabelAtlas *pRet = new CLabelAtlas();
    if(pRet)
    {
        //        pRet->initWithString("122223.12", "gui/New/labelatlasimg.png", 12, 32, '.');
        pRet->autorelease();
        return pRet;
    }
    CC_SAFE_DELETE(pRet);

    return NULL;
}
Пример #10
0
bool CLabelAtlasTest::init()
{
	CLabelTestSceneBase::init();
	setTitle("CLabelBasicTest");
	setDescription("CLabelAtlas extern CCLabelAtlas (test event)");

	CLabelAtlas* pText = CLabelAtlas::create(":;0123456789", "num.png", 26, 34, 48);
	pText->setTouchEnabled(true);
	pText->setAnchorPoint(Vec2(0.5, 0.5));
	pText->setPosition(Vec2(480, 320));
	pText->setOnTouchBeganListener(this, ccw_touchbegan_selector(CLabelAtlasTest::onTouchBegan));
	pText->setOnTouchEndedListener(this, ccw_touchevent_selector(CLabelAtlasTest::onTouchEnded));
	pText->setOnTouchCancelledListener(this, ccw_touchevent_selector(CLabelAtlasTest::onTouchEnded));
	m_pWindow->addChild(pText);

	return true;
}
Пример #11
0
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());
				//}
				label->setString(CCString::createWithFormat("+%d",item.itemLevel)->getCString());
			}
		}
		else if (i==6)
		{
			CCSprite *head = (CCSprite*)child;
			if (item.armor.hero>0)
			{
				CCSprite *img = CCSprite::create(getImageName(&item.armor).c_str());
				if(!img)
				{
					img = CCSprite::create("headIcon/101.png");
					CCLOG("ERROR CStrengthenItem::addTableCell");
				}

				CCSprite *mask = (CCSprite*) lay->getChildByTag(7);
				lay->removeChild(mask);
				pCell->addChild(mask);

				img->setScale(0.53f);
				img->setPosition(ccp(head->getContentSize().width/2,head->getContentSize().height/2+14));
				head->addChild(img);
			}
			else
			{
				pCell->removeChild(child);
			}
		}
		else if (i==7)
		{
			pCell->removeChild(child);
		}
		else if (i==8)
		{
			child->setVisible(item.stren);
		}
		else if(i==9)
		{
			if (item.itemLevel==0)
			{
				child->setVisible(false);
			}
			else
			{
				child->setVisible(true);
			}
		}
		else if( i ==10)
		{
			CCNode* pCombatTip = (CCNode*)child;
			pCombatTip->setVisible(item.armor.armorType != 5);
		}
		else if (i==11)
		{
			CLabelAtlas* pLabel = (CLabelAtlas*)child;
			pLabel->setAnchorPoint(ccp(0, 0.5f));
			pLabel->setString(ToString(item.armor.combat));
			pLabel->setVisible(item.armor.armorType != 5);
		}
	}
}
Пример #12
0
CLabelAtlas* TuiManager::createLabelAtlas(float tag,const char* imgPath,float x,float y,float w,float h,float rotation){
	CLabelAtlas *pLabAtlas = CLabelAtlas::create("123456",imgPath,w/12,h,48);
	pLabAtlas->setPosition(Point(x,-y));
	pLabAtlas->setTag(tag);
	return pLabAtlas;
}
Пример #13
0
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);
}