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


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

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


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

示例1: showGameOver

void GameScene::showGameOver() {
    CCSprite* over = CCSprite::createWithSpriteFrameName("gameOver.png");
    over->setPosition(ccp(screenSize.width * 0.5f, screenSize.height * 0.7f));
    over->setScale(1.5f);
    addChild(over, 10);
    
    CCSprite* scoreBoard = CCSprite::createWithSpriteFrameName("score_board.png");
    scoreBoard->setPosition(ccp(screenSize.width * 0.5f, screenSize.height * 0.5f));
    scoreBoard->setScale(1.5f);
    addChild(scoreBoard, 10);
    
    CCLabelAtlas* curScore = CCLabelAtlas::create(CCString::createWithFormat("%d", gameScore)->getCString(), "score_number.png", 30, 45, '0');
    curScore->setAnchorPoint(ccp(1, 0.5f));
    curScore->setScale(0.75f);
    curScore->setPosition(ccp(screenSize.width * 0.78f, screenSize.height * 0.53f));
    addChild(curScore, 10);
    
    int maxScore = CCUserDefault::sharedUserDefault()->getIntegerForKey("MAX", 0);
    if (gameScore > maxScore) {
        maxScore = gameScore;
        CCUserDefault::sharedUserDefault()->setIntegerForKey("MAX", gameScore);
        CCUserDefault::sharedUserDefault()->flush();
        CCSprite* showNew = CCSprite::createWithSpriteFrameName("new.png");
        showNew->setAnchorPoint(ccp(0, 0.5f));
        showNew->setScale(1.5f);
        showNew->setPosition(ccp(screenSize.width * 0.78f, screenSize.height * 0.45f));
        addChild(showNew, 10);
    }
    
    CCLabelAtlas* highScore = CCLabelAtlas::create(CCString::createWithFormat("%d", maxScore)->getCString(), "score_number.png", 30, 45, '0');
    highScore->setAnchorPoint(ccp(1, 0.5f));
    highScore->setScale(0.75f);
    highScore->setPosition(ccp(screenSize.width * 0.78f, screenSize.height * 0.45f));
    addChild(highScore, 10);
    
    removeChildByTag(999);
    
    CCMenuItemSprite* item = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("start.png"), CCSprite::createWithSpriteFrameName("start.png"), this, menu_selector(GameScene::restart));
    item->setPosition(ccp(screenSize.width * 0.5f, screenSize.height * 0.3f));
    CCMenu* menu = CCMenu::create(item, NULL);
    menu->setPosition(CCPointZero);
    addChild(menu, 10);
    
    if (gameScore >= 10) {
        CCSprite* metalName = NULL;
        if (gameScore >= 10 && gameScore < 50) {
            metalName = CCSprite::createWithSpriteFrameName("medals_1.png");
        } else if (gameScore >= 50 && gameScore < 100) {
            metalName = CCSprite::createWithSpriteFrameName("medals_2.png");
        } else if (gameScore >= 100) {
            metalName = CCSprite::createWithSpriteFrameName("medals_3.png");
        }
        metalName->setScale(1.5f);
        metalName->setPosition(ccp(screenSize.width * 0.3f, screenSize.height * 0.495f));
        addChild(metalName, 10);
    }
}
开发者ID:eclipsezym,项目名称:Cocos2d-x_studying,代码行数:57,代码来源:GameScene.cpp

示例2: initLabelAtlas

void MarketScene::initLabelAtlas()
{
	CCSprite *sprite = CCSprite::create(s_pathMarketTomato.m_strPath);
	sprite->setPosition(s_pathMarketTomato.m_Position);
	addChild(sprite);

	CCLabelAtlas *pTextLabel = g_Control.creatLabelAtlas(g_Control.m_nCoin, s_pNumMarketCoin, this, LabelAtlas_COIN);
	pTextLabel->setPosition(s_pNumMarketCoin.m_Position);

	pTextLabel = g_Control.creatLabelAtlas(PRICE_CHANGE_QUESTION, s_pNumMarketCoin, this, LabelAtlas_PRICE);
	pTextLabel->setPosition(ccp(s_pNumMarketCoin.m_Position.x, s_pNumMarketCoin.m_Position.y - 260));
}
开发者ID:hyper123,项目名称:TurboSnail,代码行数:12,代码来源:MarketScene.cpp

