Class cc.ProtectedNode

Class Summary
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

cc.ProtectedNode()
A class inhert from cc.Node, use for saving some protected children in other list.

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)`
  • cleanup()
    Stops itself and its children and protected children's all running actions and schedulers
  • <static> cc.ProtectedNode.create()
    create a cc.ProtectedNode object;
    Deprecated:
    since v3.0, please use new cc.ProtectedNode() instead.
    Returns:
    cc.ProtectedNode
  • ctor()
    Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
  • {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
  • onEnter()
    Calls its parent's onEnter and calls its protected children's onEnter
  • 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()

  • onExit()
    Calls its parent's onExit and calls its protected children's onExit
  • 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:
    cc.ProtectedNode#removeAllProtectedChildrenWithCleanup
  • 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.

  • updateDisplayedColor(parentColor)
    Updates itself and its protected children displayed color, if opacity cascade is enable, its children also update.
    Parameters:
    {cc.Color} parentColor
  • updateDisplayedOpacity(parentOpacity)
    Updates itself and its protected children displayed opacity, if opacity cascade is enable, its children also update.
    Parameters:
    {Number} parentOpacity
  • visit(ctx)
    transforms and draws itself, and visit its children and protected children.
    Parameters:
    {CanvasRenderingContext2D|WebGLRenderingContext} ctx
    context of renderer