void ControllPanel::makeSkillCD(CCObject *pSender) { CCLog("makeSkillCD"); //进入CD状态 this->setMagicCD(true); //设置按钮不可用 m_pMagicItem->setIsEnabled(false); //创建技能cd样式 CCProgressTimer *cd = CCProgressTimer::progressWithFile("actor_btn_mask.png"); cd->setType(kCCProgressTimerTypeRadialCCW); cd->setPosition(m_pMagicItem->getParent()->getPosition()); cd->setPercentage(99.99f); this->addChild(cd, 1000); //技能冷却动画 CCProgressTo *to = CCProgressTo::actionWithDuration(PlayerMrg::getInstance()->getPlayer()->getPlayerSkillCd(), 0); //冷却完成之后的回调,销毁对象,同时使技能按钮可用 CCCallFuncND *callfunn = CCCallFuncND::actionWithTarget(this, callfuncND_selector(ControllPanel::endSkillCD), (void*)cd); cd->runAction(CCSequence::actions(to, callfunn, NULL)); m_lMagicCDLabel->setIsVisible(true); schedule(schedule_selector(ControllPanel::updateCountDown), 1.0f); }
//------------------------------------------------------------------ // // SpriteProgressToRadialMidpointChanged // //------------------------------------------------------------------ void SpriteProgressToRadialMidpointChanged::onEnter() { SpriteDemo::onEnter(); CCSize s = CCDirector::sharedDirector()->getWinSize(); CCProgressTo *action = CCProgressTo::create(2, 100); /** * Our image on the left should be a radial progress indicator, clockwise */ CCProgressTimer *left = CCProgressTimer::create(CCSprite::create(s_pPathBlock)); left->setType(kCCProgressTimerTypeRadial); addChild(left); left->setMidpoint(ccp(0.25f, 0.75f)); left->setPosition(ccp(100, s.height/2)); left->runAction(CCRepeatForever::create((CCActionInterval *)action->copy()->autorelease())); /** * Our image on the left should be a radial progress indicator, counter clockwise */ CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathBlock)); right->setType(kCCProgressTimerTypeRadial); right->setMidpoint(ccp(0.75f, 0.25f)); /** * Note the reverse property (default=NO) is only added to the right image. That's how * we get a counter clockwise progress. */ addChild(right); right->setPosition(ccp(s.width-100, s.height/2)); right->runAction(CCRepeatForever::create((CCActionInterval *)action->copy()->autorelease())); }
//****************************************************************************** // skillDecCD //****************************************************************************** void Card::skillDecCD(int cd) { CCSprite* spWhite = CCSprite::spriteWithFile("headw.png"); if (spWhite) { addChild(spWhite, 2, kToBeDeleteTag); spWhite->setPositionInPixels(CCPointMake(55 + 106*m_idx, 615)); spWhite->setIsVisible(false); spWhite->runAction(CCSequence::actions(CCDelayTime::actionWithDuration(0.7), CCShow::action(), CCFadeIn::actionWithDuration(0.15), CCFadeOut::actionWithDuration(0.15), CCCallFunc::actionWithTarget(this, callfunc_selector(Card::delUnusedObj)), NULL)); CCProgressTimer* tmOrange = CCProgressTimer::progressWithFile("heado.png"); if (tmOrange) { addChild(tmOrange, 2, kToBeDeleteTag); tmOrange->setPositionInPixels(CCPointMake(55 + 106*m_idx, 615)); tmOrange->setType(kCCProgressTimerTypeRadialCCW); tmOrange->setPercentage(99); tmOrange->runAction(CCProgressTo::actionWithDuration(0.7, 0)); } } m_iSklCdDwn = cd; m_iCurSkillCD = MIN(m_iCurSkillCD.get(), (m_iSkillCDMax - m_iSklCdDwn)); }
CCProgressTimer* SectionGuide::createRedStartPrompt() { CCSprite* sprite = CCSprite::create(ResManager::getManager()->getSharedFilePath("circle.png").c_str()); CCProgressTimer *progress = CCProgressTimer::create(sprite); progress->setType( kCCProgressTimerTypeRadial ); progress->setVisible(false); return progress; }
void MCSkillBarItem::coldTimeDidFinish(CCObject *anObject) { CCProgressTimer *progressTimer = dynamic_cast<CCProgressTimer *>(anObject); progressTimer->removeFromParentAndCleanup(true); setOpacity(kMCSkillBarItemActiveSkillOpacity); }
CCProgressTimer* createProgressTimer(CCSprite* sprite) { CCProgressTimer *progress = CCProgressTimer::create(sprite); progress->setType( kCCProgressTimerTypeBar ); progress->setMidpoint(ccp(0,0)); progress->setBarChangeRate(ccp(1, 0)); return progress; }
void ASBot::changeEnergyBarAnimation(int _dif){ CCProgressTimer* energyBar = (CCProgressTimer*)this->getChildByTag(2*10000000+20); int percentage = energyBar->getPercentage(); CCProgressFromTo* action = CCProgressFromTo::create(0.015*(abs(moveCount*100/moveToFight-percentage)), percentage, moveCount*100/moveToFight); CCSequence* seq = CCSequence::create(action,NULL); energyBar->runAction(seq); }
CCProgressTimer* SectionGuide::createRedStartToTableArrows() { CCSprite* sprite = CCSprite::create(ResManager::getManager()->getSharedFilePath("arrows.png").c_str()); CCProgressTimer *progress = CCProgressTimer::create(sprite); progress->setType( kCCProgressTimerTypeBar ); progress->setVisible(false); progress->setMidpoint(ccp(0,1)); progress->setBarChangeRate(ccp(0, 1)); return progress; }
void CCProgressTimerCreator::endNode(CCNode* pNode) { CCProgressTimer* pProgressTimer = (CCProgressTimer*)pNode; if(FIND_OBJ_BYKEY(mAttrMap, "file")) pProgressTimer->initWithSprite(CCSprite::create(mAttrMap["file"].c_str())); else if(FIND_OBJ_BYKEY(mAttrMap, "plist")) pProgressTimer->initWithSprite(CCSprite::createWithSpriteFrameName(mAttrMap["plist"].c_str())); CCNodeCreator::setAttribute(pNode); }
CCProgressTimer* CCProgressTimerCreator::createNode() { CCProgressTimer* pProgressTimer = new CCProgressTimer(); if(pProgressTimer) { pProgressTimer->autorelease(); return pProgressTimer; } CC_SAFE_DELETE(pProgressTimer); return NULL; }
//进度动作 void HelloWorld::JDCallback(CCObject* pSender) { CCProgressTo *to1 = CCProgressTo::actionWithDuration(2,100); CCSprite *jl=CCSprite::spriteWithFile("jl.png"); CCProgressTimer *left = CCProgressTimer::progressWithSprite(jl); left->setType(kCCProgressTimerTypeBar); addChild(left); left->setPosition(CCPointMake(100,s.height/2)); left->runAction(CCRepeatForever::actionWithAction(to1)); }
void LoadingLayer::loadCallBack(CCObject* ped) { loadingNum++; CCProgressTimer* pt = (CCProgressTimer*)this->getChildByTag(1); //float now = pt->getPercentage(); pt->setPercentage(loadingNum/totalNum); if(loadingNum < totalNum){ CCLOG("loading..."); }else{ CCLOG("loading over"); } }
CCProgressTimer* CCProgressTimer::create(CCSprite* sp, CCProgressTimerType type) { CCProgressTimer* pProgressTimer = new CCProgressTimer(); if (pProgressTimer->initWithSprite(sp)) { pProgressTimer->autorelease(); } else { delete pProgressTimer; pProgressTimer = NULL; } pProgressTimer->setType(type); return pProgressTimer; }
void CCProgressTo::startWithTarget(CCNode* pTarget) { CCProgressTimer* progressTimer = dynamic_cast<CCProgressTimer*>(pTarget); if (progressTimer) { CCActionInterval::startWithTarget(pTarget); m_fFrom = progressTimer->getPercentage(); // XXX: Is this correct ? // Adding it to support CCRepeat if (m_fFrom == 100) { m_fFrom = 0; } } }
void MCSkillBarItem::intoColdTime() { CCSprite *coldSprite = CCSprite::create(kMCColdTimeSkillIconFilepath); CCProgressTimer *progressTimer = CCProgressTimer::create(coldSprite); progressTimer->setReverseProgress(true); progressTimer->setAnchorPoint(CCPointZero); addChild(progressTimer); setOpacity(kMCSkillBarItemColdTimeOpacity); progressTimer->runAction(CCSequence::createWithTwoActions(CCProgressFromTo::create(skill_->coldTime, 100.f, 0.0f), CCCallFuncO::create(this, callfuncO_selector(MCSkillBarItem::coldTimeDidFinish), progressTimer))); }
void ASGame::changeHeart(int _shengming,int _source){ shengming += _shengming; if (shengming<=0) shengming = 0; //1.血条 CCProgressTimer* heartBar = (CCProgressTimer*)this->getChildByTag(1*10000000+2222); CCProgressFromTo* action = CCProgressFromTo::create(0.5, heartBar->getPercentage(), (float)shengming/(float)maxShengMing*100); heartBar->runAction(action); if ((float)shengming <= 0.4*(float)maxShengMing){ heartBar->getSprite()->setColor(ccc3(237, 45, 37)); if(!MainUser->muted){ CocosDenshion::SimpleAudioEngine::sharedEngine()->stopEffect(heartSoundEffect); heartSoundEffect = CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("noHeart.wav", true); } }else{ heartBar->getSprite()->setColor(ccc3(255, 255, 255)); if(!MainUser->muted) CocosDenshion::SimpleAudioEngine::sharedEngine()->stopEffect(heartSoundEffect); } //2.生命数字 string HeartStr = int2string(shengming) + "/" + int2string(maxShengMing); CCLabelTTF* heartLabel = (CCLabelTTF*)this->getChildByTag(playerNumber*10000000+2223); heartLabel->setString(HeartStr.c_str()); //3.判断胜利条件 if (shengming == 0 && !((GameBaseClass*)getParent())->gameover){ ((GameBaseClass*)getParent())->gameover = true; //1.禁用各种按钮 CCMenu* skillMenu = (CCMenu*)this->getChildByTag(1*10000000+27); CCMenu* optionMenu = (CCMenu*)this->getChildByTag(1*10000000+12); CCMenu* itemMenu = (CCMenu*)this->getChildByTag(1*10000000+77776); skillMenu->setTouchEnabled(false); optionMenu->setTouchEnabled(false); itemMenu->setTouchEnabled(false); //2.停止所有监听 unscheduleAllSelectors(); bot2->unscheduleAllSelectors(); //3.结束页面 ((GameBaseClass*)getParent())->GameResult(1); } }
void CCTransitionRadialCCW::onEnter() { CCTransitionScene::onEnter(); // create a transparent color layer // in which we are going to add our rendertextures CCSize size = CCDirector::sharedDirector()->getWinSize(); // create the second render texture for outScene m_OutRT = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height); if (NULL == m_OutRT) return; m_OutRT->retain(); m_OutRT->getSprite()->setAnchorPoint(ccp(0.5f,0.5f)); m_OutRT->setPosition(ccp(size.width/2, size.height/2)); m_OutRT->setAnchorPoint(ccp(0.5f,0.5f)); // We need the texture in RenderTexture. CCProgressTimer *outNode = CCProgressTimer::progressWithTexture(m_OutRT->getSprite()->getTexture()); // but it's flipped upside down so we flip the sprite outNode->getSprite()->setFlipY(true); // fix content scale factor for radial texture CCRect rect = CCRectZero; rect.size = m_OutRT->getSprite()->getTexture()->getContentSize(); outNode->getSprite()->setTextureRect(rect, false); float scale = 1.0f / CC_CONTENT_SCALE_FACTOR(); rect.size.width *= scale; rect.size.height *= scale; outNode->setContentSize(rect.size); // Return the radial type that we want to use outNode->setType(radialType()); outNode->setPercentage(100.f); outNode->setPosition(ccp(size.width/2, size.height/2)); outNode->setAnchorPoint(ccp(0.5f,0.5f)); // create the blend action CCAction * layerAction = CCSequence::actions ( CCProgressFromTo::actionWithDuration(m_fDuration, 100.0f, 0.0f), CCEventCall::actionWithTarget(NULL, createEventHandler(this, &CCTransitionScene::_finish)), NULL ); // run the blend action outNode->runAction(layerAction); // add the layer (which contains our two rendertextures) to the scene this->addChild(outNode, 2, kSceneRadial); }
bool ControlEngine::initProgressIndicator( int tag, cocos2d::CCPoint point, cocos2d::CCPoint anchor ) { CCSprite* progressIndicatorSprite = CCSprite::create( this->getProgressIndicatorName().getCString() ); if( progressIndicatorSprite ) { CCProgressTimer* progressIndicator = CCProgressTimer::create( progressIndicatorSprite ); if( progressIndicator ) { progressIndicator->ignoreAnchorPointForPosition( false ); progressIndicator->setAnchorPoint( anchor ); progressIndicator->setPosition( point ); this->addChild( progressIndicator, Child::Z::progressIndicator, tag ); return true; } } return false; }
bool LoadingLayer::setUpdateView() { bool isRet = false; do{ CCSprite* loadingbackimg = CCSprite::create("gmbg/loadingbg.png"); CC_BREAK_IF(!loadingbackimg); loadingbackimg->setPosition(ccp(getWinSize().width/2 + getWinOrigin().x, getWinSize().height/5 + getWinOrigin().y)); this->addChild(loadingbackimg, 1); CCSprite* loadimg = CCSprite::create("gmbg/loading.png"); CC_BREAK_IF(!loadimg); CCProgressTimer* pt = CCProgressTimer::create(loadimg); pt->setType(cocos2d::CCProgressTimerType(kCCProgressTimerTypeBar)); pt->setMidpoint(ccp(0,0.5)); pt->setBarChangeRate(ccp(1,0)); float tex = getWinSize().width/2 + getWinOrigin().x; float tey = getWinSize().height/5 + getWinOrigin().y-5; pt->setPosition(ccp(tex, tey)); pt->setPercentage(0); this->addChild(pt, 2, 1); CCProgressTo* to = CCProgressTo::create(5, 100); pt->runAction(CCRepeatForever::create(to)); isRet = true; }while(0); return isRet; }
void CNFRockerLayer::OnSkillPublicCallBack() { do { //遍历按钮,隐藏公共CD for (int i=enTagBtnSkill1;i<=enTagBtnSkill5;i++) { CCProgressTimer* pProgress = dynamic_cast<CCProgressTimer *>(getChildByTag(i+200)); CC_BREAK_IF(pProgress==NULL); pProgress->setVisible(false); } //公共CD结束 m_bIsPublicCD = false; return ; } while (false); CCLog("Fun CNFRockerLayer::OnSkillPublicCallBack Error!"); }
// CCTransitionProgress void CCTransitionProgress::onEnter() { CCTransitionScene::onEnter(); setupTransition(); // create a transparent color layer // in which we are going to add our rendertextures CCSize size = CCDirector::sharedDirector()->getWinSize(); // create the second render texture for outScene CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height); texture->getSprite()->setAnchorPoint(ccp(0.5f,0.5f)); texture->setPosition(ccp(size.width/2, size.height/2)); texture->setAnchorPoint(ccp(0.5f,0.5f)); // render outScene to its texturebuffer texture->clear(0, 0, 0, 1); texture->begin(); m_pSceneToBeModified->visit(); texture->end(); // Since we've passed the outScene to the texture we don't need it. if (m_pSceneToBeModified == m_pOutScene) { hideOutShowIn(); } // We need the texture in RenderTexture. CCProgressTimer *pNode = progressTimerNodeWithRenderTexture(texture); // create the blend action CCActionInterval* layerAction = (CCActionInterval*)CCSequence::create( CCProgressFromTo::create(m_fDuration, m_fFrom, m_fTo), CCCallFunc::create(this, callfunc_selector(CCTransitionProgress::finish)), NULL); // run the blend action pNode->runAction(layerAction); // add the layer (which contains our two rendertextures) to the scene addChild(pNode, 2, kCCSceneRadial); }
void BattleLayer::nextEnemyGroup() { if(m_curEnemy == 2) { Game::getInstance()->getGameScene()->setActiveLayer(GameScene::Layer_Result_Win); return; } m_curTile = m_terrain->getTileByID(0); m_enemySprite->setPosition(m_curTile->getPosition()); CCProgressTimer* bar = (CCProgressTimer*)m_enemySprite->getChildByTag(0); bar->setPercentage(100); m_curEnemy++; std::stringstream ss; ss << "第" << m_curEnemy+1 << "波"; m_label->setString(ss.str().c_str()); m_preventEnemyBuff = 0; fight(); }
bool LoadingLayer::setUpdateView(){ bool isRet=false; do { // 设置进度条的背景图片 我们把他放到屏幕下方的1/5处 CCSprite* loadbackimg=CCSprite::create("gmbg/lodingbg.png"); CC_BREAK_IF(!loadbackimg); loadbackimg->setPosition(ccp(getWinSize().width/2+getWinOrigin().x,getWinSize().height/5+getWinOrigin().y)); this->addChild(loadbackimg,1); // 添加进度条 CCSprite* loadimg=CCSprite::create("gmbg/longding.png"); CC_BREAK_IF(!loadimg); CCProgressTimer* pt = CCProgressTimer::create(loadimg); pt->setType(kCCProgressTimerTypeBar);// 设置成横向的 //可以看作是按矩形显示效果的进度条类型 pt->setMidpoint(ccp(0,0)); // 用来设定进度条横向前进的方向从左向右或是从右向左 pt->setBarChangeRate(ccp(1,0)); //重新设置锚点 float tex=getWinSize().width/2+getWinOrigin().x; float tey=getWinSize().height/5+getWinOrigin().y-5; pt->setPosition(ccp(tex,tey)); pt->setPercentage(0); this->addChild(pt,2,1); isRet=true; } while (0); return isRet; }
bool wootestScene::setUpdateView() { bool isRet=false; CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize(); CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin(); do { // 进度条背景 CCSprite* loadbackimg=CCSprite::create("lodingbg.png"); CC_BREAK_IF(!loadbackimg); loadbackimg->setPosition(ccp(visibleSize.width/2+origin.x,visibleSize.height/5+origin.y)); this->addChild(loadbackimg,2); // 进度条 CCSprite* loadimg=CCSprite::create("longding.png"); CC_BREAK_IF(!loadimg); CCProgressTimer* pt = CCProgressTimer::create(loadimg); pt->setType(kCCProgressTimerTypeBar);// 设置成横向 pt->setMidpoint(ccp(0,0)); // 设置进度条从左到右 pt->setBarChangeRate(ccp(1,0)); //重新设置锚点 float tex=visibleSize.width/2+origin.x; float tey=visibleSize.height/5+origin.y-5; pt->setPosition(ccp(tex,tey)); pt->setPercentage(0); this->addChild(pt,2,1); isRet=true; } while (0); return isRet; }
bool HSShowEndurance::init() { for (int i=0; i<HSShowEndurance::S_C_ENDURANCE_COUNT; ++i) { CCString* pPanel = CCString::createWithFormat("UI_Benfangxinxiban_Naili_%d",i); HSCCSprite* pSprite = HS_FIND_UI_PANEL_SPRITE(pPanel->getCString(),"Naili_1"); pSprite->setVisible(false); CCProgressTimer* pProgress = CCProgressTimer::create(pSprite); pProgress->setType(kCCProgressTimerTypeBar); pProgress->setPosition(pSprite->getPosition()); pProgress->setMidpoint(ccp(0.5,0)); pProgress->setBarChangeRate(ccp(0,1)); i < HSShowEndurance::S_CURRENT_ENDURANCE_COUNT ? pProgress->setPercentage(100) : pProgress->setPercentage(0); pSprite->getParent()->addChild(pProgress,2000); m_enduranceMap.insert(pair<int, CCProgressTimer*>(i + 1,pProgress)); CC_SAFE_RELEASE_NULL(pPanel); } HSCCSprite* pSprite = HS_FIND_UI_PANEL_SPRITE("UI_Benfangxinxiban_Nailijishiqi","Pipeinailidiban"); m_pMaxLabel = CCLabelTTF::create("MAX", HS_FONT_HuaKang, 25, pSprite->getContentSize(), kCCTextAlignmentCenter,kCCVerticalTextAlignmentCenter); m_pMaxLabel->setAnchorPoint(HS_ANCHOR_CENTER); m_pMaxLabel->setPosition(pSprite->getAnchorPointInPoints()); m_pMaxLabel->setVisible(false); pSprite->addChild(m_pMaxLabel); this->CreateTimeLabel(); this->schedule(schedule_selector(HSShowEndurance::Updata)); return true; }
void ASGame::changeEnergyBarAnimation(int _dif){ CCProgressTimer* energyBar = (CCProgressTimer*)this->getChildByTag(playerNumber*10000000+20); CCProgressTimer* attackButton = (CCProgressTimer*)this->getChildByTag(1*10000000+25); int percentage = energyBar->getPercentage(); //1.上方行动力槽 CCProgressFromTo* action = CCProgressFromTo::create(0.015*(abs(moveCount*100/moveToFight-percentage)), percentage, moveCount*100/moveToFight); energyBar->runAction(action); //2.下方攻击按钮槽 CCProgressFromTo* action1 = CCProgressFromTo::create(0.015*(abs(moveCount*100/moveToFight-percentage)), percentage, moveCount*100/moveToFight); attackButton->runAction(action1); //3.能量条盖子 /* CCSprite* energyBarCover = (CCSprite*)this->getChildByTag(player 28); energyBarCover->setOpacity(255); float tmpScale = (sqrt(pow(107, 2) - pow((abs((int)(107-_pixel))),2))*2)/214; energyBarCover->setScale(tmpScale); energyBarCover->setPosition(ccp(size.width*179/200, size.height/13.5 - (215-_pixel)/2*tmpScale)); */ }
void ASBot::energyBarAnimation(){ //1.显示行动力的圆形底座 CCSprite* energyBall = CCSprite::createWithSpriteFrameName("newEnergyContainer.png"); energyBall->setScaleX(-1); energyBall->setPosition(ccp(size.width*62.62/80,size.height*3.85/90+winDif*2*alpha*alpha)); addChild(energyBall,4); //2.行动力数量 string perStr = int2string(moveCount); CCLabelTTF* per = CCLabelTTF::create(perStr.c_str(),"Arial Rounded MT Bold",32); per->setPosition(ccp(size.width*62.3/80,size.height*3.87/90+winDif*2*alpha*alpha)); addChild(per,5,2*10000000+26); //3.能量条 CCSprite* energyBarSprite = CCSprite::createWithSpriteFrameName("newEnergyBar.png"); CCProgressTimer* energyBar = CCProgressTimer::create(energyBarSprite); energyBar->setScaleX(-1); energyBar->setPosition(ccp(size.width*71.6/80,size.height*5.89/90+winDif*2*alpha*alpha)); energyBar->setType(kCCProgressTimerTypeRadial); energyBar->setPercentage(moveCount*20); addChild(energyBar,4,2*10000000+20); }
void CCTransitionRadialCCW::onEnter() { CCTransitionScene::onEnter(); // create a transparent color layer // in which we are going to add our rendertextures CCSize size = CCDirector::sharedDirector()->getWinSize(); // create the second render texture for outScene CCRenderTexture *outTexture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height); if (NULL == outTexture) { return; } outTexture->getSprite()->setAnchorPoint(ccp(0.5f,0.5f)); outTexture->setPosition(ccp(size.width/2, size.height/2)); outTexture->setAnchorPoint(ccp(0.5f,0.5f)); // render outScene to its texturebuffer outTexture->clear(0,0,0,1); outTexture->begin(); m_pOutScene->visit(); outTexture->end(); // Since we've passed the outScene to the texture we don't need it. this->hideOutShowIn(); // We need the texture in RenderTexture. CCProgressTimer *outNode = CCProgressTimer::progressWithTexture(outTexture->getSprite()->getTexture()); // but it's flipped upside down so we flip the sprite outNode->getSprite()->setFlipY(true); // Return the radial type that we want to use outNode->setType(radialType()); outNode->setPercentage(100.f); outNode->setPosition(ccp(size.width/2, size.height/2)); outNode->setAnchorPoint(ccp(0.5f,0.5f)); // create the blend action CCAction * layerAction = CCSequence::actions ( CCProgressFromTo::actionWithDuration(m_fDuration, 100.0f, 0.0f), CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)), NULL ); // run the blend action outNode->runAction(layerAction); // add the layer (which contains our two rendertextures) to the scene this->addChild(outNode, 2, kSceneRadial); }
bool BattleLayer::init() { if(!CCLayer::init()) return false; m_label = CCLabelTTF::create("第1波", "", 40); m_label->setPosition(ccp(320,800)); m_label->retain(); addChild(m_label); m_effectLabel = CCLabelTTF::create("", "", 30); m_effectLabel->setPosition(ccp(320,750)); m_effectLabel->setColor(ccc3(255,0,0)); addChild(m_effectLabel); m_guardLabel = CCLabelTTF::create("", "", 30); m_guardLabel->setPosition(ccp(320,700)); m_guardLabel->setColor(ccc3(255,255,0)); addChild(m_guardLabel); m_enemySprite = CCSprite::create("icons/0020.png"); m_enemySprite->retain(); CCSprite* hpbg = CCSprite::create("hpbar_bg.png"); CCProgressTimer* hpbar = CCProgressTimer::create(CCSprite::create("hpbar_fore.png")); hpbg->setPosition(ccp(50,100)); hpbar->setPosition(ccp(50,100)); hpbar->setType(kCCProgressTimerTypeBar); hpbar->setBarChangeRate(ccp(1,0)); hpbar->setPercentage(100); hpbar->setMidpoint(CCPointZero); hpbar->setTag(0); m_enemySprite->addChild(hpbg); m_enemySprite->addChild(hpbar); addChild(m_enemySprite,SpritezOrder::Enemy); m_cardbattleLayer = CardBattleLayer::create(); m_cardbattleLayer->retain(); m_setTrapLayer = SetTrapLayer::create(); addChild(m_setTrapLayer); m_pauseSprite = CCSprite::create("pause.png"); m_pauseSprite->setPosition(ccp(590,910)); addChild(m_pauseSprite); return true; }
CCProgressTimer* CCTransitionProgressOutIn::progressTimerNodeWithRenderTexture(CCRenderTexture* texture) { CCSize size = CCDirector::sharedDirector()->getWinSize(); CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite()); // but it is flipped upside down so we flip the sprite pNode->getSprite()->setFlipY(true); pNode->setType( kCCProgressTimerTypeBar ); pNode->setMidpoint(ccp(0.5f, 0.5f)); pNode->setBarChangeRate(ccp(1, 1)); pNode->setPercentage(100); pNode->setPosition(ccp(size.width/2, size.height/2)); pNode->setAnchorPoint(ccp(0.5f,0.5f)); return pNode; }