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


C++ CCProgressTimer::runAction方法代码示例

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


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

示例1: onEnter

//------------------------------------------------------------------
//
// 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()));
}
开发者ID:DangoXJ,项目名称:TuJinZhi,代码行数:38,代码来源:ActionsProgressTest.cpp

示例2: onEnter

void SpriteProgressToHorizontal::onEnter()
{
    SpriteDemo::onEnter();
    
    CCSize s = CCDirector::sharedDirector()->getWinSize();
    
    CCProgressTo *to1 = CCProgressTo::create(2, 100);
    CCProgressTo *to2 = CCProgressTo::create(2, 100);
    
    CCProgressTimer *left = CCProgressTimer::progressWithFile(s_pPathSister1);
    left->setType(kCCProgressTimerTypeHorizontalBarLR);
    //    Setup for a bar starting from the left since the midpoint is 0 for the x
    left->setMidpoint(ccp(0,0));
    //    Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
    left->setBarChangeRate(ccp(1, 0));
    addChild(left);
    left->setPosition(ccp(100, s.height/2));
    left->runAction( CCRepeatForever::create(to1));
    
    CCProgressTimer *right = CCProgressTimer::progressWithFile(s_pPathSister2);
    right->setType(kCCProgressTimerTypeHorizontalBarRL);
    //    Setup for a bar starting from the left since the midpoint is 1 for the x
    right->setMidpoint(ccp(1, 0));
    //    Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
    right->setBarChangeRate(ccp(1, 0));
    addChild(right);
    right->setPosition(ccp(s.width-100, s.height/2));
    right->runAction( CCRepeatForever::create(to2));
}
开发者ID:qiuxu,项目名称:Cocos2dWindows,代码行数:29,代码来源:ActionsProgressTest.cpp

示例3: setUpdateView

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;
}
开发者ID:hzfeibao,项目名称:Defender,代码行数:27,代码来源:LoadingLayer.cpp

示例4: skillDecCD

//******************************************************************************
// 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));
}
开发者ID:haoliumilan,项目名称:AgainstSango,代码行数:30,代码来源:Card.cpp

示例5: makeSkillCD

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);

}
开发者ID:david4750,项目名称:ShootGame,代码行数:25,代码来源:ControllPanel.cpp

示例6: changeEnergyBarAnimation

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);
}
开发者ID:nooboracle,项目名称:ForTest,代码行数:9,代码来源:ASBotEnergyBar.cpp

示例7: JDCallback

//进度动作  
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));  
}  
开发者ID:zhengpeiyang,项目名称:cocosLearn,代码行数:12,代码来源:HelloWorldScene.cpp

示例8: onEnter

//------------------------------------------------------------------
//
// SpriteProgressToVertical
//
//------------------------------------------------------------------
void SpriteProgressToVertical::onEnter()
{
	SpriteDemo::onEnter();
	
	CCSize s = CCDirector::sharedDirector()->getWinSize();
	
	CCProgressTo *to1 = CCProgressTo::actionWithDuration(2, 100);
	CCProgressTo *to2 = CCProgressTo::actionWithDuration(2, 100);
	
	CCProgressTimer *left = CCProgressTimer::progressWithFile(s_pPathSister1);
	left->setType( kCCProgressTimerTypeVerticalBarBT );
	addChild(left);
	left->setPosition(CCPointMake(100, s.height/2));
	left->runAction( CCRepeatForever::actionWithAction(to1));
	
	CCProgressTimer *right = CCProgressTimer::progressWithFile(s_pPathSister2);
	right->setType( kCCProgressTimerTypeVerticalBarTB );
	addChild(right);
	right->setPosition(CCPointMake(s.width-100, s.height/2));
	right->runAction( CCRepeatForever::actionWithAction(to2));
}
开发者ID:BigHand,项目名称:cocos2d-x,代码行数:26,代码来源:ProgressActionsTest.cpp

示例9: onEnter

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);
}
开发者ID:noriter,项目名称:nit,代码行数:52,代码来源:CCTransitionRadial.cpp

示例10: onEnter

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);
}
开发者ID:006,项目名称:ios_lab,代码行数:51,代码来源:CCTransitionRadial.cpp

示例11: changeEnergyBarAnimation

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));
     */
}
开发者ID:nooboracle,项目名称:ForTest,代码行数:23,代码来源:ASEnergyBar.cpp

示例12: addChild

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)));
}
开发者ID:edison9888,项目名称:__graduation_project,代码行数:16,代码来源:MCSkillBar.cpp

示例13: changeHeart

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);
    }
}
开发者ID:nooboracle,项目名称:ForTest,代码行数:47,代码来源:ASHeart.cpp

示例14: onEnter

// 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);
}
开发者ID:aselushat,项目名称:Cocos2d-WindowsPhone,代码行数:43,代码来源:CCTransitionProgress.cpp

示例15: skillCoolHandler

void OptionLayer::skillCoolHandler(CCObject* pSender)
{
    OptionLayer *optionLayer = global->optionLayer;
    UIImageView* skillView = (UIImageView*)pSender;
    global->hero->setAllowMove(false);//动画执行期间角色不可移动
    float SumCD = 10.0f;
    //判断指向对象是否相等来初始化cd时间
    if(optionLayer->getSkill_attack_1() == skillView){
        SumCD = optionLayer->skill_SumCD_1;
        global->hero->RunAttackAction_1();		//执行特殊攻击1动画
    }else if(optionLayer->getSkill_attack_2() == skillView){
        SumCD = optionLayer->skill_SumCD_2;
    }else if(optionLayer->getSkill_attack_3() == skillView){
        SumCD = optionLayer->skill_SumCD_3;
    }else if(optionLayer->getSkill_attack() == skillView){
        SumCD = optionLayer->skill_SumCD_0;
        global->hero->RunAttackAction();		//执行普通攻击动画
    }else if(optionLayer->getBlood_bottle() == skillView){
        SumCD = optionLayer->blood_SumCD;
    }else if(optionLayer->getMagic_bottle() == skillView){
        SumCD = optionLayer->magic_SumCD;
    }
    skillView->setTouchEnabled(false);		//CD开始,禁止本技能使用
    //初始化 cd遮罩
    CCTexture2D *spriteTx = CCTextureCache::sharedTextureCache()->addImage("Skill_UI/cooling_cover.png");
    CCSprite * SkillCover = CCSprite::createWithTexture(spriteTx);
    CCProgressTimer *skillTimer  = CCProgressTimer::create(SkillCover);
    skillTimer->setOpacity(125);							//透明度
    skillTimer->setPosition(skillView->getPosition());//将进度遮罩设置在技能图标位置上
    optionLayer->getSkillUI()->addChild(skillTimer);
    
    skillTimer->setType(kCCProgressTimerTypeRadial);//扇形
    skillTimer->setPercentage(100);
    skillTimer->setReverseProgress(true);
    
    CCProgressTo* cdAction=CCProgressTo::create(SumCD, 100);
    CCCallFuncND* func=CCCallFuncND::create(this, callfuncND_selector(OptionLayer::allowToClick),skillView);//附带skillView参数 方便cd结束后处理
    CCFiniteTimeAction* seq=CCSequence::create(cdAction,func,NULL);
    skillTimer->runAction(seq);
}
开发者ID:HUjinshuai,项目名称:-,代码行数:40,代码来源:OptionLayer.cpp


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