Ejemplo n.º 1
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)));
}
Ejemplo n.º 2
0
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);
}
Ejemplo n.º 3
0
//------------------------------------------------------------------
//
// SpriteProgressToRadial
//
//------------------------------------------------------------------
void SpriteProgressToRadial::onEnter()
{
    SpriteDemo::onEnter();
    
    CCSize s = CCDirector::sharedDirector()->getWinSize();

    CCProgressTo *to1 = CCProgressTo::create(2, 100);
    CCProgressTo *to2 = CCProgressTo::create(2, 100);

    CCProgressTimer *left = CCProgressTimer::create(CCSprite::create(s_pPathSister1));
    left->setType( kCCProgressTimerTypeRadial );
    addChild(left);
    left->setPosition(CCPointMake(100, s.height/2));
    left->runAction( CCRepeatForever::create(to1));
    
    CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathBlock));
    right->setType(kCCProgressTimerTypeRadial);
    // Makes the ridial CCW
    right->setReverseProgress(true);
    addChild(right);
    right->setPosition(CCPointMake(s.width-100, s.height/2));
    right->runAction( CCRepeatForever::create(to2));
}
Ejemplo n.º 4
0
void CCProgressTimerCreator::setAttribute(CCNode* pNode, const char* strName, const char* strValue, bool bCache)
{
    if(bCache)
        mAttrMap[strName] = strValue;

    else
    {
        CCProgressTimer* pProgressTimer = (CCProgressTimer*)pNode;
        if(strcmp(strName, "file") == 0 || strcmp(strName, "plist") == 0 )
            return;

        if(strcmp(strName, "type") == 0)
            pProgressTimer->setType((CCProgressTimerType)ccXmlAttrParse::toInt(strValue));

        if(strcmp(strName, "percent") == 0)
            pProgressTimer->setPercentage(ccXmlAttrParse::toFloat(strValue));

        if(strcmp(strName, "midpos") == 0)
            pProgressTimer->setMidpoint(ccXmlAttrParse::toPoint(strValue));

        if(strcmp(strName, "rate") == 0)
            pProgressTimer->setBarChangeRate(ccXmlAttrParse::toPoint(strValue));

        if(strcmp(strName, "reverse") == 0)
            pProgressTimer->setReverseProgress(ccXmlAttrParse::toBool(strValue));

        if(strcmp(strName, "anchor") == 0)
            pProgressTimer->setAnchorPoint(ccXmlAttrParse::toPoint(strValue));

        if(strcmp(strName, "color") == 0)
            pProgressTimer->setColor(ccXmlAttrParse::toColor3B(strValue));

        else
            CCNodeRGBACreator::setAttribute(pNode, strName, strValue, bCache);
    }
}