mirror of https://github.com/axmolengine/axmol.git
add disableCascadeOpacity to ProtectedNode and Scale9Sprite
This commit is contained in:
parent
21cb90bf12
commit
84cf0ee834
|
@ -417,4 +417,17 @@ void ProtectedNode::disableCascadeColor()
|
|||
}
|
||||
}
|
||||
|
||||
void ProtectedNode::disableCascadeOpacity()
|
||||
{
|
||||
_displayedOpacity = _realOpacity;
|
||||
|
||||
for(auto child : _children){
|
||||
child->updateDisplayedOpacity(255);
|
||||
}
|
||||
|
||||
for(auto child : _protectedChildren){
|
||||
child->updateDisplayedOpacity(255);
|
||||
}
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -162,6 +162,7 @@ public:
|
|||
virtual void updateDisplayedOpacity(GLubyte parentOpacity) override;
|
||||
virtual void updateDisplayedColor(const Color3B& parentColor) override;
|
||||
virtual void disableCascadeColor() override;
|
||||
virtual void disableCascadeOpacity()override;
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
ProtectedNode();
|
||||
virtual ~ProtectedNode();
|
||||
|
|
|
@ -1021,6 +1021,19 @@ y+=ytranslate; \
|
|||
}
|
||||
}
|
||||
|
||||
void Scale9Sprite::disableCascadeOpacity()
|
||||
{
|
||||
_displayedOpacity = _realOpacity;
|
||||
|
||||
for(auto child : _children){
|
||||
child->updateDisplayedOpacity(255);
|
||||
}
|
||||
|
||||
for(auto child : _protectedChildren){
|
||||
child->updateDisplayedOpacity(255);
|
||||
}
|
||||
}
|
||||
|
||||
Sprite* Scale9Sprite::getSprite()const
|
||||
{
|
||||
return _scale9Image;
|
||||
|
|
|
@ -305,6 +305,7 @@ namespace ui {
|
|||
virtual void updateDisplayedOpacity(GLubyte parentOpacity) override;
|
||||
virtual void updateDisplayedColor(const Color3B& parentColor) override;
|
||||
virtual void disableCascadeColor() override;
|
||||
virtual void disableCascadeOpacity() override;
|
||||
|
||||
Sprite* getSprite()const;
|
||||
|
||||
|
|
|
@ -568,8 +568,11 @@ bool UIS9CascadeOpacityAndColor::init()
|
|||
rgba->addChild(blocks_scaled_with_insets);
|
||||
auto actions = Sequence::create(FadeIn::create(1),
|
||||
TintTo::create(1, 0, 255, 0),
|
||||
TintTo::create(1, 255, 255, 255),
|
||||
FadeOut::create(1),
|
||||
TintTo::create(1, 255, 0, 255),
|
||||
CallFunc::create([=](){
|
||||
rgba->setCascadeColorEnabled(false);
|
||||
rgba->setCascadeOpacityEnabled(false);
|
||||
}),
|
||||
nullptr);
|
||||
auto repeat = RepeatForever::create(actions);
|
||||
rgba->runAction(repeat);
|
||||
|
|
Loading…
Reference in New Issue