【AB加密】Android不再进行加密
parent
2d73b2d13a
commit
cfeedca679
|
|
@ -241,7 +241,7 @@ public class AutoPack : EditorWindow
|
|||
ExportAS(i);
|
||||
ReplaceFromProject(i);
|
||||
ReplaceConfigAndVersion(i);
|
||||
EncryptAB(i);
|
||||
//EncryptAB(i);
|
||||
GitUpdate(i);
|
||||
CreateLogFile(i);
|
||||
StartGradleBuild(i);
|
||||
|
|
@ -250,7 +250,7 @@ public class AutoPack : EditorWindow
|
|||
case 1: // 只替换AB
|
||||
ReplaceFromAB(i);
|
||||
ReplaceConfigAndVersion(i);
|
||||
EncryptAB(i);
|
||||
//EncryptAB(i);
|
||||
GitUpdate(i);
|
||||
CreateLogFile(i);
|
||||
StartGradleBuild(i);
|
||||
|
|
|
|||
|
|
@ -46,8 +46,7 @@ namespace GameLogic {
|
|||
string url = Util.DataPath + bundleName.ToLower();
|
||||
if (File.Exists(url))
|
||||
{
|
||||
//AssetBundle bundle = AssetBundle.LoadFromFile(url, 0, GameLogic.AppConst.EncyptBytesLength);
|
||||
AssetBundle bundle = AssetBundle.LoadFromMemory(GameLogic.MEncyptUtil.DecyptAB(File.ReadAllBytes(url), GameLogic.AppConst.EncyptKey, GameLogic.AppConst.EncyptBytesLength));
|
||||
AssetBundle bundle = MEncyptUtil.LoadAssetBundle(url, AppConst.EncyptKey, AppConst.EncyptBytesLength);
|
||||
if (bundle != null)
|
||||
{
|
||||
bundleName = bundleName.Replace("lua/", "").Replace(".unity3d", "");
|
||||
|
|
|
|||
|
|
@ -77,7 +77,33 @@ namespace GameLogic {
|
|||
File.WriteAllBytes(path, rb);
|
||||
}
|
||||
|
||||
public static AssetBundle LoadAssetBundle(string path, string encryptKey, ulong offset)
|
||||
{
|
||||
AssetBundle ab;
|
||||
if (AppConst.PlatformPath.Equals("Android"))
|
||||
{
|
||||
ab = AssetBundle.LoadFromFile(path, 0, offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
ab = AssetBundle.LoadFromMemory(GameLogic.MEncyptUtil.DecyptAB(File.ReadAllBytes(path), encryptKey, offset));
|
||||
}
|
||||
return ab;
|
||||
}
|
||||
|
||||
public static AssetBundleCreateRequest LoadAssetBundleAsync(string path, string encryptKey, ulong offset)
|
||||
{
|
||||
AssetBundleCreateRequest ab;
|
||||
if (AppConst.PlatformPath.Equals("Android"))
|
||||
{
|
||||
ab = AssetBundle.LoadFromFileAsync(path, 0, offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
ab = AssetBundle.LoadFromMemoryAsync(GameLogic.MEncyptUtil.DecyptAB(File.ReadAllBytes(path), encryptKey, offset));
|
||||
}
|
||||
return ab;
|
||||
}
|
||||
//[MenuItem("Build/TEST")]
|
||||
//static void load()
|
||||
//{
|
||||
|
|
|
|||
|
|
@ -369,8 +369,8 @@ namespace ResMgr
|
|||
#if XNCS
|
||||
XNCSUtils.BeginSample("LoadAssetBundle:{0}",path);
|
||||
#endif
|
||||
assetBundle = AssetBundle.LoadFromMemory(GameLogic.MEncyptUtil.DecyptAB(File.ReadAllBytes(fullPath), GameLogic.AppConst.EncyptKey, GameLogic.AppConst.EncyptBytesLength));
|
||||
//assetBundle = AssetBundle.LoadFromFile(fullPath, 0, GameLogic.AppConst.EncyptBytesLength);
|
||||
|
||||
assetBundle = GameLogic.MEncyptUtil.LoadAssetBundle(fullPath, GameLogic.AppConst.EncyptKey, GameLogic.AppConst.EncyptBytesLength);
|
||||
#if XNCS
|
||||
XNCSUtils.EndSample();
|
||||
#endif
|
||||
|
|
@ -398,8 +398,8 @@ namespace ResMgr
|
|||
{
|
||||
if (BaseLogger.isDebug) BaseLogger.LogFormat("<color=#00FF00>LoadAssetBundleAsyn:{0}</color>", path);
|
||||
abLoaderState = ABLoaderState.Loading;
|
||||
//AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(fullPath, 0, GameLogic.AppConst.EncyptBytesLength);
|
||||
AssetBundleCreateRequest request = AssetBundle.LoadFromMemoryAsync(GameLogic.MEncyptUtil.DecyptAB(File.ReadAllBytes(fullPath), GameLogic.AppConst.EncyptKey, GameLogic.AppConst.EncyptBytesLength));
|
||||
|
||||
AssetBundleCreateRequest request = GameLogic.MEncyptUtil.LoadAssetBundleAsync(fullPath, GameLogic.AppConst.EncyptKey, GameLogic.AppConst.EncyptBytesLength);
|
||||
while (!request.isDone)
|
||||
{
|
||||
progress = request.progress;
|
||||
|
|
|
|||
|
|
@ -180,8 +180,7 @@ namespace ResMgr
|
|||
string path = string.Format("LZMA/ResConfigs").ToLower() + ResConfig.ABExtName;
|
||||
#endif
|
||||
string fullPath = PathHelper.GetFullPath (path);
|
||||
//AssetBundle ab = AssetBundle.LoadFromFile(fullPath, 0, GameLogic.AppConst.EncyptBytesLength);
|
||||
AssetBundle ab = AssetBundle.LoadFromMemory(GameLogic.MEncyptUtil.DecyptAB(File.ReadAllBytes(fullPath), GameLogic.AppConst.EncyptKey, GameLogic.AppConst.EncyptBytesLength));
|
||||
AssetBundle ab = GameLogic.MEncyptUtil.LoadAssetBundle(path, GameLogic.AppConst.EncyptKey, GameLogic.AppConst.EncyptBytesLength);
|
||||
ResPathConfig = ab.LoadAsset<ResourcePathConfig>("ResourcePathConfig");
|
||||
ab.Unload(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -519,7 +519,7 @@ namespace ResUpdate
|
|||
/// </summary>
|
||||
List<ResourceFile> GetNewResourceFiles()
|
||||
{
|
||||
AssetBundle bundle = AssetBundle.LoadFromFile(UpdateConfigs.PersistentDataPath + UpdateConfigs.FILES);//, 0, AppConst.EncyptBytesLength);
|
||||
AssetBundle bundle = MEncyptUtil.LoadAssetBundle(UpdateConfigs.PersistentDataPath + UpdateConfigs.FILES, "", 0);
|
||||
ResourceFiles files = bundle.LoadAsset<ResourceFiles>("game");
|
||||
List<ResourceFile> list = files.files;
|
||||
bundle.Unload(true);
|
||||
|
|
@ -532,7 +532,7 @@ namespace ResUpdate
|
|||
/// <returns></returns>
|
||||
List<ResourceFile> GetStreamResourceFiles()
|
||||
{
|
||||
AssetBundle bundle = AssetBundle.LoadFromFile(UpdateConfigs.StreamPath + UpdateConfigs.FILES);//, 0, AppConst.EncyptBytesLength);
|
||||
AssetBundle bundle = MEncyptUtil.LoadAssetBundle(UpdateConfigs.StreamPath + UpdateConfigs.FILES, "", 0);
|
||||
if (bundle != null)
|
||||
{
|
||||
ResourceFiles files = bundle.LoadAsset<ResourceFiles>("game");
|
||||
|
|
|
|||
|
|
@ -58,8 +58,7 @@ namespace GameEditor.FrameTool
|
|||
//遍历内部unity3d数据
|
||||
public static List<ResourceFile> GetFilesList(string filesPath, string encryptKey = null)
|
||||
{
|
||||
//UnityEngine.AssetBundle bundle = UnityEngine.AssetBundle.LoadFromFile(filesPath + UpdateConfigs.FILES);
|
||||
UnityEngine.AssetBundle bundle = UnityEngine.AssetBundle.LoadFromMemory(GameLogic.MEncyptUtil.DecyptAB(File.ReadAllBytes(filesPath + UpdateConfigs.FILES), encryptKey, 0));
|
||||
UnityEngine.AssetBundle bundle = GameLogic.MEncyptUtil.LoadAssetBundle(filesPath + UpdateConfigs.FILES, encryptKey, 0);
|
||||
ResourceFiles files = bundle.LoadAsset<ResourceFiles>("game");
|
||||
bundle.Unload(true);
|
||||
return files.files;
|
||||
|
|
@ -342,7 +341,7 @@ namespace GameEditor.FrameTool
|
|||
Directory.CreateDirectory(dirName);
|
||||
}
|
||||
File.Copy(local_files_path + file, cpPath + file, true);
|
||||
if (local_version.EncyptKey != null && local_version.EncyptKey != "")
|
||||
if (local_version.EncyptKey != null && local_version.EncyptKey != "" && AppConst.PlatformPath.Equals("IOS"))
|
||||
{
|
||||
MEncyptUtil.EncyptAB(cpPath + file, local_version.EncyptKey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,8 +89,7 @@ public class GameStart : MonoBehaviour
|
|||
{
|
||||
path = AppConst.StreamPath + splashFilePath;
|
||||
}
|
||||
//bundle = AssetBundle.LoadFromFile(path, 0, GameLogic.AppConst.EncyptBytesLength);
|
||||
bundle = AssetBundle.LoadFromMemory(GameLogic.MEncyptUtil.DecyptAB(File.ReadAllBytes(path), GameLogic.AppConst.EncyptKey, GameLogic.AppConst.EncyptBytesLength));
|
||||
bundle = MEncyptUtil.LoadAssetBundle(path, AppConst.EncyptKey, AppConst.EncyptBytesLength);
|
||||
GameObject gameObj = bundle.LoadAsset<GameObject>("SplashPanel");
|
||||
GameObject gameObj2 = Instantiate(gameObj, Vector3.zero, Quaternion.identity);
|
||||
Image image = gameObj2.transform.Find("Canvas/image").GetComponent<Image>();
|
||||
|
|
|
|||
|
|
@ -125,8 +125,7 @@ namespace GameLogic {
|
|||
{
|
||||
path = AppConst.StreamPath + updateFilePath;
|
||||
}
|
||||
//bundle = AssetBundle.LoadFromFile(path, 0, GameLogic.AppConst.EncyptBytesLength);
|
||||
bundle = AssetBundle.LoadFromMemory(GameLogic.MEncyptUtil.DecyptAB(File.ReadAllBytes(path), GameLogic.AppConst.EncyptKey, GameLogic.AppConst.EncyptBytesLength));
|
||||
bundle = MEncyptUtil.LoadAssetBundle(path, AppConst.EncyptKey, AppConst.EncyptBytesLength);
|
||||
if (bundle == null)
|
||||
{
|
||||
XDebug.Log.error(string.Format("{0} 不存在,请检查", path ));
|
||||
|
|
|
|||
Loading…
Reference in New Issue