diff --git a/cocos2dx/event_dispatcher/CCEventDispatcher.cpp b/cocos2dx/event_dispatcher/CCEventDispatcher.cpp index 9a982949f9..cb796bb0a7 100644 --- a/cocos2dx/event_dispatcher/CCEventDispatcher.cpp +++ b/cocos2dx/event_dispatcher/CCEventDispatcher.cpp @@ -121,6 +121,7 @@ void EventDispatcher::addEventListenerWithSceneGraphPriority(EventListener* list void EventDispatcher::addEventListenerWithFixedPriority(EventListener* listener, int fixedPriority) { CCASSERT(!listener->_isRegistered, "The listener has been registered."); + CCASSERT(fixedPriority != 0, "0 priority is forbidden for fixed priority since it's used for scene graph based priority."); if (!listener->checkAvaiable()) return; diff --git a/cocos2dx/event_dispatcher/CCEventDispatcher.h b/cocos2dx/event_dispatcher/CCEventDispatcher.h index db04f54ea8..621262272b 100644 --- a/cocos2dx/event_dispatcher/CCEventDispatcher.h +++ b/cocos2dx/event_dispatcher/CCEventDispatcher.h @@ -59,7 +59,7 @@ public: * @param listener The listener of a specified event. * @param node The priority of the listener is based on the draw order of this node. * @note The priority of scene graph will be fixed value 0. So the order of listener item - * in the vector will be ' <0, =0, scene graph, >0'. + * in the vector will be ' <0, scene graph (0 priority), >0'. */ void addEventListenerWithSceneGraphPriority(EventListener* listener, Node* node); @@ -67,6 +67,7 @@ public: * @param listener The listener of a specified event. * @param fixedPriority The fixed priority of the listener. * @note A lower priority will be called before the ones that have a higher value. + * 0 priority is forbidden for fixed priority since it's used for scene graph based priority. */ void addEventListenerWithFixedPriority(EventListener* listener, int fixedPriority);