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


C++ LayerColor::addChild方法代码示例

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


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

示例1: init

bool SkillTableView::init()
{
    if (!Node::init())
        return false;

    LayerColor* bg = LayerColor::create(Color4B(255, 255, 255, 127), 450, 500);
    bg->setPosition(bg->getContentSize()/-2);
    this->addChild(bg, -1);
    
    CCLabelTTF* title = CCLabelTTF::create("技能列表", "fonts/Marker Felt.ttf", 40);
    title->setPosition(Point(bg->getContentSize().width/2, bg->getContentSize().height-30));
    bg->addChild(title);
    
    ControlButton* button = ControlButton::create(Scale9Sprite::create("ui/closed_normal.png"));
    button->setBackgroundSpriteForState(Scale9Sprite::create("ui/closed_selected.png"), Control::State::HIGH_LIGHTED);
    button->setPreferredSize(Size(57, 58));
    button->setPosition(ccpSub(ccpAdd(bg->getPosition(), bg->getContentSize()), button->getContentSize()/2));
    this->addChild(button);
    button->addTargetWithActionForControlEvents(GAME_UILAYER, cccontrol_selector(GameInfoUIController::removeSmallMenuAndButton), Control::EventType::TOUCH_UP_INSIDE);
   // button->setTouchPriority(0);
    
    m_skillTableView = TableView::create(this, Size(420, 420));
    m_skillTableView->setPosition(Point(15, 15));
   // m_skillTableView->setDirection(kCCScrollViewDirectionVertical);
    m_skillTableView->setDelegate(this);
   // m_skillTableView->setVerticalFillOrder(kCCTableViewFillTopDown);
    bg->addChild(m_skillTableView);
    m_skillTableView->reloadData();
    return true;
}
开发者ID:gujianhesong,项目名称:GujianDream,代码行数:30,代码来源:SkillTableView.cpp

示例2: Point

Layer *TDDSuiteLayer::createStatusBarLayer()
{
    Size screenSize = TDDHelper::getScreenSize();
    int midY = kStatusBarHeight/2;
    int margin = 10;
    Point leftAnchor = Point(0, 0.5);
    Point rightAnchor = Point(1, 0.5);


    // Layer containter
    LayerColor *layer = LayerColor::create(kColorToolBar, screenSize.width, kStatusBarHeight);

    //
    Label *leftLabel = TDDHelper::createLabel("Left", kStatusBarFontSize, Color3B::WHITE);
    leftLabel->setAnchorPoint(leftAnchor);
    leftLabel->setPosition(Point(margin, midY));
    layer->addChild(leftLabel);
    mStatusLeftLabel = leftLabel;

    Label *rightLabel = TDDHelper::createLabel("Right", kStatusBarFontSize, Color3B::WHITE);
    rightLabel->setAnchorPoint(rightAnchor);
    rightLabel->setPosition(Point(screenSize.width - margin, midY));
    layer->addChild(rightLabel);

    // Setting Right Label
    char text[200];
    sprintf(text, "%s %s (%d)", APP_NAME, VERSION, BUILD);
    rightLabel->setString(text);

    return layer;
}
开发者ID:duongbadu,项目名称:TicTacToeCcx3,代码行数:31,代码来源:TDDSuite.cpp

示例3: createNumCard

