在 cocos2d 中使用哪个 EventDispatcher? Node::EventDispatcher 还是 Director::EventDispatcher?

Which EventDispatcher to use in cocos2d ? Node::EventDispatcher or Director::EventDispatcher?

在 cocos2d 中使用哪个 EventDispatcher? Node::EventDispatcher 还是 Director::EventDispatcher? 在参考了 Director class 和 Node class 的官方文档之后 Director Class Reference Cocos2d-x Node Class Reference Cocos2d-x 我有点困惑,使用

有什么区别
Director::getInstance()->getEventDispatcher() // consider this is used inside a class which is derived from Node class

this->getEventDispatcher() // consider this refers to a class derived from Node class

两者相同。 this->getEventDispatcher() 调用 CCNode 的 getEventDispatcher() 函数。它 returns _eventDispatcher.

_eventDispatcher = _director->getEventDispatcher(); // Check CCNode.cpp

所以这3个是一样的

Director::getInstance()->getEventDispatcher()->addEventListenerWith..

this->getEventDispatcher()->addEventListenerWith..

_eventDispatcher->addEventListenerWith..

注意:我刚刚检查了 Cocos2d-x 4.0