安装插件luaide-lite-up
最新版本v0.2.7
配置LuaDebug.lua文件相关
去luaide-lite的github项目源码仓库https://github.com/hsu2017/luaide-lite,直接到目录:luaide-lite/test/cocos/src/中,下载LuaDebug.lua文件和luaide文件夹,添加进cocos项目中。
1、将LuaDebug.lua文件拷贝到luaideLite/目录中。
2、将luaide文件夹拷贝到根目录下。
配置launch.json
{
"name": "Cocos2-launch",
"type": "lua",
"request": "launch",
"runtimeType": "Cocos2",
"localRoot": "${workspaceRoot}",
"commandLine": [
"-portrait",
"-workdir ${workspaceRoot}/../",
"-write-debug-log runtime.log",
"-file src/main.lua"
],
"port": 7004,
"exePath": "${workspaceRoot}/../win32/simulator.exe",
"printType": 1
}
修改主函数main,调用插件启动监听
-- debug : luaide-lite
if isSimulator() == 1 then --如果是模拟器,开启debug模式
local BREAKINFOFUNC, XPCALLFUNC = require("luaideLite.LuaDebug")("localhost", 7004)
cc.FileUtils:getInstance():setPopupNotify(false)
end
代码中的luaideLite.LuaDebug是存放Debug文件的位置。
本文暂时没有评论,来添加一个吧(●'◡'●)