示例3: tenSecondsCallback

void SecondLevel::tenSecondsCallback(float dt)
{
	time -= dt;
	if (time < 1)
	{
		CCDictionary *dict = CCDictionary::createWithContentsOfFile("/word/words.xml");
		const char *lose_word = ((CCString*)dict->objectForKey("lose"))->m_sString.c_str();
		CCLabelTTF *lose = CCLabelTTF::create(lose_word, "Arial", 24);
		lose->setColor(ccc3(255, 0, 0));
		lose->setPosition(ccp(150, 150));
		result->addChild(lose);

		int score = userDefault->getIntegerForKey("score");

		stringstream ss;
		ss << (score);
		CCLabelAtlas *lable = CCLabelAtlas::create(ss.str().c_str(), "/pic/numbers.png", 23, 26, '0');
		lable->setPosition(ccp(150, 100));
		result->addChild(lable);

		result->setVisible(true);
		this->unschedule(schedule_selector(SecondLevel::tenSecondsCallback));
	}
	char time_str[20];
	sprintf(time_str, "%d", (int)time);
	CCLabelBMFont *label1 = (CCLabelBMFont *)this->getChildByTag(15);
	label1->setString(time_str);
}
开发者ID:xujqiao,项目名称:ultraBrain,代码行数:28,代码来源:SecondLevel.cpp

示例4: addMapBtnWith

CCSprite* LevelScene::addMapBtnWith(int no, cocos2d::CCPoint pos, CCSpriteBatchNode* batch)
{
    CCSprite *map = NULL;
    CCSprite *lockSprite = NULL;
    CCLabelAtlas *mapNo = CCLabelAtlas::create("0123456789", "fonts_score_002-hd.png", 38, 44, '0');

    if (FruitCrush::shareSingleton()->canPlayMap(no)) {
        map = CCSprite::createWithTexture(batch->getTexture());
        map->setTag(no);
        //map->setScale(0.6);
        CCString* num = CCString::createWithFormat("%u", no);
        mapNo->setString(num->getCString());
        //mapNo->setColor(ccc3(242, 247, 240));
        mapNo->setAnchorPoint(ccp(0.5f,0.5f));
        mapNo->setPosition(ccp(map->boundingBox().size.width/2, map->boundingBox().size.height/2));
        map->addChild(mapNo);
        //this->addChild(mapNo);
    }
    else
    {
        
    }
    
    map->setPosition(pos);
    map->setScale(0.8);
    this->addChild(map);
    return map;
    
}
开发者ID:lioneltsai,项目名称:fruitCrush,代码行数:29,代码来源:LevelScene.cpp

示例5: CreateAddBloodLabel

CCLabelAtlas* DamageValueEffect::CreateAddBloodLabel(unsigned int blood,CCPoint parentPos)
{
	CCPoint uiPos = parentPos;
	char damageString[10];
	sprintf(damageString,"%d",blood);
	CCLabelAtlas* lable = CCLabelAtlas::create(damageString,"UI/ui_numble_4.png",41,43,48);

	lable->setPosition(uiPos.x,uiPos.y);
	lable->setAnchorPoint(ccp(0.5,0.5));
	lable->setScale(0);
	CCActionInterval* actionScale = CCScaleTo::create(0.01f,2);
	CCActionInterval* actionMove = CCMoveBy::create(0.01f,ccp(0,40));
	CCSpawn* FirstAction = CCSpawn::createWithTwoActions(actionScale,actionMove);
	CCActionInterval* actionFade = CCFadeOut::create(1.0f);
	CCActionInterval* bezierAction = CCMoveBy::create(1.0f,ccp(0,80));
	CCSpawn* SecondAction = CCSpawn::createWithTwoActions(bezierAction,actionFade);
	lable->runAction(CCSequence::create(FirstAction,CCScaleTo::create(0.05f,0.7f),CCDelayTime::create(0.2f),SecondAction,
		NULL));
	if(m_pDamageLabels->find(lable) == m_pDamageLabels->end())
	{
		m_pDamageLabels->insert(make_pair(lable,1.3f));
		if(GameManager::Get()->GetSceneLayer() != NULL && GameManager::Get()->GetSceneLayer()->getLevelLayer() != NULL
			&& GameManager::Get()->GetSceneLayer()->getLevelLayer()->getObjectLayer())
		{
			GameManager::Get()->GetSceneLayer()->getLevelLayer()->getObjectLayer()->addChild(lable,MAP_Z_OBJ_TOP);
		}
	}
	return lable;
}
开发者ID:JamShan,项目名称:xcode_jifengyongzhezhuan,代码行数:29,代码来源:DamageValueEffect.cpp

