function touchEvent() print("your code") end local function createCocostudioUI() local button = Button:create() button:setTouchEnabled(true) button:loadTextures("animationbuttonnormal.png", "animationbuttonpressed.png", "") button:setPosition(CCPoint(200,200)) button:addTouchEventListener(touchEvent) return button end ```
local function buttonListener(sender, eventType)
end
参数
我只是用来打印touchEvent 中的信息,可是断点从来都不进去
local button = ccui.Button:create()
加了ccui 报错,显示ccui是空值
这个是 cocos2dx 3.1的 lua-tests 你的引擎版本是多少 太旧的就更新一下吧? 或者你执行一下官方的tests有没有问题? 没有问题的话按照例子写一下呗
谢谢大家,我搞定了,local ui = TouchGroup:create() lua 中没有UILayer