void Game2048::initUI()
{
	//scene -> gameLayer -> root / uiNode
	LayerColor *gameLayer = LayerColor::create(Color4B(0xff, 0xff, 0xf0, 0xff));
	this->addChild(gameLayer);

	Node *root = Node::create();
	gameLayer->addChild(root);

	Node *uiNode = Node::create();
	gameLayer->addChild(uiNode);

	lblScore = Label::createWithTTF("", "fonts/Marker Felt.ttf", 24);
	lblScore->setPosition(Vec2(DISPLAY_CX, DISPLAY_HEIGHT * 4 / 5));
	uiNode->addChild(lblScore);

	//root -> bg 
	bgSize = DISPLAY_WIDTH - offsetW;

	LayerColor *bgLayer = LayerColor::create(Color4B(0xcd, 0xba, 0x96, 0xff), bgSize, bgSize);
	bgLayer->setPosition(Point(DISPLAY_CX,DISPLAY_CY));
	bgLayer->setAnchorPoint(Point(0.5, 0.5));
	bgLayer->ignoreAnchorPointForPosition(false);
	root->addChild(bgLayer);

	//NumNode
	numSize = (bgSize - offsetW) / s_row ;

	for (int i = 0; i < s_row; i++)
	{
		for (int j = 0; j < s_row; j++)
		{
			int numberX = numSize*(i+0.5) + DISPLAY_CX - bgSize/2 + offsetW/2 ;
			int numberY = numSize*(j+0.5) + DISPLAY_CY - bgSize/2 + offsetW/2;

			Node *numNode = Node::create();
			numNode->setPosition(Point(numberX, numberY));
			root->addChild(numNode);

			//bg
			LayerColor *numBg = LayerColor::create(Color4B(200, 190, 180, 0xff), numSize-offsetW/2, numSize-offsetW/2);
			numBg->setAnchorPoint(Point(0.5, 0.5));
			numBg->ignoreAnchorPointForPosition(false);
			numNode->addChild(numBg);

			//card
			cardNumbers[i][j] = 0;
			Node *cardNode = createNumCard(cardNumbers[i][j]);
			cardNodes[i][j] = cardNode;

			numNode->addChild(cardNode);
		}
	}

	randomCreateNum();
	randomCreateNum();

}
开发者ID:caiwb1990,项目名称:cocosClass,代码行数:58,代码来源:Game2048.cpp

示例4: setupHeader

void TDDSubMenu::setupHeader(const Color4B &headerColor)
{
	GLfloat parentH = this->getContentSize().height;
	GLfloat width = this->getContentSize().width;
	GLfloat height = kHeaderHeight;
	
	LayerColor *headerLayer = LayerColor::create(headerColor, width, height);
	Point pos = Point(0, parentH - height);
	headerLayer->setPosition(pos);
	this->addChild(headerLayer);
	
	
	// Setting Buttons
	float scale = TDDHelper::getBestScale();
	// Size screenSize = TDDHelper::getScreenSize();
	int midY = height/2;
	int buttonW = (int)(scale * 50);
	int buttonH = height;
	int leftButtonX = buttonW / 2;
	int rightButtonX = width - leftButtonX;
	int midX = width/2;
	

	Size size = Size(buttonW, buttonH);

	ControlButton *button;
	pos.x = leftButtonX;
	pos.y = midY;
	button = createButton("back", kActionTagBack, pos, size);
	headerLayer->addChild(button);
	mBackButton = button;
	
	pos.x = rightButtonX;
	pos.y = midY;
	button = createButton("hide", kActionTagToggle, pos, size);
	headerLayer->addChild(button);
	button->addTargetWithActionForControlEvents(this,
												cccontrol_selector(TDDSubMenu::touchUpInsideAction),
												Control::EventType::TOUCH_UP_INSIDE);
	mToggleButton = button;
	
	// Label
	Label *title = Label::createWithSystemFont("MENU", "Arial", 15);
	title->setColor(Color3B::WHITE);
	title->setPosition(Point(midX, midY));
	headerLayer->addChild(title);
	
	
	//
	mHeaderLayer = headerLayer;
}
开发者ID:dwdcth,项目名称:SimpleTDD-cocos2dx,代码行数:51,代码来源:TDDSubMenu.cpp

示例5: lostGame

//游戏失败
void HWorld::lostGame()
{
    //添加失败界面
    auto size=Director::getInstance()->getWinSize();
    const char* pic = "";
    if(isGetNewRecord)
    {
        pic = "win1.png";
    }else
    {
        pic = "lost1.png";
    }
    LayerColor* layer = LayerColor::create(Color4B(0, 0, 0, 190), size.width, size.height);
    Sprite* sp = Sprite::create(pic);
    sp->setPosition(Vec2(size.width*0.5,size.height*0.5));
    layer->addChild(sp);
    addChild(layer,100);
    
    //添加一个按钮用于返回Menu
    Label* ttback =Label::createWithSystemFont("返回主菜单", "Helvetica-Bold", 23);
    MenuItemLabel* menuLabel= MenuItemLabel::create(ttback, CC_CALLBACK_1(HWorld::backMenu, this));
    menuLabel->setPosition(Vec2(0,-200));
    Menu* menu =Menu::create(menuLabel,NULL);
    addChild(menu,100);
    
    //停止游戏
    Director::getInstance()->pause();
    SimpleAudioEngine::getInstance()->stopBackgroundMusic();
    SimpleAudioEngine::getInstance()->stopAllEffects();

}
开发者ID:whumr,项目名称:leidian,代码行数:32,代码来源:HWorld.cpp