示例6: spriteWithFile

ItemCard* ItemCard::spriteWithFile(const char *normalImage, string id, short cardNum)
{
    ItemCard* pRet = new ItemCard(id, cardNum);
    
    if ((normalImage == NULL) || (*normalImage == 0)) {
        normalImage = "box_none.png";
    }
    
    if (pRet && pRet->initWithFile(normalImage))
    {
        pRet->autorelease();
        
        char buf[30];
        sprintf(buf, "/%d",cardNum);
        
        CCSprite* spTmp = CCSprite::spriteWithFile("rewardnum.png");
        if(spTmp){
            CCSize sz = spTmp->getContentSize();
            CCLabelAtlas* textNum = CCLabelAtlas::labelWithString(buf,
                                                                      "rewardnum.png",
                                                                      sz.width / 11,
                                                                      sz.height,
                                                                      '/');
            textNum->setAnchorPoint(ccp(0.5, 0.5));
            textNum->setPosition(ccp(54,10));
            pRet->addChild(textNum,0,9);
        }
        
        return pRet;
    }
    
    CC_SAFE_DELETE(pRet);
    return NULL;
}
开发者ID:haoliumilan,项目名称:AgainstSango,代码行数:34,代码来源:ItemCard.cpp

示例7: CCPointMake

ParticleDemo::ParticleDemo(void)
{
	initWithColor( ccc4(127,127,127,255) );

	m_emitter = NULL;

	setIsTouchEnabled( true );
	
	CCSize s = CCDirector::sharedDirector()->getWinSize();
	CCLabelTTF* label = CCLabelTTF::labelWithString(title().c_str(), "Arial", 28);
	addChild(label, 100, 1000);
	label->setPosition( CCPointMake(s.width/2, s.height-50) );
	
	CCLabelTTF *tapScreen = CCLabelTTF::labelWithString("(Tap the Screen)", "Arial", 20);
	tapScreen->setPosition( CCPointMake(s.width/2, s.height-80) );
	addChild(tapScreen, 100);
	
	CCMenuItemImage* item1 = CCMenuItemImage::itemFromNormalImage(s_pPathB1, s_pPathB2, this, menu_selector(ParticleDemo::backCallback) );
	CCMenuItemImage* item2 = CCMenuItemImage::itemFromNormalImage(s_pPathR1, s_pPathR2, this, menu_selector(ParticleDemo::restartCallback) );
	CCMenuItemImage* item3 = CCMenuItemImage::itemFromNormalImage(s_pPathF1, s_pPathF2,  this, menu_selector(ParticleDemo::nextCallback) );
	
	CCMenuItemToggle* item4 = CCMenuItemToggle::itemWithTarget(	this, 
																menu_selector(ParticleDemo::toggleCallback), 
																CCMenuItemFont::itemFromString( "Free Movement" ),
                                                                CCMenuItemFont::itemFromString( "Relative Movement" ),
																CCMenuItemFont::itemFromString( "Grouped Movement" ),
																NULL );
	
	CCMenu *menu = CCMenu::menuWithItems(item1, item2, item3, item4, NULL);
		
	menu->setPosition( CCPointZero );
	item1->setPosition( CCPointMake( s.width/2 - 100,30) );
	item2->setPosition( CCPointMake( s.width/2, 30) );
	item3->setPosition( CCPointMake( s.width/2 + 100,30) );
	item4->setPosition( CCPointMake( 0, 100) );
	item4->setAnchorPoint( CCPointMake(0,0) );

	addChild( menu, 100 );	
	
    CCLabelAtlas* labelAtlas = CCLabelAtlas::labelWithString("0000", "fonts/fps_images.png", 16, 24, '.');
    addChild(labelAtlas, 100, kTagLabelAtlas);
	labelAtlas->setPosition( CCPointMake(s.width-66,50) );
	
	// moving background
	m_background = CCSprite::spriteWithFile(s_back3);
	addChild(m_background, 5);
	m_background->setPosition( CCPointMake(s.width/2, s.height-180) );

	CCActionInterval* move = CCMoveBy::actionWithDuration(4, CCPointMake(300,0) );
	CCActionInterval* move_back = move->reverse();
	CCFiniteTimeAction* seq = CCSequence::actions( move, move_back, NULL);
	m_background->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq) );
	
	
	schedule( schedule_selector(ParticleDemo::step) );
}
开发者ID:Openxlive,项目名称:cocos2d-x-win8-tests-metro-style,代码行数:56,代码来源:ParticleTest.cpp

