зеркало из https://github.com/microsoft/cocos2d-x.git
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into develop
This commit is contained in:
Коммит
fec04dd6ae
|
@ -882,13 +882,16 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* event)
|
|||
|
||||
void EventDispatcher::updateListeners(Event* event)
|
||||
{
|
||||
CCASSERT(_inDispatch > 0, "If program goes here, there should be event in dispatch.");
|
||||
|
||||
auto onUpdateListeners = [this](const EventListener::ListenerID& listenerID)
|
||||
{
|
||||
auto listenersIter = _listenerMap.find(listenerID);
|
||||
if (listenersIter == _listenerMap.end())
|
||||
return;
|
||||
|
||||
|
||||
auto listeners = listenersIter->second;
|
||||
|
||||
auto fixedPriorityListeners = listeners->getFixedPriorityListeners();
|
||||
auto sceneGraphPriorityListeners = listeners->getSceneGraphPriorityListeners();
|
||||
|
||||
|
@ -935,14 +938,8 @@ void EventDispatcher::updateListeners(Event* event)
|
|||
{
|
||||
listeners->clearFixedListeners();
|
||||
}
|
||||
|
||||
if (listenersIter->second->empty())
|
||||
{
|
||||
_priorityDirtyFlagMap.erase(listenersIter->first);
|
||||
delete listenersIter->second;
|
||||
_listenerMap.erase(listenersIter);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if (event->getType() == Event::Type::TOUCH)
|
||||
{
|
||||
|
@ -954,6 +951,24 @@ void EventDispatcher::updateListeners(Event* event)
|
|||
onUpdateListeners(__getListenerID(event));
|
||||
}
|
||||
|
||||
if (_inDispatch > 1)
|
||||
return;
|
||||
|
||||
CCASSERT(_inDispatch == 1, "_inDispatch should be 1 here.");
|
||||
|
||||
for (auto iter = _listenerMap.begin(); iter != _listenerMap.end();)
|
||||
{
|
||||
if (iter->second->empty())
|
||||
{
|
||||
_priorityDirtyFlagMap.erase(iter->first);
|
||||
delete iter->second;
|
||||
iter = _listenerMap.erase(iter);
|
||||
}
|
||||
else
|
||||
{
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_toAddedListeners.empty())
|
||||
{
|
||||
|
|
|
@ -349,7 +349,7 @@ bool GLProgram::updateUniformLocation(GLint location, const GLvoid* data, unsign
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool updated = true;
|
||||
tHashUniformEntry *element = nullptr;
|
||||
HASH_FIND_INT(_hashForUniforms, &location, element);
|
||||
|
|
|
@ -104,8 +104,7 @@ void QuadCommand::generateMaterialID()
|
|||
void QuadCommand::useMaterial() const
|
||||
{
|
||||
_shader->use();
|
||||
|
||||
_shader->setUniformsForBuiltins();
|
||||
_shader->setUniformsForBuiltins(_mv);
|
||||
|
||||
//Set texture
|
||||
GL::bindTexture2D(_textureID);
|
||||
|
|
|
@ -1182,10 +1182,11 @@ Issue4129::Issue4129()
|
|||
|
||||
// After test, remove it.
|
||||
_eventDispatcher->removeEventListener(_customlistener);
|
||||
|
||||
_customlistener = nullptr;
|
||||
|
||||
_bugFixed = true;
|
||||
});
|
||||
|
||||
|
||||
auto removeAllTouchItem = MenuItemFont::create("Remove All Listeners", [this](Ref* sender){
|
||||
auto senderItem = static_cast<MenuItemFont*>(sender);
|
||||
senderItem->setString("Only 'Reset' item could be clicked");
|
||||
|
@ -1220,7 +1221,10 @@ Issue4129::Issue4129()
|
|||
|
||||
Issue4129::~Issue4129()
|
||||
{
|
||||
_eventDispatcher->removeEventListener(_customlistener);
|
||||
if (_customlistener)
|
||||
{
|
||||
_eventDispatcher->removeEventListener(_customlistener);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Issue4129::title() const
|
||||
|
|
Загрузка…
Ссылка в новой задаче