本文整理汇总了C++中CCProgressTimer::setVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ CCProgressTimer::setVisible方法的具体用法?C++ CCProgressTimer::setVisible怎么用?C++ CCProgressTimer::setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCProgressTimer
的用法示例。
在下文中一共展示了CCProgressTimer::setVisible方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createRedStartPrompt
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;
}
示例2: createRedStartToTableArrows
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;
}
示例3: OnSkillPublicCallBack
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!");
}
示例4: InitLayer
//.........这里部分代码省略.........
CC_BREAK_IF(pBtnCommon==NULL);
pBtnCommon->setPosition(ccp(SCREEN_WIDTH - 60,58));
pMenu->addChild(pBtnCommon,enZOrderFront,enTagBtnCommonAttack);
CCLabelBMFont* pCommonAttackFont = CCLabelBMFont::create("1","fonts/mhp_num.fnt");
pCommonAttackFont->setPosition(pBtnCommon->getPosition());
this->addChild(pCommonAttackFont,enZOrderFront,enTagCommonAttackFont);
CCSprite * pCommon3 = CCSprite::create("gameui/skill_common.png");
CC_BREAK_IF(pCommon3==NULL);
pCommon3->setColor(ccRED);
pCommon3->setOpacity(100.f);
//创建普通攻击CD
CCProgressTimer* pProgressCommonAttackCD = CCProgressTimer::create(pCommon3);
CC_BREAK_IF(pProgressCommonAttackCD==NULL);
pProgressCommonAttackCD->setType(kCCProgressTimerTypeRadial);
pProgressCommonAttackCD->setMidpoint(ccp(0.5f,0.5f));
pProgressCommonAttackCD->setPercentage(0.f);
pProgressCommonAttackCD->setPosition(pBtnCommon->getPosition());
this->addChild(pProgressCommonAttackCD,enZOrderFront+1,enTagCommonAttackCD);
//创建技能按钮
for (int i=enTagBtnSkill1;i<=enTagBtnSkill5;i++)
{
char szName[NAME_LEN] = {0};
int skilltemp = -1;
if(i==enTagBtnSkill1){
skilltemp = m_nSkill_1_ID;
}else if(i==enTagBtnSkill2){
skilltemp = m_nSkill_2_ID;
}else if(i==enTagBtnSkill3){
skilltemp = m_nSkill_3_ID;
}else if(i==enTagBtnSkill4){
skilltemp = m_nSkill_4_ID;
}else if(i==enTagBtnSkill5){
skilltemp = m_nSkill_5_ID;
}
if(skilltemp==-1){
continue;
}
sprintf(szName,"Skill/r%d_s%d.png",pPro->GetRoleID(),skilltemp);
CCSprite * pSpr_n = CCSprite::create(szName);
CC_BREAK_IF(pSpr_n==NULL);
CCSprite * pSpr_p = CCSprite::create(szName);
CC_BREAK_IF(pSpr_p==NULL);;
pSpr_p->setColor(ccBLUE);
CCSprite * pSpr_d = CCSprite::create(szName);
CC_BREAK_IF(pSpr_d==NULL);
pSpr_d->setOpacity(150.f);
CCSprite * pSpr_CD = CCSprite::create(szName);
CC_BREAK_IF(pSpr_CD==NULL);
pSpr_CD->setColor(ccRED);
//创建技能按钮
CCMenuItemSprite * pBtn = CCMenuItemSprite::create(pSpr_n,pSpr_p,pSpr_d,this,menu_selector(CNFRockerLayer::OnBtnCallBack));
CC_BREAK_IF(pBtn==NULL);
pMenu->addChild(pBtn,enZOrderFront,i);
if(i==enTagBtnSkill1) pBtn->setPosition(ccp(pBtnCommon->getPositionX()+10,pBtnCommon->getPositionY()+90));
else if(i==enTagBtnSkill2) pBtn->setPosition(ccp(pBtnCommon->getPositionX()-110,pBtnCommon->getPositionY()-5));
else if(i==enTagBtnSkill3) pBtn->setPosition(ccp(pBtnCommon->getPositionX()-70,pBtnCommon->getPositionY()+70));
else if(i==enTagBtnSkill4) pBtn->setPosition(ccp(pBtnCommon->getPositionX()-200,pBtnCommon->getPositionY()-5));
else if(i==enTagBtnSkill5) pBtn->setPosition(ccp(pBtnCommon->getPositionX()+10,pBtnCommon->getPositionY()+170));
//创建技能CD
CCProgressTimer* pProgress = CCProgressTimer::create(pSpr_p);
CC_BREAK_IF(pProgress==NULL);
pProgress->setType(kCCProgressTimerTypeRadial);
pProgress->setMidpoint(ccp(0.5f,0.5f));
pProgress->setPercentage(0.f);
pProgress->setPosition(pBtn->getPosition());
this->addChild(pProgress,enZOrderFront+1,i+100); //技能CD标签 = 技能标签 + 100
//创建公共CD
CCProgressTimer* pProgressCD = CCProgressTimer::create(pSpr_CD);
CC_BREAK_IF(pProgressCD==NULL);
pProgressCD->setType(kCCProgressTimerTypeRadial);
pProgressCD->setMidpoint(ccp(0.5f,0.5f));
pProgressCD->setPercentage(0.f);
pProgressCD->setPosition(pBtn->getPosition());
this->addChild(pProgressCD,enZOrderFront+2,i+200); //技能CD标签 = 技能标签 + 200
pProgressCD->setVisible(false);
}
}
//更新函数
schedule(schedule_selector(CNFRockerLayer::update));
return true;
} while (false);
CCLog("Fun CNFRockerLayer::InitLayer Error!");
return false;
}
示例5: update
//.........这里部分代码省略.........
CCMenuItemSprite * pBtn = dynamic_cast<CCMenuItemSprite *>(pMenu->getChildByTag(i));
CC_BREAK_IF(pBtn==NULL);
switch (i)
{
case enTagBtnSkill1:
{
//同步技能CD
pProgress->setPercentage( 100*(float)pPro->GetSkillInfo_1().nSkill_CD_Time_Temp/(float)pPro->GetSkillInfo_1().nSkill_CD_Time );
//判断按钮是否可按
if (pPro->GetSkillInfo_1().nSkill_CD_Time_Temp == 0 && m_bIsPublicCD==false) pBtn->setEnabled(true);
else pBtn->setEnabled(false);
}break;
case enTagBtnSkill2:
{
pProgress->setPercentage( 100*(float)pPro->GetSkillInfo_2().nSkill_CD_Time_Temp/(float)pPro->GetSkillInfo_2().nSkill_CD_Time );
if (pPro->GetSkillInfo_2().nSkill_CD_Time_Temp == 0 && m_bIsPublicCD==false) pBtn->setEnabled(true);
else pBtn->setEnabled(false);
}break;
case enTagBtnSkill3:
{
pProgress->setPercentage( 100*(float)pPro->GetSkillInfo_3().nSkill_CD_Time_Temp/(float)pPro->GetSkillInfo_3().nSkill_CD_Time );
if (pPro->GetSkillInfo_3().nSkill_CD_Time_Temp == 0 && m_bIsPublicCD==false) pBtn->setEnabled(true);
else pBtn->setEnabled(false);
}break;
case enTagBtnSkill4:
{
pProgress->setPercentage( 100*(float)pPro->GetSkillInfo_4().nSkill_CD_Time_Temp/(float)pPro->GetSkillInfo_4().nSkill_CD_Time );
if (pPro->GetSkillInfo_4().nSkill_CD_Time_Temp == 0 && m_bIsPublicCD==false) pBtn->setEnabled(true);
else pBtn->setEnabled(false);
}break;
case enTagBtnSkill5:
{
pProgress->setPercentage( 100*(float)pPro->GetSkillInfo_5().nSkill_CD_Time_Temp/(float)pPro->GetSkillInfo_5().nSkill_CD_Time );
if (pPro->GetSkillInfo_5().nSkill_CD_Time_Temp == 0 && m_bIsPublicCD==false)
pBtn->setEnabled(true);
else
pBtn->setEnabled(false);
}break;
}
}
CCProgressTimer* pProgressCom = dynamic_cast<CCProgressTimer *>(getChildByTag(enTagCommonAttackCD));
if(pProgressCom!=NULL){
pProgressCom->setPercentage( 100*pPro->GetCommonAttackCDBFB());
}
CCLabelBMFont* pComonFont = dynamic_cast<CCLabelBMFont *>(getChildByTag(enTagCommonAttackFont));
if(pComonFont!=NULL){
if(pPro->GetCommonAttackStatus()!=0){
pComonFont->setString(CCString::createWithFormat("%d",pPro->GetCommonAttackStatus())->m_sString.c_str());
}
}
//判断是否有技能刚释放
bool bIsSkillStart = false;
if (pPro->GetSkillInfo_1().nSkill_CD_Time_Temp==pPro->GetSkillInfo_1().nSkill_CD_Time-1) bIsSkillStart = true;
if (pPro->GetSkillInfo_2().nSkill_CD_Time_Temp==pPro->GetSkillInfo_2().nSkill_CD_Time-1) bIsSkillStart = true;
if (pPro->GetSkillInfo_3().nSkill_CD_Time_Temp==pPro->GetSkillInfo_3().nSkill_CD_Time-1) bIsSkillStart = true;
if (pPro->GetSkillInfo_4().nSkill_CD_Time_Temp==pPro->GetSkillInfo_4().nSkill_CD_Time-1) bIsSkillStart = true;
if (pPro->GetSkillInfo_5().nSkill_CD_Time_Temp==pPro->GetSkillInfo_5().nSkill_CD_Time-1) bIsSkillStart = true;
//若有技能刚释放
if (bIsSkillStart==true)
{
m_bIsPublicCD = true;
this->runAction(CCSequence::create(CCDelayTime::create(1.f),CCCallFunc::create(this,callfunc_selector(CNFRockerLayer::OnSkillPublicCallBack)),NULL));
for (int i=enTagBtnSkill1;i<=enTagBtnSkill5;i++)
{
//判断是否显示公共CD
bool bIsSkillPublicCD = false;
if (i==enTagBtnSkill1 && pPro->GetSkillInfo_1().nSkill_CD_Time_Temp==0) bIsSkillPublicCD = true;
else if (i==enTagBtnSkill2 && pPro->GetSkillInfo_2().nSkill_CD_Time_Temp==0) bIsSkillPublicCD = true;
else if (i==enTagBtnSkill3 && pPro->GetSkillInfo_3().nSkill_CD_Time_Temp==0) bIsSkillPublicCD = true;
else if (i==enTagBtnSkill4 && pPro->GetSkillInfo_4().nSkill_CD_Time_Temp==0) bIsSkillPublicCD = true;
else if (i==enTagBtnSkill5 && pPro->GetSkillInfo_5().nSkill_CD_Time_Temp==0) bIsSkillPublicCD = true;
//若显示公共CD
if (bIsSkillPublicCD==true)
{
//显示公共CD
CCProgressTimer* pProgress = dynamic_cast<CCProgressTimer *>(getChildByTag(i+200));
CC_BREAK_IF(pProgress==NULL);
pProgress->setVisible(true);
pProgress->setPercentage(99.f);
pProgress->runAction(CCSequence::create(CCProgressTo::create(_NF_PUBLIC_SKILL_CD_,0),NULL));
}
}
}
}
}
return ;
} while (false);
CCLog("Fun CNFRockerLayer::update Error!");
}