示例6: lostGame

//游戏失败场景
void HWorld::lostGame()
{
    
    
    Size size = Director::getInstance()->getWinSize();
    
    //创建一个带有颜色的层
    LayerColor *layer = LayerColor::create(Color4B(0, 0, 0, 190),size.width,size.height);
    
    //创建背景图片精灵
    Sprite * sp = Sprite::create("game_lost.png");
    sp->setPosition(Point(size.width/2, size.height/2));
    layer->addChild(sp);
    this->addChild(layer,100);
    
    
    //设置菜单项字体
    MenuItemFont::setFontName("Arial");
    //设置菜单项字体大小
    MenuItemFont::setFontSize(26);
    //创建一个只有字体的Menu按钮
    MenuItemFont *item1 = MenuItemFont::create("返回主菜单", CC_CALLBACK_1(HWorld::backMenu, this));
    //菜单选项卡在Menu中的坐标系是以屏幕的中点为原点
    item1->setPosition(Point(0 , -200));
    
    Menu * menu = Menu::create(item1,NULL);
    this->addChild(menu,100);
    
    //游戏暂停
    Director::getInstance()->pause();
    
}
开发者ID:sd6292295,项目名称:SelfGame,代码行数:33,代码来源:HWorld.cpp

示例7: createBottomBar

//TODO 屏蔽事件穿透
void BattleScene::createBottomBar()
{
	LayerColor *bottom = LayerColor::create(Color4B(0, 0, 100, 100));
	bottom->setContentSize(Size(WINSIZE.width, 120));
	bottom->setPosition(Point(0, 0));
	addChild(bottom);

	int totalCount = 11;
	int index = 0;
	Vector<MenuItem *> items;
	auto soldierInCamp = BattleData::getInstance()->getAttackSoldierInCamp();
	map<int, vector<DSoldier *>>::iterator it;
	for(it=soldierInCamp.begin(); it!=soldierInCamp.end(); it++)
	{
		MenuItemImage *item = MenuItemImage::create("ui/616.0.png", "ui/617.0.png", "ui/618.0.png", CC_CALLBACK_1(BattleScene::selectArmy, this));
		item->setTag(it->first);
		items.pushBack(item);
		index++;

		//head
		Size size = item->getContentSize();
		char img[20];
		sprintf(img, "ui/%d.png", it->first / 100);
		auto head = Sprite::create(img);
		head->setAnchorPoint(Point(0.5, 0.5));
		head->setPosition(size.width/2, size.height/2);
		item->addChild(head);
		
		char text[20];
		sprintf(text, "X %d", it->second.size());
		TTFConfig config("fonts/tahoma.ttf",16);
		auto count = Label::createWithTTF(config, text, TextHAlignment::LEFT);
		count->setPosition(size.width/2, size.height - count->getContentSize().height);
		item->addChild(count);
		//初始化为第一个兵种
		if (m_selectedSoldierType <= 0)
		{
			m_selectedSoldierType = it->first;
		}
		
	}
	for (int i = index; i < totalCount; i++)
	{
		MenuItemImage *item = MenuItemImage::create("ui/616.0.png", "ui/617.0.png", "ui/618.0.png", CC_CALLBACK_1(BattleScene::selectArmy, this));
		item->setEnabled(false);
		items.pushBack(item);
	}

	Size bottomSize = bottom->getContentSize();
	Sprite *spItem = Sprite::create("ui/618.0.png");
	Size itemSize = spItem->getContentSize();
	float padding = (bottomSize.width - itemSize.width * totalCount) / (totalCount + 1);

	UIRadioButton *radio = UIRadioButton::createWithArray(items);
	radio->alignItemsHorizontallyWithPadding(padding);
	radio->setPosition(Point(bottomSize.width / 2, bottomSize.height / 2));
	radio->setSelectedIndex(0);
	bottom->addChild(radio);
}
开发者ID:joyfish,项目名称:MyCocos2dx,代码行数:60,代码来源:BattleScene.cpp

示例8: init

// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }
    
    visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();

    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.

	/**/
    // add "HelloWorld" splash screen"
	auto sprite = Sprite::create("bkq.png");
    // position the sprite on the center of the screen
    sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
    // add the sprite as a child to this layer
  //  this->addChild(sprite, 0);
	sprite->setTag(1024);

	//scheduleUpdate();
	//schedule(schedule_selector(HelloWorld::updateTest), 1.0f, kRepeatForever,5.0f);
	
	/**/
	//color4b rgbA   LayerColorĬÈÏêµã0,0
	LayerColor* redLayer = LayerColor::create(Color4B(255, 0, 0, 255), visibleSize.width / 2, visibleSize.height / 2);
	redLayer->ignoreAnchorPointForPosition(false);
	redLayer->setPosition(visibleSize / 2);
	redLayer->setAnchorPoint(Vec2(0.5, 0.5));
	this->addChild(redLayer);
	LayerColor* blueLayer = LayerColor::create(Color4B(0, 0, 255, 255), visibleSize.width / 6, visibleSize.height / 6);
	blueLayer->ignoreAnchorPointForPosition(false);
	blueLayer->setAnchorPoint(Vec2(1, 1));
	redLayer->addChild(blueLayer);

	/*
	DrawNode * rect = DrawNode::create();
	addChild(rect);
	rect->setZOrder(10);
	rect->drawSolidRect(Vec2(100,100),Vec2(300,300),Color4F(1,0,0,1));

	DrawNode * rect2 = DrawNode::create();
	addChild(rect2);
	rect2->drawSolidRect(Vec2(150, 150), Vec2(350, 350), Color4F(0, 1, 0, 1));

	DrawNode * rect3 = DrawNode::create();
	addChild(rect3);
	rect3->drawSolidRect(Vec2(200, 200), Vec2(400, 400), Color4F(0, 0, 1, 1));
	*/


    return true;
}
开发者ID:caiwb1990,项目名称:cocosClass,代码行数:59,代码来源:HelloWorldScene.cpp

示例9: win

//游戏成功
void Breakout::win() {
	unschedule(schedule_selector(Breakout::update));
	unschedule(schedule_selector(Breakout::showTime));
	LayerColor* gameOverLayer = LayerColor::create(Color4B(128, 128, 128, 128));
	Label* over = Label::createWithSystemFont("You Win", "Arial", 80);
	over->setPosition(origin.x + visibleSize.width / 2, origin.y + visibleSize.height / 2);
	gameOverLayer->addChild(over);
	this->addChild(gameOverLayer, 5);
	for (int i = 0; i < enemys.size(); i++) {
		enemys.at(i)->setVelocity(Vec2(0, 0));
	}
	player->getPhysicsBody()->setVelocity(Vec2(0, 0));
}
开发者ID:CPYcpyCPY,项目名称:C-Cocos2d,代码行数:14,代码来源:BreakoutScene.cpp

示例10: Point

Layer *TDDSuiteLayer::createToolBarLayer()
{
	Size screenSize = TDDHelper::getScreenSize();
	int midY = kToolBarHeight/2;
	int inputW = 140;
	int menuW = 70;
	
	int backX = 40;
	
	int findX  = screenSize.width - menuW/2;
	int inputH = kToolBarHeight - 10;
	int inputX = findX - 10 - menuW / 2  - inputW / 2;
	
	
	
	
	LayerColor *menuLayer = LayerColor::create(kColorToolBar, screenSize.width, kToolBarHeight);
	
	Menu *menuBack = TDDHelper::createMenu(Point(backX, midY), "Back",
										   CC_CALLBACK_1(TDDSuiteLayer::goBack, this));
	
	menuLayer->addChild(menuBack);
	
	
	
	mEditFilter = TDDHelper::createEditBox(menuLayer, Point(inputX, midY), Size(inputW, inputH));
	mEditFilter->setText(TDDHelper::getFilter());
	mEditFilter->setDelegate(this);
	
	Menu *menuFind = TDDHelper::createMenu(Point(findX, midY), "Find",
										   CC_CALLBACK_1(TDDSuiteLayer::filterTest, this));
	
	menuLayer->addChild(menuFind);
	
	return menuLayer;
}
开发者ID:tklee1975,项目名称:tddlib_cocos2dx3,代码行数:36,代码来源:TDDSuite.cpp

示例11: dead

