setCameraMask for cocostudio-ui

This commit is contained in:
lvlong 2015-02-12 09:24:04 +08:00
parent 6304a89462
commit ee03bb8eea
5 changed files with 29 additions and 1 deletions

View File

@ -1575,7 +1575,7 @@ public:
/** get & set camera mask, the node is visible by the camera whose camera flag & node's camera mask is true */
unsigned short getCameraMask() const { return _cameraMask; }
void setCameraMask(unsigned short mask, bool applyChildren = true);
virtual void setCameraMask(unsigned short mask, bool applyChildren = true);
CC_CONSTRUCTOR_ACCESS:
// Nodes should be created using create();

View File

@ -431,4 +431,17 @@ void ProtectedNode::disableCascadeOpacity()
}
}
void ProtectedNode::setCameraMask(unsigned short mask, bool applyChildren)
{
Node::setCameraMask(mask, applyChildren);
if (applyChildren)
{
for (auto& iter: _protectedChildren)
{
iter->setCameraMask(mask);
}
}
}
NS_CC_END

View File

@ -163,6 +163,7 @@ public:
virtual void updateDisplayedColor(const Color3B& parentColor) override;
virtual void disableCascadeColor() override;
virtual void disableCascadeOpacity()override;
virtual void setCameraMask(unsigned short mask, bool applyChildren = true) override;
CC_CONSTRUCTOR_ACCESS:
ProtectedNode();
virtual ~ProtectedNode();

View File

@ -1335,4 +1335,17 @@ namespace ui {
return this->getScaleX();
}
void Scale9Sprite::setCameraMask(unsigned short mask, bool applyChildren)
{
Node::setCameraMask(mask, applyChildren);
if(_scale9Image)
_scale9Image->setCameraMask(mask,applyChildren);
for(auto& iter: _protectedChildren)
{
iter->setCameraMask(mask);
}
}
}}

View File

@ -376,6 +376,7 @@ namespace ui {
virtual float getScaleY() const override;
virtual float getScale() const override;
using Node::getScaleZ;
virtual void setCameraMask(unsigned short mask, bool applyChildren = true) override;
protected:
void updateCapInset();
void updatePositions();