addEventListenerWithSceneGraphPriority第二个参数好像没啥用

void EventDispatcher::addEventListenerWithSceneGraphPriority(EventListener* listener, Node* node)
{
CCASSERT(listener && node, “Invalid parameters.”);
CCASSERT(!listener->isRegistered(), “The listener has been registered.”);

if (!listener->checkAvailable())
    return;

listener->setAssociatedNode(node);
listener->setFixedPriority(0);
listener->setRegistered(true);

addEventListener(listener);

}

看源码就是关联了一下节点, 也没别的地方用到.

/** Sets the node associated with this listener */
inline void setAssociatedNode(Node* node) { _node = node; };

/** Gets the node associated with this listener
 *  @return nullptr if it's a fixed priority listener, otherwise return non-nullptr
 */
inline Node* getAssociatedNode() const { return _node; };

有用的,getAssociatedNode()在很多地方被调用,比如

/** Pauses all listeners which are associated the specified target. */
void pauseEventListenersForTarget(Node* target, bool recursive = false);

/** Resumes all listeners which are associated the specified target. */
void resumeEventListenersForTarget(Node* target, bool recursive = false);

当你移除这个节点的时候,绑定到节点上的事件监听器也就移除了。所以不是没用哦。

:2:赞!!!!!