//游戏失败
void Breakout::dead() {
	blood = 0;
	pT->setPercentage(blood);
	unschedule(schedule_selector(Breakout::update));
	unschedule(schedule_selector(Breakout::showTime));
	ParticleSystemQuad* fireWorks = ParticleSystemQuad::create("fire.plist");
	fireWorks->setPosition(player->getPosition());
	this->addChild(fireWorks);

	this->removeChild(player);
	LayerColor* gameOverLayer = LayerColor::create(Color4B(128, 128, 128, 128));
	Label* over = Label::createWithSystemFont("Game Over", "Arial", 80);
	over->setPosition(origin.x + visibleSize.width / 2, origin.y + visibleSize.height / 2);
	gameOverLayer->addChild(over);
	this->addChild(gameOverLayer, 5);
}
开发者ID:CPYcpyCPY,项目名称:C-Cocos2d,代码行数:17,代码来源:BreakoutScene.cpp

示例12: init

bool LoadingScene::init() 
{
	if (Layer::init())
	{
		// add background to current scene
		LayerColor *bkGround = LayerColor::create(Color4B(0, 255, 255, 255));
		this->addChild(bkGround);
		LabelTTF *logo = LabelTTF::create("tashaxing's 2048", "Arial", 30);
		logo->setColor(Color3B(255, 255, 0));
		bkGround->addChild(logo);
		logo->setPosition(bkGround->getContentSize().width / 2, bkGround->getContentSize().height / 2);
		//添加音频预加载回调,注意,只有layer才能用schedule,scene不行
		this->scheduleOnce(schedule_selector(LoadingScene::loadingCallBack), 0);
		return true;
	}
	else
	{
		return false;
	}
}
开发者ID:panxunying,项目名称:iPhone2014,代码行数:20,代码来源:LoadingScene.cpp

示例13: init

bool CoverLayer::init()
{
    if (!Layer::init()) {
        return false;
    }

    _fWidth = COMWinSize().width/2;
    _fHeight = 0.75*COMWinSize().width/2;
    LayerColor* layerBg = LayerColor::create(Color4B(104,177,59,255));
    //LayerColor* layerBg = LayerColor::create(Color4B(146,220,121,255));
    //LayerColor* layerBg = LayerColor::create(Color4B(130,207,191,255));
    addChild(layerBg,0);
    
    Sprite* spBook = Sprite::create("image/cover_bookshelf.png");
    spBook->setPosition(Point(COMWinSize().width/2,(COMWinSize().height-_fHeight*2)/2+_fHeight*2));
    layerBg->addChild(spBook);

    _menuLayer = Layer::create();
    _menuLayer->setVisible(false);
    addChild(_menuLayer);
    _LayerBtnStart = LayerColor::create(Color4B(101,233,232,255), _fWidth, _fHeight);
    _LayerBtnRecord = LayerColor::create(Color4B(70,187,242,255), _fWidth, _fHeight);
    _LayerBtnSet = LayerColor::create(Color4B(250,138,73,255), _fWidth, _fHeight);
    _LayerBtnComment = LayerColor::create(Color4B(159,213,111,255), _fWidth, _fHeight);
    
    _LayerBtnStart->setPosition(Point(0-_fWidth,_fHeight));
    _menuLayer->addChild(_LayerBtnStart);
    _LayerBtnRecord->setPosition(Point(_fWidth+_fWidth,_fHeight));
    _menuLayer->addChild(_LayerBtnRecord);
    _LayerBtnSet->setPosition(Point(0-_fWidth,0));
    _menuLayer->addChild(_LayerBtnSet);
    _LayerBtnComment->setPosition(Point(_fWidth+_fWidth,0));
    _menuLayer->addChild(_LayerBtnComment);
    
    return true;
}
开发者ID:yitianljt,项目名称:Active,代码行数:36,代码来源:CoverLayer.cpp

示例14: onEnter

