# LuaFramework_UGUI_V2 **Repository Path**: googleapp/LuaFramework_UGUI_V2 ## Basic Information - **Project Name**: LuaFramework_UGUI_V2 - **Description**: 原始地址 https://github.com/jarjin/LuaFramework_UGUI_V2.git - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 6 - **Forks**: 2 - **Created**: 2021-05-24 - **Last Updated**: 2022-06-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # LuaFramework_UGUI_V2 => CSharpLua_UGUI 基于tolua && CSharp.lua的热更新框架 支持C#/Lua双模运行|双模调试 > 开发的时候业务代码都用C#写 底层一点的代码就包装tolua wraper > 发布的时候业务代码全部转换为lua和预制体一起打包成assetbundle更新 > C#/Lua均可进行代码调试 方便定位问题 > C#可使用Visual Studio 2017+调试/Visual Studio Code > Lua可使用Visual Studio Code(LuaIde 插件调试)收费5元/月 调试Lua > Visual Studio Code添加Assets\LuaFramework\Lua目录即可 命令 #code 路径即可打开 Visual Studio Code下载 > [https://code.visualstudio.com/Download](https://code.visualstudio.com/Download) Lua适配可参考 > Assets\LuaFramework\Lua\UnityAdapter.lua > Assets\LuaFramework\Lua\LuaFramework\Wraper\*.lua 程序集说明 > 这是框架程序集所有框架代码都在这里 & 业务逻辑代码不要写在这里 & 框架请不要引用任何业务逻辑的代码 > \Assets\LuaFramework\LuaFramework.Runtime.asmdef > 框架需要热更新的代码可以写在这里 > \Assets\LuaFramework\Scripts\Compiled > 全局程序集: 业务逻辑代码都在这里 & 发布详见 加快li2cpp编译速度 > 业务逻辑代码最好不要添加程序集asmdef进去 > \Assets\Scripts\Compiled => Assembly-CSharp ### 原地址 [https://github.com/jarjin/LuaFramework_UGUI_V2](https://github.com/jarjin/LuaFramework_UGUI_V2) ### 环境 [Unity 2019.4.34f1c1](https://unity.cn/releases/lts/2019) [.NET 5.0运行环境](https://dotnet.microsoft.com/download/dotnet/5.0) [Python 2.7.18 Release Date: April 20, 2020](https://www.python.org/downloads/release/python-2718/) ### 使用 简单使用说明 > ![输入图片说明](https://images.gitee.com/uploads/images/2021/1027/161055_896d9f53_1067731.png "QQ截图20211027160557.png") ### 加快li2cpp编译速度 > 1. 选择li2cpp打包方式 & 设置裁剪等级 > ![输入图片说明](https://images.gitee.com/uploads/images/2021/1108/123404_3d15e621_1067731.png "li2cpp.png") > 2. 下载dnSpy [github dnSpy](https://github.com/dnSpy/dnSpy/releases) > 3. dnSpy打开路径 注意路径是你的路径 C:\Program Files\Unity\Hub\Editor\2019.4.22f1c1\Editor\Data\il2cpp\build\deploy\net471\Unity.IL2CPP.dll > 4. 找到方法 => 右键编辑方法 namespace Unity.IL2CPP.AssemblyConverter.ConvertAssemblies ``` public static IEnumerable ConvertAssemblies( ... ) { //...此处省略 if (assemblyDirectories != null) { list.AddRange(assemblyDirectories.SelectMany((NPath directory) => from f in directory.Files(false) where f.HasExtension(new string[] { "dll", "exe" }) && !f.FileName.Contains("Assembly-CSharp") // 此处的作用是忽略掉全局程序集,因为业务代码都在这里面,翻译lua之后不需要他造成编译时间浪费 // 加入代码 => && !f.FileName.Contains("Assembly-CSharp") select f)); } //...此处省略 } ``` > 5. dnSpy => 文件 => 保存模块 => 即可 > android mono出包方式很快不用管 > andriod li2cpp出包方式现在也变得很快了1分钟作用就能出包 并且不受业务逻辑代码量增大而增加编译时间 > ios li2cpp只能用这种方式出包 也是同理删除掉Assembly-CSharp的代码 项目发布变得非常快 xcode无需编译业务代码 ### 修改工具 1.加快编译速度修改 2.global-metadata.dat算是加固 [Il2CppAnti](https://gitee.com/googleapp/Il2CppAnti) ### global-metadata.dat 加固有缘可见 [anti-anti unity global-metadata.dat](http://googleapp.cc/archives/unityglobal-metadatadat) ### 渠道打包工具 只支持安卓 [QuickSDKTool_Win_P34 很古老的u8sdk修改而来 支持aar合并到apk](https://gitee.com/googleapp/QuickSDKTool_Win_P34) ### 渠道发布 引擎修改 ``` C:\Program Files\Unity\Hub\Editor\2019.4.22f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Apk\UnityManifest.xml 修改为 ``` 母包项目 LuaFramework_UGUI_V2\Usdk\Android\Usdk 母包发布路径 gradle -> app/Tasks/build/assemble -> LuaFramework_UGUI_V2\Assets\Plugins\Android\libs\Usdk.aar 渠道项目 LuaFramework_UGUI_V2\Usdk\Android\Platforms\LibChNone 渠道发布路径 gradle -> LibChNone/Tasks/build/assemble -> LuaFramework_UGUI_V2\Usdk\Android\Platforms\LibChNone\depends 剩下的参考 -> 渠道打包工具 ### 感谢 [https://github.com/yanghuan/CSharp.lua](https://github.com/yanghuan/CSharp.lua) [https://github.com/yanghuan/CSharpLuaForUnity](https://github.com/yanghuan/CSharpLuaForUnity) [https://github.com/yanghuan/proton](https://github.com/yanghuan/proton) [https://github.com/CatImmortal/ComponentAutoBindTool](https://github.com/CatImmortal/ComponentAutoBindTool) [https://github.com/zhaoguohao/SUIFW](https://github.com/zhaoguohao/SUIFW) [https://github.com/PureMVC/puremvc-csharp-standard-framework](https://github.com/PureMVC/puremvc-csharp-standard-framework) [https://github.com/hiram3512/HiSocket](https://github.com/hiram3512/HiSocket) [https://github.com/honghuachen/Usdk](https://github.com/honghuachen/Usdk)