mirror of https://github.com/axmolengine/axmol.git
Fixed bug with cascade opacity for control button.
This commit is contained in:
parent
369719481f
commit
fa45f3f4e0
|
@ -656,30 +656,32 @@ void ControlButton::onTouchEnded(Touch *pTouch, Event *pEvent)
|
|||
|
||||
void ControlButton::setOpacity(GLubyte opacity)
|
||||
{
|
||||
// XXX fixed me if not correct
|
||||
Control::setOpacity(opacity);
|
||||
// _opacity = opacity;
|
||||
//
|
||||
// Ref* child;
|
||||
// Array* children=getChildren();
|
||||
// CCARRAY_FOREACH(children, child)
|
||||
// {
|
||||
// RGBAProtocol* pNode = dynamic_cast<RGBAProtocol*>(child);
|
||||
// if (pNode)
|
||||
// {
|
||||
// pNode->setOpacity(opacity);
|
||||
// }
|
||||
// }
|
||||
|
||||
for (auto iter = _backgroundSpriteDispatchTable.begin(); iter != _backgroundSpriteDispatchTable.end(); ++iter)
|
||||
{
|
||||
iter->second->setOpacity(opacity);
|
||||
}
|
||||
|
||||
for (auto iter = _titleLabelDispatchTable.begin(); iter != _titleLabelDispatchTable.end(); ++iter)
|
||||
{
|
||||
iter->second->setOpacity(opacity);
|
||||
}
|
||||
}
|
||||
|
||||
GLubyte ControlButton::getOpacity() const
|
||||
void ControlButton::updateDisplayedOpacity(GLubyte parentOpacity)
|
||||
{
|
||||
return _realOpacity;
|
||||
Control::updateDisplayedOpacity(parentOpacity);
|
||||
|
||||
for (auto iter = _backgroundSpriteDispatchTable.begin(); iter != _backgroundSpriteDispatchTable.end(); ++iter)
|
||||
{
|
||||
iter->second->updateDisplayedOpacity(parentOpacity);
|
||||
}
|
||||
|
||||
for (auto iter = _titleLabelDispatchTable.begin(); iter != _titleLabelDispatchTable.end(); ++iter)
|
||||
{
|
||||
iter->second->updateDisplayedOpacity(parentOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
void ControlButton::setColor(const Color3B & color)
|
||||
|
@ -690,11 +692,26 @@ void ControlButton::setColor(const Color3B & color)
|
|||
{
|
||||
iter->second->setColor(color);
|
||||
}
|
||||
|
||||
for (auto iter = _titleLabelDispatchTable.begin(); iter != _titleLabelDispatchTable.end(); ++iter)
|
||||
{
|
||||
iter->second->setColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
const Color3B& ControlButton::getColor() const
|
||||
void ControlButton::updateDisplayedColor(const Color3B& parentColor)
|
||||
{
|
||||
return _realColor;
|
||||
Control::updateDisplayedColor(parentColor);
|
||||
|
||||
for (auto iter = _backgroundSpriteDispatchTable.begin(); iter != _backgroundSpriteDispatchTable.end(); ++iter)
|
||||
{
|
||||
iter->second->updateDisplayedColor(parentColor);
|
||||
}
|
||||
|
||||
for (auto iter = _titleLabelDispatchTable.begin(); iter != _titleLabelDispatchTable.end(); ++iter)
|
||||
{
|
||||
iter->second->updateDisplayedColor(parentColor);
|
||||
}
|
||||
}
|
||||
|
||||
void ControlButton::onTouchCancelled(Touch *pTouch, Event *pEvent)
|
||||
|
|
|
@ -181,11 +181,11 @@ public:
|
|||
virtual void onTouchMoved(Touch *touch, Event *event) override;
|
||||
virtual void onTouchEnded(Touch *touch, Event *event) override;
|
||||
virtual void onTouchCancelled(Touch *touch, Event *event) override;
|
||||
virtual GLubyte getOpacity(void) const override;
|
||||
virtual void setOpacity(GLubyte var) override;
|
||||
virtual const Color3B& getColor(void) const override;
|
||||
virtual void setColor(const Color3B&) override;
|
||||
|
||||
virtual void setOpacity(GLubyte var) override;
|
||||
virtual void updateDisplayedOpacity(GLubyte parentOpacity) override;
|
||||
virtual void setColor(const Color3B&) override;
|
||||
virtual void updateDisplayedColor(const Color3B& parentColor) override;
|
||||
|
||||
const std::string& getCurrentTitle() const { return _currentTitle; };
|
||||
std::string getCurrentTitle() { return _currentTitle; };
|
||||
|
|
Loading…
Reference in New Issue