Class cc.ProtectedNode
- Defined in: CCProtectedNode.js
- Extends cc.Node
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
A class inhert from cc.Node, use for saving some protected children in other list.
|
Method Summary
Class Detail
Method Detail
-
addProtectedChild(child, localZOrder, tag)Adds a child to the container with z order and tag If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
- Parameters:
- {cc.Node} child
- A child node
- {Number} localZOrder Optional
- Z order for drawing priority. Please refer to `setLocalZOrder(int)`
- {Number} tag Optional
- An integer to identify the node easily. Please refer to `setTag(int)`
-
<static> cc.ProtectedNode.create()create a cc.ProtectedNode object;
-
{cc.Node} getProtectedChildByTag(tag)Gets a child from the container with its tag
- Parameters:
- {Number} tag
- An identifier to find the child node.
- Returns:
- {cc.Node} a Node object whose tag equals to the input parameter
-
onEnterTransitionDidFinish()
Event callback that is invoked when the Node enters in the 'stage'.
If the Node enters the 'stage' with a transition, this event is called when the transition finishes.
If you override onEnterTransitionDidFinish, you shall call its parent's one, e.g. Node::onEnterTransitionDidFinish() -
onExitTransitionDidStart()
Event callback that is called every time the Node leaves the 'stage'.
If the Node leaves the 'stage' with a transition, this callback is called when the transition starts. -
removeAllProtectedChildren()Removes all children from the container with a cleanup.
- See:
- `removeAllChildrenWithCleanup(bool)`
-
removeAllProtectedChildrenWithCleanup(cleanup)Removes all children from the container, and do a cleanup to all running actions depending on the cleanup parameter.
- Parameters:
- {Boolean} cleanup Optional, Default: true
- true if all running actions on all children nodes should be cleanup, false otherwise.
-
removeProtectedChild(child, cleanup)Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter.
- Parameters:
- {cc.Node} child
- The child node which will be removed.
- {Boolean} cleanup Optional, Default: true
- true if all running actions and callbacks on the child node will be cleanup, false otherwise.
-
removeProtectedChildByTag(tag, cleanup)Removes a child from the container by tag value. It will also cleanup all running actions depending on the cleanup parameter
- Parameters:
- {Number} tag
- {Boolean} cleanup Optional, Default: true
-
reorderProtectedChild(child, localZOrder)Reorders a child according to a new z value.
- Parameters:
- {cc.Node} child
- An already added child node. It MUST be already added.
- {Number} localZOrder
- Z order for drawing priority. Please refer to setLocalZOrder(int)
-
sortAllProtectedChildren()
Sorts the children array once before drawing, instead of every time when a child is added or reordered.
This approach can improves the performance massively.