cocos2dx 3.6
framework extends LayerEx.lua
46行 没有返回 callback()导致touch事件不能继续分发,红色部分是我新加
function Layer:onTouch(callback, isMultiTouches, swallowTouches)
if type(isMultiTouches) ~= “boolean” then isMultiTouches = false end
if type(swallowTouches) ~= “boolean” then swallowTouches = false end
self:registerScriptTouchHandler(function(state, ...)
local args = {...}
local event = {name = state}
if isMultiTouches then
args = args
local points = {}
for i = 1, #args, 3 do
local x, y, id = args*, args*, args*
points = {x = x, y = y, id = id}
end
event.points = points
else
event.x = args
event.y = args
end
return callback(event)
end, isMultiTouches, 0, swallowTouches)
self:setTouchEnabled(true)
return self
end***