读取ccs导出的场景文件,无法响应触摸事件

大家帮忙看一个问题,代码如下:

如果把读取 场景 文件 注释, onTouch 的函数就能够响应
但是如果读取 场景 文件,加入 当前 Layer 后onTouch就没有响应
以为是zorder的原因,做一些测试,发现不是这个原因
大家有遇到类似的情况么?

知道GUIReader的控件需要加入到TouchGroup中,然后用addwidget添加

    require("app/scenes/Hero")

TownScene = class(“TownScene”, function()
return display.newScene(“TownScene”)
end)

TownScene.rootLayer = nil
–从ccs中导出的场景的根节点
TownScene.scene_rootnode = nil
–主角
TownScene.hero = nil

function TownScene:onTouch(event, x, y)
print(event,",",x,",",",",y)
if event == “began” then
local p = CCPoint(x, y)
–self.hero:moveTo(2, x, y)
–self.player:setViewPointByPlayer()
elseif event ~= “moved” then
print(event)
end

return true

end

function TownScene:update(dt)

end

function TownScene:ctor()
–local group = TouchGroup:create()
–self:addChild(group)

self.rootLayer = display.newLayer()
self.rootLayer:setTouchEnabled(true)
self:addChild(self.rootLayer)


--读取场景
self.scene_rootnode = SceneReader:sharedSceneReader():createNodeWithSceneFile("publish/town_1.json")
self.scene_rootnode:setTouchEnabled(true)
self.rootLayer:addChild(self.scene_rootnode, 1000, 1)


--初始化hero
self.hero = Hero.create()
self.hero:bindNode(self.scene_rootnode:getChildByTag(10031))
self.hero:play("run")
--self.hero._node:setPosition(ccp(100, 200))


--self.rootLayer:setZOrder(200)
--增加touch相应
self.rootLayer:addNodeEventListener(cc.NODE_TOUCH_EVENT, function(event)  return self:onTouch(event.name, event.x, event.y) end)


--帧更新事件回调函数

self:addNodeEventListener(cc.NODE_ENTER_FRAME_EVENT,function(dt) self:update(dt) end)
self:scheduleUpdate()
end

function TownScene:loadArmatureData()
–CCArmatureDataManager:sharedArmatureDataManager():addArmatureFileInfo(“armature/HeroAnimation.ExportJson”)

end

function TownScene:onEnter()

end

function TownScene:onExit()

end

return TownScene

自己顶下,难道大家都没有遇到类似情况
我是新手

请问这个问题解决了吗?我也遇到类似问题了
我是先加载一个瓦片地图,然后又加载了studio导出的json
瓦片地图层无法响应触摸事件

顶一下 遇到一样的问题 :12: