void InitLua() { //创建导出列表文件 CreateLuaExportFile(); //创建空LuaBinder文件 CreateEmptyLuaBinder(); ToLuaMenu.ClearLuaFiles(); //创建Lua目录 Directory.CreateDirectory(PathTool.GetAbsolutePath(ResLoadLocation.Resource, c_LuaLibFilePath)); Directory.CreateDirectory(PathTool.GetAbsolutePath(ResLoadLocation.Resource, c_LuaFilePath)); string resPath = Application.dataPath + "/Script/Core/Editor/res/LuaLib"; string aimPath = Application.dataPath + "/Resources/LuaLib"; string pluginsResPath = Application.dataPath + "/Script/Core/Lua/ToLua/PluginsRes"; string pluginsPath = Application.dataPath + "/Lua/Plugins"; //复制lua初始库文件 FileTool.CopyDirectory(resPath, aimPath); //拷贝LuaPlugins文件 FileTool.CopyDirectory(pluginsResPath, pluginsPath); //修改文件名 dllx -> dll FileTool.ChangeFileName(pluginsPath + "/x86/tolua.dllx", pluginsPath + "/x86/tolua.dll"); FileTool.ChangeFileName(pluginsPath + "/x86_64/tolua.dllx", pluginsPath + "/x86_64/tolua.dll"); FileTool.ChangeFileName(pluginsPath + "/CString.dllx", pluginsPath + "/x86_64/CString.dll"); FileTool.ChangeFileName(pluginsPath + "/Debugger.dllx", pluginsPath + "/x86_64/Debugger.dll"); //初始Warp ToLuaMenu.GenLuaAll(); //自动生成Lua配置文件 GetLuaFileList(); SaveLuaConfig(); //创建启动文件 string luaMainPath = Application.dataPath + "/Resources/Lua/luaMain.txt"; string content = "print(\"lua is launch!\");"; ResourceIOTool.WriteStringByFile(luaMainPath, content); //设置宏 ProjectBuildService.SetScriptDefine("USE_LUA"); AssetDatabase.Refresh(); string info = "Lua初始化完成,\n"; info += "请先生成luaWarp文件 (Window -> Lua设置管理器 -> 重新生成Lua Warp脚本)\n"; info += "再重新生成打包设置(Window -> 打包设置管理器 -> 自动添加Resources目录下的资源并保存)\n"; Debug.Log(info); }
void InitLua() { //创建导出列表文件 CreateLuaExportFile(); //创建空LuaBinder文件 CreateEmptyLuaBinder(); ToLuaMenu.ClearLuaFiles(); //创建Lua目录 Directory.CreateDirectory(PathTool.GetAbsolutePath(ResLoadLocation.Resource, c_LuaLibFilePath)); Directory.CreateDirectory(PathTool.GetAbsolutePath(ResLoadLocation.Resource, c_LuaFilePath)); string resPath = Application.dataPath + "/Script/Core/Editor/res/LuaLib"; string aimPath = Application.dataPath + "/Resources/LuaLib"; //复制lua初始库文件 FileTool.CopyDirectory(resPath, aimPath); ProjectBuildService.SetScriptDefine("USE_LUA"); AssetDatabase.Refresh(); }