示例8: displayScore

void SelectLevel::displayScore()
{
	stringstream ss;
	ss << (score);
	CCLabelAtlas *lable = CCLabelAtlas::create(ss.str().c_str(), "/pic/numbers.png", 23, 26, '0');

	CCLabelTTF *s_score = CCLabelTTF::create("SCORE:", "Arial", 34);
	s_score->setPosition(ccp(winSize.width / 2 - 80, 44));
	s_score->setColor(ccc3(255, 0, 0));
	lable->setPosition(ccp(winSize.width / 2, 30));

	this->addChild(s_score, 1);
	this->addChild(lable, 1);
}
开发者ID:xujqiao,项目名称:ultraBrain,代码行数:14,代码来源:SelectLevelScene.cpp

示例9: showPromptScore

void ScoreCenter::showPromptScore(int score, CCPoint ppoint)
{
    CCString* curScore = CCString::createWithFormat("%u", score);
    CCLabelAtlas* label = ResCenter::shareInstance()->getLableAtlasByType(ResCenter::klableScore);
    label->setPosition(ppoint);
    //label->setScale(0.5);
    label->setString(curScore->getCString());
    
    CCFiniteTimeAction* sf = ActionEffectHub::shareInstance()->scoreFly();
    CCFiniteTimeAction* cb = CCCallFuncN::create(this, callfuncN_selector(ScoreCenter::_removeScorePrompt));

    CCSequence* cbSeq = CCSequence::create(sf, cb, NULL);
    label->runAction(cbSeq);
    this->getLayer()->addChild(label);
}
开发者ID:lioneltsai,项目名称:fruitCrush,代码行数:15,代码来源:ScoreCenter.cpp

示例10: sprintf

CCMenuItemSprite *CWaterpump::initMenuItemWithFiles(int type, const char *normal, const char *selected, const char *disable, SEL_MenuHandler selector)
{
    CCSprite *pNormal = CCSprite::create(normal);
    CCSprite *pSelected = CCSprite::create(selected);
    CCSprite *pDisable = CCSprite::create(disable);

    CCMenuItemSprite *pItem = CCMenuItemSprite::create(pNormal, pSelected, pDisable, this, selector);
    int cnt = CPlayerAccount::GetAccountInstance()->GetAccountPropsNum(type);
    char szCntStr[8] = {0};
    sprintf(szCntStr, "%d", cnt);
    CCLabelAtlas *pCntFnt = CCLabelAtlas::create(szCntStr, "UI_02_05.png", 48, 57, '0');
    pCntFnt->setAnchorPoint(ccp(1, 0));
    pCntFnt->setPosition(ccp(pItem->getContentSize().width, 0));
    pItem->addChild(pCntFnt, 1, Tag_ItemFnt);
    pItem->setTag(type);
    return pItem;
}
开发者ID:gziproject,项目名称:DragonSlayer,代码行数:17,代码来源:Waterpump.cpp

