测试了好多遍都是一个个传过来的
local layer = cc.Layer:create()
:addTo(self)
local function onTouchesBegan(touches, event)
local count = 0
for k,v in pairs(touches) do
count = count + 1
print("count", count)
print("onTouchesBegan",count,v, v:getLocation().x, v:getLocation().y)
end
end
local function onTouchesMoved(touches, event)
end
local listener = cc.EventListenerTouchAllAtOnce:create()
listener:registerScriptHandler(onTouchesBegan,cc.Handler.EVENT_TOUCHES_BEGAN )
listener:registerScriptHandler(onTouchesMoved,cc.Handler.EVENT_TOUCHES_MOVED )
local eventDispatcher = layer:getEventDispatcher()
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, layer)
每次都是count = 1
多个手指点也是传多个进来,那么跟OneByOne 有什么区别呢?
count = 1