void TransitionCrossFade::onEnter()
{
    TransitionScene::onEnter();

    // create a transparent color layer
    // in which we are going to add our rendertextures
    Color4B  color(0,0,0,0);
    Size size = _director->getWinSize();
    LayerColor* layer = LayerColor::create(color);

    // create the first render texture for inScene
    RenderTexture* inTexture = RenderTexture::create((int)size.width, (int)size.height,Texture2D::PixelFormat::RGBA8888,GL_DEPTH24_STENCIL8);

    if (nullptr == inTexture)
    {
        return;
    }

    inTexture->getSprite()->setAnchorPoint( Vec2::ANCHOR_MIDDLE );
    inTexture->setPosition(size.width/2, size.height/2);
    inTexture->setAnchorPoint( Vec2::ANCHOR_MIDDLE );

    // render inScene to its texturebuffer
    inTexture->begin();
    _inScene->visit();
    inTexture->end();

    // create the second render texture for outScene
    RenderTexture* outTexture = RenderTexture::create((int)size.width, (int)size.height,Texture2D::PixelFormat::RGBA8888,GL_DEPTH24_STENCIL8);
    outTexture->getSprite()->setAnchorPoint( Vec2::ANCHOR_MIDDLE );
    outTexture->setPosition(size.width/2, size.height/2);
    outTexture->setAnchorPoint( Vec2::ANCHOR_MIDDLE );

    // render outScene to its texturebuffer
    outTexture->begin();
    _outScene->visit();
    outTexture->end();

    // create blend functions

    BlendFunc blend1 = {GL_ONE, GL_ONE}; // inScene will lay on background and will not be used with alpha
    BlendFunc blend2 = {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA}; // we are going to blend outScene via alpha

    // set blendfunctions
    inTexture->getSprite()->setBlendFunc(blend1);
    outTexture->getSprite()->setBlendFunc(blend2);

    // add render textures to the layer
    layer->addChild(inTexture);
    layer->addChild(outTexture);

    // initial opacity:
    inTexture->getSprite()->setOpacity(255);
    outTexture->getSprite()->setOpacity(255);

    // create the blend action
    Action* layerAction = Sequence::create
    (
        FadeTo::create(_duration, 0),
        CallFunc::create(CC_CALLBACK_0(TransitionScene::hideOutShowIn,this)),
        CallFunc::create(CC_CALLBACK_0(TransitionScene::finish,this)),
        nullptr
    );


    // run the blend action
    outTexture->getSprite()->runAction( layerAction );

    // add the layer (which contains our two rendertextures) to the scene
    addChild(layer, 2, kSceneFade);
}
开发者ID:253056965,项目名称:cocos2d-x-lite,代码行数:71,代码来源:CCTransition.cpp

示例15: JuegoTerminado