示例11: ccTouchBegan

bool GameScene::ccTouchBegan(CCTouch* pTouch, CCEvent* pEvent) {
    if (isGameOver) {
        return true;
    }
    
    if (isShowingHint) {
        removeChildByTag(TAG_HINT, true);
        isShowingHint = false;
        
        CCSprite* bird = (CCSprite*)getChildByTag(TAG_BIRD);
        if (bird) {
            bird->stopAllActions();
            
            CCAnimation* animation = CCAnimation::create();
            for (int i = 0; i < 3; i++) {
                CCString* birdName = CCString::createWithFormat("bird%d_%d.png", birdID, i);
                CCSpriteFrame* frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(birdName->getCString());
                animation->addSpriteFrame(frame);
            }
            animation->setDelayPerUnit(0.08f);
            CCAnimate* animate = CCAnimate::create(animation);
            CCRepeatForever* repeat = CCRepeatForever::create(animate);
            bird->runAction(repeat);
        }
        CCLabelAtlas* score = CCLabelAtlas::create("0", "score_number.png", 30, 45, '0');
        score->setAnchorPoint(ccp(0.5f, 0.5f));
        score->setPosition(ccp(screenSize.width * 0.5f, screenSize.height * 0.85f));
        score->setScale(1.5f);
        addChild(score, 10, 999);
        
        schedule(schedule_selector(GameScene::pipeCreate), 1.5f, 99999, 2.0f);
        scheduleUpdate();
    }
    
    birdFlyLogic();
    
    return true;
}
开发者ID:eclipsezym,项目名称:Cocos2d-x_studying,代码行数:38,代码来源:GameScene.cpp

示例12: displayLevels

void SelectLevel::displayLevels()
{
	stringstream ss;
	CCLabelAtlas *lable = NULL;
	MyButton *but = NULL;
	string str_level, str_description;
	CCScene *scene = NULL;

	int max_level = userDefault->getIntegerForKey("max_level");
	float xPosition = CONSTANT->getFirstLevelPosition()[0];
	float yPosition = CONSTANT->getFirstLevelPosition()[1];
	CCDictionary *dict = CCDictionary::createWithContentsOfFile("/word/words.xml");
	
	for (int i = 0; i < max_level; i++)
	{
		ss << (i + 1);
		lable = CCLabelAtlas::create(ss.str().c_str(), "/pic/numbers.png", 23, 26, '0');

		but = MyButton::createWithTexture(IMAGEPOOL->textureForKey("/pic/level.png"));
		but->setTag(0);
		
		scene = CONSTANT->getAllLevels()[i];
		but->setNavigation(scene);

		but->addChild(lable);
		lable->setPosition(ccp(25, 25));

		but->setPosition(ccp(xPosition + i % 4 * 84, yPosition - i / 4 * 83));
		this->addChild(but, 1);

		ss.str("");

	}

	Constant::isSetLevel = false;

}
开发者ID:xujqiao,项目名称:ultraBrain,代码行数:37,代码来源:SelectLevelScene.cpp

示例13: displayRanking

