Merge branch 'china/test' into china/dev
commit
69f7592c1e
|
|
@ -36,7 +36,7 @@ public class AutoPack : EditorWindow
|
|||
#elif UNITY_IOS
|
||||
static string Platform = "IOS";
|
||||
static string ConfigFileName = "config.txt";
|
||||
static string VersionFileName = "game.info";
|
||||
static string VersionFileName = "version.txt";
|
||||
#else
|
||||
static string Platform = "Android";
|
||||
static string ConfigFileName = "config.txt";
|
||||
|
|
@ -158,28 +158,47 @@ public class AutoPack : EditorWindow
|
|||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
Chooser[i] = EditorGUILayout.ToggleLeft(PackConfig[i].name, Chooser[i]);
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("编辑Config", GUILayout.Height(20f)))
|
||||
if (Chooser[i])
|
||||
{
|
||||
string tpath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[i].version + "/" + ConfigFileName;
|
||||
GameEditor.Util.ProcessUtil.OpenText(tpath);
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("编辑Config", GUILayout.Height(20f)))
|
||||
{
|
||||
string tpath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[i].version + "/" + ConfigFileName;
|
||||
GameEditor.Util.ProcessUtil.OpenText(tpath);
|
||||
}
|
||||
if (GUILayout.Button("编辑Version", GUILayout.Height(20f)))
|
||||
{
|
||||
string tpath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[i].version + "/" + VersionFileName;
|
||||
GameEditor.Util.ProcessUtil.OpenText(tpath);
|
||||
}
|
||||
if (GameLogic.AppConst.PlatformPath.Equals("Android"))
|
||||
{
|
||||
if (GUILayout.Button("编辑Gradle", GUILayout.Height(20f)))
|
||||
{
|
||||
string tpath = _MomPackPath + PackConfig[i].project + "/build.gradle";
|
||||
GameEditor.Util.ProcessUtil.OpenText(tpath);
|
||||
}
|
||||
if (GUILayout.Button("更新蓝鲸SDK", GUILayout.Height(20f)))
|
||||
{
|
||||
File.Copy(_MomPackPath + "BlueWhaleJar/app/build/outputs/aar/app-release.aar", _MomPackPath + PackConfig[i].project + "/libs/BlueWhale.aar", true);
|
||||
Debug.Log("更新完成");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GUILayout.Button("同步配置文件", GUILayout.Height(20f)))
|
||||
{
|
||||
ReplaceConfigAndVersion(i);
|
||||
}
|
||||
if (GUILayout.Button("开始混淆", GUILayout.Height(20f)))
|
||||
{
|
||||
EncryptAB(i);
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
if (GUILayout.Button("编辑Version", GUILayout.Height(20f)))
|
||||
{
|
||||
string tpath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[i].version + "/" + VersionFileName;
|
||||
GameEditor.Util.ProcessUtil.OpenText(tpath);
|
||||
}
|
||||
if (GUILayout.Button("编辑Gradle", GUILayout.Height(20f)))
|
||||
{
|
||||
string tpath = _MomPackPath + PackConfig[i].project + "/build.gradle";
|
||||
GameEditor.Util.ProcessUtil.OpenText(tpath);
|
||||
}
|
||||
if (GUILayout.Button("更新蓝鲸SDK", GUILayout.Height(20f)))
|
||||
{
|
||||
File.Copy(_MomPackPath + "BlueWhaleJar/app/build/outputs/aar/app-release.aar", _MomPackPath + PackConfig[i].project + "/libs/BlueWhale.aar", true);
|
||||
Debug.Log("更新完成");
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUILayout.EndVertical();
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
|
|
@ -238,6 +257,7 @@ public class AutoPack : EditorWindow
|
|||
ExportAS(i);
|
||||
ReplaceFromProject(i);
|
||||
ReplaceConfigAndVersion(i);
|
||||
//EncryptAB(i);
|
||||
GitUpdate(i);
|
||||
CreateLogFile(i);
|
||||
StartGradleBuild(i);
|
||||
|
|
@ -246,6 +266,7 @@ public class AutoPack : EditorWindow
|
|||
case 1: // 只替换AB
|
||||
ReplaceFromAB(i);
|
||||
ReplaceConfigAndVersion(i);
|
||||
//EncryptAB(i);
|
||||
GitUpdate(i);
|
||||
CreateLogFile(i);
|
||||
StartGradleBuild(i);
|
||||
|
|
@ -413,19 +434,64 @@ public class AutoPack : EditorWindow
|
|||
Debug.Log(PackConfig[index].name + ":替换AB包完成");
|
||||
}
|
||||
|
||||
// 加密AB包
|
||||
private static void EncryptAB(int index)
|
||||
{
|
||||
string toPath = _MomPackPath + PackConfig[index].project + "/src/main/assets/Android";
|
||||
if (GameLogic.AppConst.PlatformPath.Equals("IOS"))
|
||||
{
|
||||
toPath = _MomPackPath + PackConfig[index].project + "/Data/Raw/IOS";
|
||||
}
|
||||
|
||||
string json = File.ReadAllText(toPath + "/"+ VersionFileName);
|
||||
VersionTxt version = JsonUtility.FromJson<VersionTxt>(json);
|
||||
if (version.EncyptKey != null && version.EncyptKey != "")
|
||||
{
|
||||
string[] pathList = Directory.GetFiles(toPath, "*.unity3d", SearchOption.AllDirectories);
|
||||
float i = 0f;
|
||||
Debug.Log("文件数量;" + pathList.Length);
|
||||
foreach (string path in pathList)
|
||||
{
|
||||
GameLogic.MEncyptUtil.EncyptAB(path, version.EncyptKey);
|
||||
EditorUtility.DisplayProgressBar("正在加密:", path, i++ / pathList.Length);
|
||||
}
|
||||
EditorUtility.ClearProgressBar();
|
||||
Debug.Log(PackConfig[index].name + ":加密AB包完成");
|
||||
}
|
||||
else {
|
||||
|
||||
Debug.Log(PackConfig[index].name + ":无需加密");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 替换配置文件
|
||||
private static void ReplaceConfigAndVersion(int index)
|
||||
{
|
||||
EditorUtility.DisplayProgressBar("替换配置文件1", "", 0.5f);
|
||||
string fromPath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[index].version + "/";
|
||||
string toPath = _MomPackPath + PackConfig[index].project + "/Config/";
|
||||
File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true);
|
||||
File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true);
|
||||
EditorUtility.DisplayProgressBar("替换配置文件2", "", 0.5f);
|
||||
fromPath = toPath;
|
||||
toPath = _MomPackPath + PackConfig[index].project + "/src/main/assets/Android/";
|
||||
File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true);
|
||||
File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true);
|
||||
if (GameLogic.AppConst.PlatformPath.Equals("Android")) {
|
||||
|
||||
//EditorUtility.DisplayProgressBar("替换配置文件1", "", 0.5f);
|
||||
string fromPath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[index].version + "/";
|
||||
string toPath = _MomPackPath + PackConfig[index].project + "/Config/";
|
||||
File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true);
|
||||
File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true);
|
||||
//EditorUtility.DisplayProgressBar("替换配置文件2", "", 0.5f);
|
||||
fromPath = toPath;
|
||||
toPath = _MomPackPath + PackConfig[index].project + "/src/main/assets/Android/";
|
||||
File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true);
|
||||
File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
//EditorUtility.DisplayProgressBar("替换配置文件", "", 0.5f);
|
||||
string fromPath = ClientConfigManager.Instance.GetClientConfigPath() + "/Version/" + PackConfig[index].version + "/";
|
||||
string toPath = _MomPackPath + PackConfig[index].project + "/Data/Raw/IOS/";
|
||||
File.Copy(fromPath + ConfigFileName, toPath + ConfigFileName, true);
|
||||
File.Copy(fromPath + VersionFileName, toPath + VersionFileName, true);
|
||||
}
|
||||
|
||||
|
||||
Debug.Log(PackConfig[index].name+":配置文件替换完成");
|
||||
EditorUtility.ClearProgressBar();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +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 = MEncyptUtil.LoadAssetBundle(url, AppConst.EncyptKey, AppConst.EncyptBytesLength);
|
||||
if (bundle != null)
|
||||
{
|
||||
bundleName = bundleName.Replace("lua/", "").Replace(".unity3d", "");
|
||||
|
|
|
|||
|
|
@ -75,7 +75,8 @@ namespace GameLogic
|
|||
|
||||
public static int PIXELTOWORLD = 100;
|
||||
|
||||
public static ulong EncyptBytesLength = 128; // 资源加密空白字符长度,长度为0则不加密
|
||||
public static ulong EncyptBytesLength = 128; // 资源加密空白字符长度,长度为0则不加密
|
||||
public static string EncyptKey = ""; // 资源加密key值,空则不加密
|
||||
|
||||
#if UNITY_ANDROID
|
||||
public const string DOWNLOAD_URL_FORMAT = "{0}/Android/{1}/{2}{3}/";
|
||||
|
|
|
|||
|
|
@ -49,18 +49,56 @@ namespace SDK
|
|||
//退出游戏
|
||||
[DllImport("__Internal")]
|
||||
private static extern void m_SDK_SubmitExtraData(string areaName, string areaId, string roleName, string roleId, string roleGrade);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void m_SDK_SubmitExtraData_OneParam(string param);
|
||||
public override void SubmitExtraData(SDKSubmitExtraDataArgs args)
|
||||
{
|
||||
m_SDK_SubmitExtraData(args.zoneName, args.zoneID, args.roleName, args.roleID, args.roleLevel);
|
||||
m_SDK_SubmitExtraData_OneParam(
|
||||
args.dataType + "|" +
|
||||
args.serverID + "|" +
|
||||
args.serverName + "|" +
|
||||
args.zoneID + "|" +
|
||||
args.zoneName + "|" +
|
||||
args.roleID + "|" +
|
||||
args.roleName + "|" +
|
||||
args.roleLevel + "|" +
|
||||
args.guildID + "|" +
|
||||
args.Vip + "|" +
|
||||
args.moneyNum + "|" +
|
||||
args.roleCreateTime + "|" +
|
||||
args.roleLevelUpTime
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
[DllImport("__Internal")]
|
||||
private static extern void m_SDK_Pay(string money, string detail, string csId, string csName, string pid);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void m_SDK_Pay_OneParam(string param);
|
||||
public override void Pay(SDKPayArgs args)
|
||||
{
|
||||
m_SDK_Pay(args.price.ToString(), args.productDesc, args.roleID, args.extension, args.productId);
|
||||
|
||||
m_SDK_Pay_OneParam(
|
||||
args.productId + "|" +
|
||||
args.productName + "|" +
|
||||
args.productDesc + "|" +
|
||||
args.price + "|" +
|
||||
args.ratio + "|" +
|
||||
args.buyNum + "|" +
|
||||
args.coinNum + "|" +
|
||||
args.zoneId + "|" +
|
||||
args.serverID + "|" +
|
||||
args.serverName + "|" +
|
||||
args.accounted + "|" +
|
||||
args.roleID + "|" +
|
||||
args.roleName + "|" +
|
||||
args.roleLevel + "|" +
|
||||
args.vip + "|" +
|
||||
args.guildID + "|" +
|
||||
args.payNotifyUrl + "|" +
|
||||
args.extension
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,142 @@
|
|||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using LuaInterface;
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
|
||||
namespace GameLogic {
|
||||
public static class MEncyptUtil {
|
||||
//
|
||||
//加密/解密
|
||||
static byte[] crypt(byte[] data, string key)
|
||||
{
|
||||
int[] ri = new int[data.Length];
|
||||
byte[] cl = System.Text.Encoding.Default.GetBytes(key);
|
||||
for(long i = 0; i<data.Length; i++)
|
||||
{
|
||||
ri[i] = data[i] ^ cl[i % cl.Length];
|
||||
}
|
||||
byte[] rb = new byte[ri.Length * sizeof(int)];
|
||||
Buffer.BlockCopy(ri, 0, rb, 0, rb.Length);
|
||||
|
||||
|
||||
byte[] r = new byte[ri.Length];
|
||||
int x = 0;
|
||||
for (int i = 0; i < rb.Length; i++)
|
||||
{
|
||||
if(i%4 == 0)
|
||||
{
|
||||
r[x++] = rb[i];
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 加载AB包
|
||||
public static byte[] DecyptAB(byte[] data, string key, ulong offset)
|
||||
{
|
||||
byte[] rb ;
|
||||
|
||||
if (key == null || key == "")
|
||||
{
|
||||
rb = data;
|
||||
}
|
||||
else {
|
||||
rb = crypt(data, key);
|
||||
}
|
||||
byte[] r = new byte[rb.Length - (int)offset];
|
||||
for (int i = (int)offset; i < rb.Length; i++)
|
||||
{
|
||||
r[i - (int)offset] = rb[i];
|
||||
}
|
||||
return r;
|
||||
}
|
||||
// 文件加密
|
||||
public static void EncyptAB(string path, string key)
|
||||
{
|
||||
// 闪屏先不加密了
|
||||
if (Path.GetFileName(path).Contains("splashpanel"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (key == null || key == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
return;
|
||||
}
|
||||
byte[] data = File.ReadAllBytes(path);
|
||||
byte[] rb = crypt(data, key);
|
||||
|
||||
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()
|
||||
//{
|
||||
// byte[] a = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
|
||||
// string s = "";
|
||||
// for(int i = 0;i < a.Length; i++)
|
||||
// {
|
||||
// s += a[i];
|
||||
// }
|
||||
// XDebug.Log.l("a = " + s);
|
||||
|
||||
|
||||
|
||||
// byte[] b = crypt(a, "key");
|
||||
// s = "";
|
||||
// for (int i = 0; i < b.Length; i++)
|
||||
// {
|
||||
// s += b[i];
|
||||
// }
|
||||
// XDebug.Log.l("b = " + s);
|
||||
|
||||
|
||||
|
||||
// byte[] c = crypt(b, "key");
|
||||
// s = "";
|
||||
// for (int i = 0; i < c.Length; i++)
|
||||
// {
|
||||
// s += c[i];
|
||||
// }
|
||||
// XDebug.Log.l("c = " + s);
|
||||
|
||||
|
||||
// //File.ReadAllBytes("");
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ad73e333e7b929e43a333d72c073e873
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -85,6 +85,8 @@ namespace GameLogic
|
|||
if (File.Exists(VersionsFilePath))
|
||||
{
|
||||
VersionInfo = new Version(File.ReadAllText(VersionsFilePath, System.Text.Encoding.UTF8));
|
||||
// AB包加密key值
|
||||
AppConst.EncyptKey = VersionInfo.GetInfo("EncyptKey");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -96,6 +98,8 @@ namespace GameLogic
|
|||
{
|
||||
XDebug.Log.l("[VersionLoader OK ]=" + _www.text);
|
||||
VersionInfo = new Version(_www.text);
|
||||
// AB包加密key值
|
||||
AppConst.EncyptKey = VersionInfo.GetInfo("EncyptKey");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -369,8 +369,8 @@ namespace ResMgr
|
|||
#if XNCS
|
||||
XNCSUtils.BeginSample("LoadAssetBundle:{0}",path);
|
||||
#endif
|
||||
//assetBundle = AssetBundle.LoadFromMemory(XXTEA.Decrypt(File.ReadAllBytes(fullPath)));
|
||||
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(XXTEA.Decrypt(File.ReadAllBytes(fullPath)));
|
||||
|
||||
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(XXTEA.Decrypt(File.ReadAllBytes(fullPath)));
|
||||
AssetBundle ab = GameLogic.MEncyptUtil.LoadAssetBundle(fullPath, 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, AppConst.EncyptKey, 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, AppConst.EncyptKey, 0);
|
||||
if (bundle != null)
|
||||
{
|
||||
ResourceFiles files = bundle.LoadAsset<ResourceFiles>("game");
|
||||
|
|
|
|||
|
|
@ -248,6 +248,7 @@ namespace GameEditor.FrameTool {
|
|||
public string packageVersion;
|
||||
public string version;
|
||||
public string serverUrl;
|
||||
public string EncyptKey;
|
||||
//public string noticeChannel;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ namespace GameEditor.FrameTool
|
|||
}
|
||||
|
||||
//遍历内部unity3d数据
|
||||
public static List<ResourceFile> GetFilesList(string filesPath)
|
||||
public static List<ResourceFile> GetFilesList(string filesPath, string encryptKey = null)
|
||||
{
|
||||
UnityEngine.AssetBundle bundle = UnityEngine.AssetBundle.LoadFromFile(filesPath + UpdateConfigs.FILES);
|
||||
UnityEngine.AssetBundle bundle = GameLogic.MEncyptUtil.LoadAssetBundle(filesPath + UpdateConfigs.FILES, encryptKey, 0);
|
||||
ResourceFiles files = bundle.LoadAsset<ResourceFiles>("game");
|
||||
bundle.Unload(true);
|
||||
return files.files;
|
||||
|
|
@ -247,7 +247,7 @@ namespace GameEditor.FrameTool
|
|||
LoadCDN();
|
||||
|
||||
// 计算差异文件
|
||||
local_cdn_list = HotFixTool.GetDiffList(HotFixTool.GetFilesList(local_files_path), HotFixTool.GetFilesList(cdn_files_path));
|
||||
local_cdn_list = HotFixTool.GetDiffList(HotFixTool.GetFilesList(local_files_path), HotFixTool.GetFilesList(cdn_files_path, local_version.EncyptKey));
|
||||
|
||||
// 计算大小
|
||||
local_cdn_size = HotFixTool.GetDiffSize(local_cdn_list);
|
||||
|
|
@ -328,6 +328,24 @@ namespace GameEditor.FrameTool
|
|||
}
|
||||
changeFile.Add(UpdateConfigs.FILES);
|
||||
log.Add(UpdateConfigs.FILES);
|
||||
// 复制热更文件
|
||||
string cpPath = path_cdn_setting + "/" + AppConst.PlatformPath + "/";
|
||||
int fileIndex = 0;
|
||||
foreach (string file in changeFile)
|
||||
{
|
||||
EditorUtility.DisplayProgressBar("正在复制热更文件:", file, fileIndex++/changeFile.Count);
|
||||
|
||||
string dirName = Path.GetDirectoryName(cpPath + file);
|
||||
if (!Directory.Exists(dirName))
|
||||
{
|
||||
Directory.CreateDirectory(dirName);
|
||||
}
|
||||
File.Copy(local_files_path + file, cpPath + file, true);
|
||||
if (local_version.EncyptKey != null && local_version.EncyptKey != "" && AppConst.PlatformPath.Equals("IOS"))
|
||||
{
|
||||
MEncyptUtil.EncyptAB(cpPath + file, local_version.EncyptKey);
|
||||
}
|
||||
}
|
||||
// write ChangeList
|
||||
EditorUtility.DisplayProgressBar("正在生成文件变化列表", changeFileName, 1f);
|
||||
HotFixTool.WriteLog(logPath, changeFileName, changeFile.ToArray());
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class GameStart : MonoBehaviour
|
|||
{
|
||||
path = AppConst.StreamPath + splashFilePath;
|
||||
}
|
||||
bundle = AssetBundle.LoadFromFile(path, 0, 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,7 +125,7 @@ namespace GameLogic {
|
|||
{
|
||||
path = AppConst.StreamPath + updateFilePath;
|
||||
}
|
||||
bundle = AssetBundle.LoadFromFile(path, 0, 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