void BlockBase::switchToSelectionImage() { mSprite->setColor(Color3B(0,0,255)); }
bool Color4F::operator==(const Color3B& right) const { return (a == 1.0f && Color3B(*this) == right); }
r = r - 1; } float blockX = m_relativeX + m_blockLength * (c - 1) + blockSpt->getContentSize().width/2; float blockY = m_relativeY +m_blockLength * (r - 1) + blockSpt->getContentSize().height/2; blockSpt->runAction(Sequence::createWithTwoActions(DelayTime::create(0.03 * i), JumpTo::create(0.3f, Point(blockX, blockY), 30, 1))); i++; } m_tipsLayer = LayerColor::create(Color4B(0, 0, 0, 50)); addChild(m_tipsLayer); LabelTTF *tipsTitleLabel = LabelTTF::create("Tap To Continue", "Arial", 40*BBGameDataManager::getInstance()->getScreenScale()); tipsTitleLabel->setColor(Color3B(255, 255, 255)); tipsTitleLabel->setPosition(Point(m_visibleSize.width/2, m_visibleSize.height/2 - 260*BBGameDataManager::getInstance()->getScreenScale())); m_tipsLayer->addChild(tipsTitleLabel); tipsTitleLabel->runAction(RepeatForever::create(Sequence::create(FadeIn::create(.45), FadeOut::create(.65),DelayTime::create(.3), NULL))); m_showTips = true; } void BBHandleLayer::removeTipsLayer() { if (!m_showTips) { return; } Object *spt = NULL;
//////////////////////////////////////////////////////// // // ParticleMainScene // //////////////////////////////////////////////////////// void ParticleMainScene::initWithSubTest(int asubtest, int particles) { //srandom(0); subtestNumber = asubtest; auto s = Director::getInstance()->getWinSize(); lastRenderedCount = 0; quantityParticles = particles; MenuItemFont::setFontSize(65); auto decrease = MenuItemFont::create(" - ", [&](Object *sender) { quantityParticles -= kNodesIncrease; if( quantityParticles < 0 ) quantityParticles = 0; updateQuantityLabel(); createParticleSystem(); }); decrease->setColor(Color3B(0,200,20)); auto increase = MenuItemFont::create(" + ", [&](Object *sender) { quantityParticles += kNodesIncrease; if( quantityParticles > kMaxParticles ) quantityParticles = kMaxParticles; updateQuantityLabel(); createParticleSystem(); }); increase->setColor(Color3B(0,200,20)); auto menu = Menu::create(decrease, increase, NULL); menu->alignItemsHorizontally(); menu->setPosition(Point(s.width/2, s.height/2+15)); addChild(menu, 1); auto infoLabel = LabelTTF::create("0 nodes", "Marker Felt", 30); infoLabel->setColor(Color3B(0,200,20)); infoLabel->setPosition(Point(s.width/2, s.height - 90)); addChild(infoLabel, 1, kTagInfoLayer); // particles on stage auto labelAtlas = LabelAtlas::create("0000", "fps_images.png", 12, 32, '.'); addChild(labelAtlas, 0, kTagLabelAtlas); labelAtlas->setPosition(Point(s.width-66,50)); // Next Prev Test auto menuLayer = new ParticleMenuLayer(true, TEST_COUNT, s_nParCurIdx); addChild(menuLayer, 1, kTagMenuLayer); menuLayer->release(); // Sub Tests MenuItemFont::setFontSize(40); auto pSubMenu = Menu::create(); for (int i = 1; i <= 6; ++i) { char str[10] = {0}; sprintf(str, "%d ", i); auto itemFont = MenuItemFont::create(str, CC_CALLBACK_1(ParticleMainScene::testNCallback, this)); itemFont->setTag(i); pSubMenu->addChild(itemFont, 10); if (i <= 3) { itemFont->setColor(Color3B(200,20,20)); } else { itemFont->setColor(Color3B(0,200,20)); } } pSubMenu->alignItemsHorizontally(); pSubMenu->setPosition(Point(s.width/2, 80)); addChild(pSubMenu, 2); auto label = LabelTTF::create(title().c_str(), "Arial", 40); addChild(label, 1); label->setPosition(Point(s.width/2, s.height-32)); label->setColor(Color3B(255,255,40)); updateQuantityLabel(); createParticleSystem(); schedule(schedule_selector(ParticleMainScene::step)); }
/* 改变箭头颜色 */ void MyAction::arrowColor(cocos2d::Sprite * arrow, float touchTime) { if (touchTime > 2) touchTime = 2; int temp = (int)(touchTime * 100); arrow->setColor(Color3B(255 - temp, 255 - temp, 255 - temp)); }