基于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下载
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
Python 2.7.18 Release Date: April 20, 2020
简单使用说明
- 选择li2cpp打包方式 & 设置裁剪等级
- 下载dnSpy github dnSpy
- dnSpy打开路径 注意路径是你的路径 C:\Program Files\Unity\Hub\Editor\2019.4.22f1c1\Editor\Data\il2cpp\build\deploy\net471\Unity.IL2CPP.dll
- 找到方法 => 右键编辑方法 namespace Unity.IL2CPP.AssemblyConverter.ConvertAssemblies
public static IEnumerable<NPath> 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));
}
//...此处省略
}
- dnSpy => 文件 => 保存模块 => 即可
android mono出包方式很快不用管
andriod li2cpp出包方式现在也变得很快了1分钟作用就能出包 并且不受业务逻辑代码量增大而增加编译时间
ios li2cpp只能用这种方式出包 也是同理删除掉Assembly-CSharp的代码 项目发布变得非常快 xcode无需编译业务代码
1.加快编译速度修改
2.global-metadata.dat算是加固
anti-anti unity global-metadata.dat
只支持安卓
QuickSDKTool_Win_P34 很古老的u8sdk修改而来 支持aar合并到apk
引擎修改
C:\Program Files\Unity\Hub\Editor\2019.4.22f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Apk\UnityManifest.xml
<activity android:name="com.unity3d.player.UnityPlayerActivity"
...
</activity>
修改为
<activity android:name="com.usdk.main.UsdkMainActivity"
...
</activity>
母包项目
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/CSharpLuaForUnity
https://github.com/yanghuan/proton
https://github.com/CatImmortal/ComponentAutoBindTool
https://github.com/zhaoguohao/SUIFW
https://github.com/PureMVC/puremvc-csharp-standard-framework
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。