【已经解决】cocos2dx v3.2 为什么我的代码监听的 touch 事件,用于都只有 touch begin

cocos2dx v3.2 为什么我的代码监听的 touch 事件,用于都只有 touch begin 没有 touch move 和 touch end

在以下的代码中只有 onTouchBegan 回调被触发,其他的 touch 回调都没有被触发,这是为什么呢?

local onTouchMovedonTouchMoved

function()
return console.info(" message")
end
local onTouchEndedonTouchEnded

function()
return console.info(" message")
end
local onTouchCancelledonTouchCancelled

function()
return console.info(" message")
end
local createcreate

function()
local container
= cc.Layer:create() container:setTouchEnabled(
true)

local listener1
= cc.EventListenerTouchOneByOne:create() listener1:registerScriptHandler(onTouchBegan, cc.Handler.EVENT_TOUCH_BEGAN) listener1:registerScriptHandler(onTouchMoved, cc.Handler.EVENT_TOUCH_MOVED) listener1:registerScriptHandler(onTouchEnded, cc.Handler.EVENT_TOUCH_ENDED) listener1:registerScriptHandler(onTouchCancelled, cc.Handler.EVENT_TOUCH_CANCELLED) container:getEventDispatcher():addEventListenerWithSceneGraphPriority(listener1, container)
return container
end
return { create
= create}

onTouchBegan() 是否返回了 true ,touch事件 需要在touchBegan中返回true 才能将事件继续传递给move end 等

的确是 没有 return true 造成的,问题已经解决了,非常感谢!