cocos-2dx lua 怎么点击button可以转换场景
展开全部
1、引入这个类:require "GuiConstants"
2、下面是回调函数的处理.
local function menuZhuCeCallback(sender,eventType)
print(sender:getTag())
if eventType == ccui.TouchEventType.began then
print("按下按钮")
elseif eventType == ccui.TouchEventType.moved then
print("按下按钮移动")
elseif eventType == ccui.TouchEventType.ended then
print("放开按钮")
elseif eventType == ccui.TouchEventType.canceled then
print("取消点击")
end
2、下面是回调函数的处理.
local function menuZhuCeCallback(sender,eventType)
print(sender:getTag())
if eventType == ccui.TouchEventType.began then
print("按下按钮")
elseif eventType == ccui.TouchEventType.moved then
print("按下按钮移动")
elseif eventType == ccui.TouchEventType.ended then
print("放开按钮")
elseif eventType == ccui.TouchEventType.canceled then
print("取消点击")
end
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询