void Akuerdate::JuegoTerminado(){
    CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("ganar.mp3");
    
    escuchadores = false;
    juegoTerminado = true;
    
    LayerColor *lyConseguido = LayerColor::create(Color4B(124,180,224,200));
    lyConseguido->setPosition(cuadroJuego->getPosition());
    lyConseguido->setContentSize(cuadroJuego->getContentSize());
    lyConseguido->setLocalZOrder(20);
    addChild(lyConseguido);
    
    Sprite *foco = Sprite::create("preguntator_focoLuz.png");
    foco->setScaleX(escalaAlta);
    foco->setScaleY(0);
    foco->setScaleZ(escalaAlta);
    
    foco->setAnchorPoint(Vec2(0.5,1));
    foco->setPosition(lyConseguido->getContentSize().width/2,lyConseguido->getContentSize().height);
    lyConseguido->addChild(foco);
    //animacion foco
    ScaleTo *aniFoco = ScaleTo::create(0.7, escalaAlta);
    foco->runAction(aniFoco);
    

    __String *txtConsegido = __String::createWithFormat("%s %s",LanguageManager::getInstance()->getString("JUEGO_TX_FINAL_EXITO_2").c_str(),sNombreProfesion->getCString());
    
    CCLabelTTF *txConseguido = CCLabelTTF::create(txtConsegido->getCString(), "HVD_Comic_Serif_Pro.ttf",120*escala,Size((visibleSize.width),(220*escala)*2), TextHAlignment::CENTER);
    txConseguido->setColor(Color3B(25,78,121));
    txConseguido->setVerticalAlignment(TextVAlignment::CENTER);
    txConseguido->setAnchorPoint(Vec2(0.5,1));
    txConseguido->setPosition(lyConseguido->getContentSize().width/2,visibleSize.height+(280*escala));
    lyConseguido->addChild(txConseguido);
    
    //animacion textoConsegido
    MoveTo *aniTxConseguido = MoveTo::create(0.3, Vec2(lyConseguido->getContentSize().width/2,(lyConseguido->getContentSize().height)));
    txConseguido->runAction(aniTxConseguido);
    
    Sprite *pizzarra = Sprite::create("pizzarra_final_tiempo.png");
    pizzarra->setScale(escalaAlta);
    pizzarra->setAnchorPoint(Vec2(0.5,1));
    pizzarra->setPosition(visibleSize.width,(lyConseguido->getContentSize().height)-(txConseguido->getContentSize().height));
    lyConseguido->addChild(pizzarra);
    
    CCLabelTTF *nAciertosPizarra = CCLabelTTF::create(reloj->getString(), "HVD_Comic_Serif_Pro.ttf",200,pizzarra->getContentSize(), TextHAlignment::CENTER);
    nAciertosPizarra->setColor(Color3B(255,255,255));
    nAciertosPizarra->setVerticalAlignment(TextVAlignment::CENTER);
    nAciertosPizarra->setAnchorPoint(Vec2(0,0));
    nAciertosPizarra->setPosition(0,0);
    pizzarra->addChild(nAciertosPizarra);
    
    //animacion pizzara
    MoveTo *aniPizzarra = MoveTo::create(0.3, Vec2(lyConseguido->getContentSize().width/2,pizzarra->getPositionY()));
    pizzarra->runAction(aniPizzarra);
    
    
    CGestorRecursos *gRecursos = new CGestorRecursos();
    CRecurso *recursoAleatorio = gRecursos->obtenerRecursoBloqueadoAleatorio();
    
    if(recursoAleatorio!=NULL){
        gRecursos->quitarRecursoBloqueado(recursoAleatorio);
        
        Sprite *txPremio = Sprite::create("preguntator_finjuego_texto_inferior.png");
        txPremio->setScale(escalaAlta);
        txPremio->setAnchorPoint(Vec2(0.5,0));
        txPremio->setPosition(foco->getPositionX(),foco->getPositionY()-(foco->getContentSize().height*escalaAlta));
        txPremio->setOpacity(0);
        lyConseguido->addChild(txPremio);
        
        //animacion txPremio
        Sequence *aniPremio1 = Sequence::create(DelayTime::create(0.7),FadeIn::create(1),NULL);
        txPremio->runAction(aniPremio1);
        
        
        Sprite *premio = Sprite::create(recursoAleatorio->uri->getCString());
        float escalaPremio = ((pizzarra->getContentSize().height*pizzarra->getScale())/2)/premio->getContentSize().height;
        float escalaPremioAncha = ((pizzarra->getContentSize().width*pizzarra->getScale()))/premio->getContentSize().width;
        if(escalaPremioAncha<escalaPremio)
            escalaPremio = escalaPremioAncha;
        premio->setScale(escalaPremio);
        premio->setAnchorPoint(Vec2(0.5,0));
        premio->setPosition(txPremio->getPositionX(),txPremio->getPositionY()+(20*escalaPremio)+(txPremio->getContentSize().height*txPremio->getScaleY()));
        premio->setOpacity(0);
        //nuevo
        if(recursoAleatorio->tipoRecurso->getValue()!=Configuracion::rcsTipoOjos&&recursoAleatorio->tipoRecurso->getValue()!=Configuracion::rcsTipoAccesorio&&recursoAleatorio->tipoRecurso->getValue()!=Configuracion::rcsTipoDientes&&recursoAleatorio->tipoRecurso->getValue()!=Configuracion::rcsTipoColor)
            premio->runAction(TintTo::create(0,0,0,0));
        lyConseguido->addChild(premio);
        
        string textoTraducido1 = LanguageManager::getInstance()->getString("kitDe");
        string keyTexto2 = __String::createWithFormat("tipoRecurso%i",recursoAleatorio->tipoRecurso->getValue())->getCString();
        string textoTraducido2 = LanguageManager::getInstance()->getString(keyTexto2);
        string textoFinal = __String::createWithFormat("%s %s",textoTraducido1.c_str(),textoTraducido2.c_str())->getCString();
        
        CCLabelTTF *nAciertosPizarra = CCLabelTTF::create(textoFinal, "HVD_Comic_Serif_Pro.ttf",60,Size(lyConseguido->getContentSize().width,txPremio->getContentSize().height), TextHAlignment::CENTER);
        nAciertosPizarra->setColor(Color3B(229,57,57));
        nAciertosPizarra->setVerticalAlignment(TextVAlignment::BOTTOM);
        nAciertosPizarra->setAnchorPoint(Vec2(0.5,0));
        nAciertosPizarra->setPosition(txPremio->getContentSize().width/2,80);
        nAciertosPizarra->setOpacity(0);
        txPremio->addChild(nAciertosPizarra);
//.........这里部分代码省略.........
开发者ID:si2info,项目名称:info.si2.mostrosity,代码行数:101,代码来源:Akuerdate.cpp


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