思路如下:
把lua代码和资源包放在streamingAssets下,因为这个目录在安卓和IOS的工程上都可以找到对应的目录,因此,可以直接在发布出来的原生工程上加代码和资源包,因此就有了这个工具。
差一个加解密文件的代码,结构如下:
using System; using System.Collections.Generic; using System.IO; using System.Text; namespace OnceBuild { public sealed class XORFile { public static byte[] Encrypt(byte[] inData) { return inData; } public static bool Decrypt(byte[] inData,out byte[] outData) { outData = inData; return false; } public static bool Decrypt(ref byte[] data,out int start,out int end) { return false; } } }
加上这个代码工程放入OnceBuildFrameWork文件夹。具体加密自己实现下,这里我去掉加解密文件了
可以运行OnceBuildFrameWork/test/test场景来看效果,里面有说明文档。