////////////////////////////////////////////////////////////////////////////////
/// \brief      Rangking 값을 읽어와 표시
////////////////////////////////////////////////////////////////////////////////
void JS_Result::displayRanking(float dt)
{
	// CCUserDefault 에서 key값으로 랭킹값을 읽어서 순위를 표시한다.
	SANG_GAME_RANK rank[JS_MAX_RANK];

	SANG_RANK_KEY key[JS_MAX_RANK];
	
	for ( int k = 0; k < JS_MAX_RANK; k++ )
	{
		if ( EASY == m_nGameLevel )
		{
			sprintf(key[k].rank_key, "js_easy_rank%d", k+1);
			sprintf(key[k].time_key, "js_easy_time%d", k+1);
			sprintf(key[k].date_key, "js_easy_date%d", k+1);
		}
		else
		{
			sprintf(key[k].rank_key, "js_hard_rank%d", k+1);
			sprintf(key[k].time_key, "js_hard_time%d", k+1);
			sprintf(key[k].date_key, "js_hard_date%d", k+1);
		}
	}

	int nTime = 0;
	std::string strZero = "0";
	// Get Rank data
	for ( int r = 0; r < JS_MAX_RANK; r++ )
	{
		sprintf(rank[r].rank, "%d", r+1);
		nTime = CCUserDefault::sharedUserDefault()->getIntegerForKey(key[r].time_key);
		sprintf(rank[r].time, "%d", nTime);
		sprintf(rank[r].date, "%d", nTime);//CCUserDefault::sharedUserDefault()->getStringForKey(key[r].date_key, strZero.c_str()).c_str());
	}

	int nTemp = 0;
	for ( int i = 0; i < JS_MAX_RANK; i++ )
	{
		nTemp = atof(rank[i].time);
		if ( nTemp != 0 && nTemp >= m_nPlayTime || nTemp == 0)
		{
			//int nRet = 0;
			if (nTemp != 0 && nTemp != m_nPlayTime)
			{
				for ( int k = JS_MAX_RANK-1; k > i; k-- )
				{
					sprintf(rank[k].date, "%s", rank[k-1].date);
					sprintf(rank[k].time, "%s", rank[k-1].time);
				}
			}

			time_t t = time(0);
			struct tm *aTime = localtime(&t);

			// Month is 0 - 11, add 1 to get a jan-dec 1-12 concept
			// Year is # years since 1900
			sprintf(rank[i].date, "%04d-%02d-%02d", aTime->tm_year + 1900, aTime->tm_mon + 1 , aTime->tm_mday);
			sprintf(rank[i].time, "%d", m_nPlayTime);
			m_nRank = i + 1;

			// Update Rank Data
			for ( int u = 0; u < JS_MAX_RANK; u++ )
			{
				CCUserDefault::sharedUserDefault()->setIntegerForKey(key[u].rank_key, u+1);
				CCUserDefault::sharedUserDefault()->setStringForKey(key[u].time_key, rank[u].time);
				CCUserDefault::sharedUserDefault()->setStringForKey(key[u].date_key, rank[u].date);
			}
			CCUserDefault::sharedUserDefault()->flush();
			break;
		}
		m_nRank = -1;	// 순위 밖
	}
	
	char cRankData[100];
	for ( int i = 0; i < JS_MAX_RANK; i++ )
	{
		// 랭킹 데이터 출력
		CCLabelAtlas *pRankLabel = new CCLabelAtlas();
		if ( atof(rank[i].rank) < 10 && atof(rank[i].time) < 10 )
			sprintf(cRankData,"%s		       %s		     %s",rank[i].rank, rank[i].time, rank[i].date);
		else if ( atof(rank[i].rank) < 10 && atof(rank[i].time) >= 10 )
			sprintf(cRankData,"%s		       %s		    %s",rank[i].rank, rank[i].time, rank[i].date);
		else if ( atof(rank[i].rank) >= 10 && atof(rank[i].time) < 10 )
			sprintf(cRankData,"%s		      %s		     %s",rank[i].rank, rank[i].time, rank[i].date);
		else
			sprintf(cRankData,"%s		      %s		    %s",rank[i].rank, rank[i].time, rank[i].date);

		if ( m_nRank == i + 1 )
			pRankLabel->initWithString(cRankData, "common/game/num_font_red.png", 24, 32, '0');
		else
			pRankLabel->initWithString(cRankData, "common/game/num_font_white.png", 24, 32, '0');

		CCPoint ptRankData;
		ptRankData.x = RANK_X;
		ptRankData.y = RANK_Y - (pRankLabel->getContentSize().height * i);
		pRankLabel->setPosition(ptRankData);

		this->addChild(pRankLabel, 400+i);
//.........这里部分代码省略.........
开发者ID:faransae,项目名称:Classes,代码行数:101,代码来源:JS_Result.cpp

示例14: initButton

void SectionItem::initButton(SectionItem* button,bool canChoose)
{
	button->canChoose = canChoose;
	ResManager* resMgr = ResManager::getManager();
	
	if (!canChoose)
	{
		initWithFile(resMgr->getSharedFilePath(g_seasonlayerPath+"sectionItem_lock_bg.png").c_str());
		//屏蔽剧情道具相关
/*		JuqingDaoJu data;
		if (JuqingDaoJuManager::getManager()->getItemInSection(seasonId, sectionId, data))
		{
			CCSprite *img = CCSprite::create("sectionItem_daoju_weihuode.png");
			addChild(img);
			img->setPosition(ccp(getContentSize().width-7, getContentSize().height));
		}
*/
	}else
	{
		char fileName[128];
		sprintf(fileName, (resMgr->getSharedFilePath()+g_seasonlayerPath+"sectionItem_%d_bg.png").c_str(),button->currentScore);
		initWithFile(fileName);
		if (button->currentScore == 0)
		{
			CCSprite *ef = CCSprite::create(resMgr->getSharedFilePath(g_seasonlayerPath+"sectionItem_new_bg.png").c_str());
			addChild(ef);
			ef->setPosition(ccp(ef->getContentSize().width/2, ef->getContentSize().height/2 - 3));
			ef->runAction(CCRepeatForever::create(CCSequence::create(CCFadeOut::create(1.5f), CCFadeIn::create(1.5f), NULL)));
		}
		//屏蔽剧情道具相关
/*		JuqingDaoJu data;
		if (JuqingDaoJuManager::getManager()->getItemInSection(seasonId, sectionId, data) && data.state != DJS_NotGetted)
		{
			CCSprite *img = CCSprite::create(resMgr->getSharedFilePath(g_daojuPath+data.fileName).c_str());
			addChild(img);
			img->setPosition(ccp(getContentSize().width/2, 120));
			img->setScale(0.75f);
		}
		*/
		if (false)
		{
		}
		else 
		{
	
			CCLabelAtlas* lable = CCLabelAtlas::create(
				"0123456789",
				resMgr->getSharedFilePath(g_seasonlayerPath+"season_section_num.png").c_str(),
				40, 49,//24
				'0');
			addChild(lable);
			char id[5];
			sprintf(id,"%d",button->sectionId);
			lable->setString(id);
			lable->setPosition(ccp(getContentSize().width/2 - lable->getContentSize().width/2,90));
			
			//屏蔽剧情道具相关
/*			if (JuqingDaoJuManager::getManager()->getItemInSection(seasonId, sectionId, data) && data.state == DJS_NotGetted)
			{
				CCSprite *img = CCSprite::create("sectionItem_daoju_weihuode.png");
				addChild(img);
				img->setPosition(ccp(getContentSize().width-5, getContentSize().height+10));

				CCAnimation *animation = CCAnimation::create();
				for (int idx=1; idx<=16; ++idx){
					animation->addSpriteFrameWithFileName(CCString::createWithFormat("sectionItem_daoju_weihuode_%d.png", idx)->getCString());
				}
				animation->setDelayPerUnit(0.02f);
				img->runAction(CCRepeatForever::create(CCSequence::create(CCAnimate::create(animation), CCDelayTime::create(1), NULL)));
			}
*/
		}
	}
}
开发者ID:SongCF,项目名称:game-LostStar,代码行数:74,代码来源:SectionSelectorLayer.cpp

示例15: initResulitLayer

bool ResulitLayer::initResulitLayer()
{
	CCLayer::setIsKeypadEnabled(true);
	CCSize winSize = CCDirector::sharedDirector()->getWinSize();
	this->setContentSize(winSize);
	std::string strName = "";
	strName = s_language + "tongji.png";
	CCSprite *bg = CCSprite::spriteWithFile(strName.c_str());
	bg->setPosition(ccp(winSize.width / 2, winSize.height / 2));
	addChild(bg);
	float bgheight = bg->getContentSize().height;
	//grade 
	std::string StrOne = "";
	StrOne = s_language + "score.png";
	CCSprite *nowGrade = CCSprite::spriteWithFile(StrOne.c_str());
	nowGrade->setPosition(ccp(50, bgheight - 180));
	nowGrade->setAnchorPoint(ccp(0, 0));
	bg->addChild(nowGrade);

	stringstream ss;
	ss << PlayerMrg::getInstance()->getPlayer()->getPlayerGrade();
	CCLabelAtlas* gradeLabel = CCLabelAtlas::labelWithString(ss.str().c_str(), "grade.png", 32, 45, '/');//CCLabelTTF::labelWithString(ss.str().c_str(), "Arial", 30);
	gradeLabel->setAnchorPoint(ccp(0, 0));
	gradeLabel->setPosition(ccp(50 + nowGrade->getContentSize().width + 5, bgheight - 180));
	gradeLabel->setScale(0.75);
	bg->addChild(gradeLabel); 
    //lastHightGrade 
	std::string stdName = "";
	stdName = s_language + "topscore.png";
	CCSprite *lastGrade = CCSprite::spriteWithFile(stdName.c_str());
	lastGrade->setPosition(ccp(50, bgheight - 220));
	lastGrade->setAnchorPoint(ccp(0, 0.5));
	bg->addChild(lastGrade);

	ss.str("");
	ss.clear();
	ss << PlayerMrg::getInstance()->getPlayerLastHightGrade();
	CCLabelAtlas* lastgradeLabel = CCLabelAtlas::labelWithString(ss.str().c_str(), "grade.png", 32, 45, '/');//CCLabelTTF::labelWithString(ss.str().c_str(), "Arial", 30);
	lastgradeLabel->setScale(0.75);
	lastgradeLabel->setPosition(ccp(50 + lastGrade->getContentSize().width + 5, bgheight - 220));
	lastgradeLabel->setAnchorPoint(ccp(0, 0.5));
	bg->addChild(lastgradeLabel);
	ss.str("");
	ss.clear();

	if (PlayerMrg::getInstance()->getPlayer()->getPlayerGrade() > PlayerMrg::getInstance()->getPlayerLastHightGrade())
	{
		PlayerMrg::getInstance()->setPlayerLastHightGrade(PlayerMrg::getInstance()->getPlayer()->getPlayerGrade());
	}

	//chongxin kaishi
	std::string nameOne = "";
	nameOne = s_touchfile + s_language + "actor_btn_restart.png";
	CCMenuItemImage *pContinue = CCMenuItemImage::itemFromNormalImage(
		nameOne.c_str(),
		NULL,
		this,
		menu_selector(ResulitLayer::restartGame));
	pContinue->setPosition(ccp(bg->getContentSize().width / 2 - pContinue->getContentSize().width / 2 + 30, bgheight - 320));
	pContinue->setAnchorPoint(ccp(0, 0));
	pContinue->setScale(0.75);
	std::string str = s_touchfile + s_language + "actor_btn_exit.png";
	CCMenuItemImage *pExit = CCMenuItemImage::itemFromNormalImage(
		str.c_str(),
		NULL,
		this,
		menu_selector(ResulitLayer::menuExitCallBack));
	pExit->setPosition(ccp(bg->getContentSize().width / 2 - pExit->getContentSize().width / 2 + 30, bgheight - 390));
	pExit->setScale(0.75);
	pExit->setAnchorPoint(CCPointZero);
	// create menu, it's an autorelease object
	CCMenu* pMenu = CCMenu::menuWithItems(pContinue, pExit, NULL);
	pMenu->setPosition(CCPointZero);
	bg->addChild(pMenu);

	return true;
}
开发者ID:YLoveDBule,项目名称:ShootGame,代码行数:77,代码来源:ResulitLayer.cpp


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