void SkillButton::cool(float time) { ProgressTimer *prog = static_cast<ProgressTimer *>(this->getChildByTag(PROGRESS_TAG)); //判断之前是否已经设置了冷却效�? if (!prog) { prog = ProgressTimer::create(Sprite::create("image/1.png")); prog->setType( ProgressTimer::Type::RADIAL); prog->setTag(PROGRESS_TAG); this->addChild(prog); prog->setAnchorPoint(Vec2(0.f, 0.f)); prog->setPosition(0.f, 0.f); prog->setScale(this->getContentSize().width / prog->getContentSize().width); //调整到和图标一样大�? } auto to1 = Sequence::createWithTwoActions(ProgressTo::create(0, 100.f), ProgressTo::create(time, 0.f)); prog->runAction(to1); }