当前位置: 首页>>代码示例>>C++>>正文


C++ CCLabelAtlas::getTag方法代码示例

本文整理汇总了C++中CCLabelAtlas::getTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLabelAtlas::getTag方法的具体用法?C++ CCLabelAtlas::getTag怎么用?C++ CCLabelAtlas::getTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCLabelAtlas的用法示例。


在下文中一共展示了CCLabelAtlas::getTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadSprites

void LCCrossMatchGame::loadSprites()
{
	// check final game added by LEETAEHO on 111101
	// 두가지 체크 방법이 있음. 하나는 index의 끝 다른 하나는 배열이 비었을때, 일단은 인덱스로 체크
	if (m_iIndex >= m_pIndexArray->count()) {
		this->didFinishedGame();
		return;
	}
	
	// initialize
	for (int i=0; i<m_pLoadedSprites->count(); i++) 
	{
		CCNode* pNode = (CCNode*) m_pLoadedSprites->objectAtIndex(i);
		//pNode->removeFromParentAndCleanup(true);
		CCSequence* seq = CCSequence::actions(CCFadeOut::actionWithDuration(1.0f), 
											  CCCallFuncN::actionWithTarget(this, callfuncN_selector(LCCrossMatchGame::didSpriteAnimated)), 
											  NULL);
		pNode->runAction(seq);
	}
	m_pLoadedSprites->removeAllObjects();
	m_pCanvas->clear(0, 0, 0, 0);
	m_pDotSprites->removeAllObjects();
	m_pFinishedDotSprites->removeAllObjects();
	m_pImageArray->removeAllObjects();
	m_pTextArray->removeAllObjects();
	
	// load texts and images
	CCArray* textLabelArray = CCArray::array();
	CCArray* imageArray = CCArray::array();
	for (int i=0; i<this->getMaxNumberOfItems(); i++) 
	{
		// index 초과시 로딩 안함 added by LEETAEHO on 111101
		if (m_iIndex >= m_pIndexArray->count()) {
			CCLog("index was ended");
			break;
		}
		
		m_iIndex = (m_iIndex + m_pIndexArray->count()) % m_pIndexArray->count();
		
		// 이미지가 있는 단어만 가져오기
		CCSprite* imageSprite = this->getImageWithIndex(m_pIndexArray, m_iIndex);
		if (!imageSprite)
		{
			m_iIndex++;
			i--;
			continue;
		}
		imageSprite->setTag(m_iIndex);
		this->addChild(imageSprite, zIMAGE_SPRITE);
		imageArray->addObject(imageSprite);
		m_pLoadedSprites->addObject(imageSprite);
		
		CCLabelBMFont* textLabel = this->getTextLabelWithIndex(m_pIndexArray, m_iIndex);
		textLabel->setTag(m_iIndex);
		this->addChild(textLabel, zTEXT_LABEL);
		textLabelArray->addObject(textLabel);
		m_pLoadedSprites->addObject(textLabel);
		
		m_iIndex++;
	}
	
	// 배치
	this->arrangeComponents(textLabelArray, imageArray);
	
	//shuffle texts
	//this->shuffleNodes(textLabelArray);
	
	// add dots
	for (int i=0; i<imageArray->count(); i++) {
		CCSprite *imageSprite = (CCSprite *)imageArray->objectAtIndex(i);
		CCSprite *dotSprite = this->getDotSprite();
		dotSprite->setTag(imageSprite->getTag());
		dotSprite->setPosition(ccp(imageSprite->getPosition().x + this->getDotDistanceWithImage(), imageSprite->getPosition().y));
		this->addChild(dotSprite, zDOT_SPRITE);
		m_pDotSprites->addObject(dotSprite);
		m_pLoadedSprites->addObject(dotSprite);
	}
	
	for (int i=0; i<textLabelArray->count(); i++) {
		CCLabelAtlas *characterLabel = (CCLabelAtlas *)textLabelArray->objectAtIndex(i);
		CCSprite *dotSprite = this->getDotSprite();
		dotSprite->setTag(characterLabel->getTag());
		dotSprite->setPosition(ccp(characterLabel->getPosition().x + this->getDotDistanceWithTextLabel(), characterLabel->getPosition().y));
		this->addChild(dotSprite, zDOT_SPRITE);
		m_pDotSprites->addObject(dotSprite);
		m_pLoadedSprites->addObject(dotSprite);
	}
	
	// add arrays of images and texts
	m_pImageArray->addObjectsFromArray(imageArray);
	m_pTextArray->addObjectsFromArray(textLabelArray);
	
	
	// fade in animation
	for (int i=0; i < m_pLoadedSprites->count(); i++) 
	{
		CCSprite *loadedSprite = (CCSprite *)m_pLoadedSprites->objectAtIndex(i);
		loadedSprite->runAction(CCFadeIn::actionWithDuration(1.0f));
	} 
}
开发者ID:,项目名称:,代码行数:100,代码来源:


注:本文中的CCLabelAtlas::getTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。