| | |
| | | using LitJsonForAot;
|
| | | using System.Collections;
|
| | | using UnityEngine.Networking;
|
| | | using System.Linq;
|
| | | using StartAotSDK;
|
| | |
|
| | |
|
| | | namespace StartAot
|
| | | {
|
| | |
| | | {
|
| | | //不下载时本地安卓测试路径
|
| | | public string assetBundlesPath { get; private set; }
|
| | | public static string bytesFolderName = "daimazijie/";
|
| | | public static string bytesFolderName = "logicbytes/";
|
| | | public string StreamingAssetPath { get; private set; }
|
| | | public string ExternalStorePath { get; private set; }
|
| | |
|
| | |
| | | public bool isPCTestDownLoad = false;
|
| | |
|
| | | public static readonly string[] VERSION_URL = new string[] {
|
| | | "http://vncenter.tuyetvn.com:11000/center/appversion_new.php/?"};
|
| | | "http://vncenter.daojmengxvn.com:11000/center/appversion_new.php/?"};
|
| | |
|
| | |
|
| | | public int debugBranch { get; private set; }
|
| | |
| | | string assetBytesUrl;
|
| | | //从网络获取的资源版本信息
|
| | | public Dictionary<string, AssetVersion> assetVersions = new Dictionary<string, AssetVersion>();
|
| | | //本地daimazijie文件和 assetVersions 比较是否需要下载
|
| | | //本地LogicBytes文件和 assetVersions 比较是否需要下载
|
| | | public Dictionary<string, AssetVersion> localAssetVersions = new Dictionary<string, AssetVersion>();
|
| | | public static string versionUrlResult { get; private set; }
|
| | |
|
| | |
| | |
|
| | | }
|
| | |
|
| | | //将文件名倒序,加上_aop后缀
|
| | | public string EncodeFileName(string name)
|
| | |
|
| | | public string GetAssetFilePath(string _assetKey)
|
| | | {
|
| | | name = name.Replace("\\", "/");
|
| | | int index = name.LastIndexOf("/");
|
| | | string headString;
|
| | | if (index >= 0)
|
| | | {
|
| | | int dotLastIndex = name.LastIndexOf(".");
|
| | | if (dotLastIndex == -1)
|
| | | {
|
| | | headString = name.Substring(0, index);
|
| | | name = name.Substring(index + 1);
|
| | | return StringUtility.Contact(headString, "/", new string(name.Reverse().ToArray()), "_aop");
|
| | | }
|
| | | else
|
| | | {
|
| | | headString = name.Substring(0, index);
|
| | | var ext = name.Substring(dotLastIndex);
|
| | | name = name.Substring(index + 1, dotLastIndex - index - 1);
|
| | | return StringUtility.Contact(headString, "/", new string(name.Reverse().ToArray()), "_aop", ext);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | int dotLastIndex = name.LastIndexOf(".");
|
| | | if (dotLastIndex == -1)
|
| | | return StringUtility.Contact(new string(name.Reverse().ToArray()), "_aop");
|
| | | else
|
| | | {
|
| | | var ext = name.Substring(dotLastIndex);
|
| | | name = name.Substring(0, dotLastIndex);
|
| | | return StringUtility.Contact(new string(name.Reverse().ToArray()), "_aop", ext);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | public string GetAssetFilePath(string _assetKey, bool reverse = true)
|
| | | {
|
| | | if (reverse)
|
| | | _assetKey = EncodeFileName(_assetKey);
|
| | | var path = Path.Combine(ExternalStorePath, _assetKey);
|
| | | if (!File.Exists(path))
|
| | | {
|
| | |
| | | //LogicBytes文件的MD5信息
|
| | | public void RequestLogicBytes()
|
| | | {
|
| | | var remoteURL = string.Concat(versionInfo.GetResourcesURL(VersionConfigEx.Get().branch), fixPath, "/daimazijie.txt");
|
| | | var remoteURL = string.Concat(versionInfo.GetResourcesURL(VersionConfigEx.Get().branch), fixPath, "/logicbytes.txt");
|
| | | //var localURL = string.Concat(.ExternalStorePath, "/logicbytes.txt");
|
| | | assetBytesUrl = remoteURL;
|
| | | Debug.Log("http地址:logicbytesUrl " + assetBytesUrl);
|
| | |
| | | if (isPCTestDownLoad || Application.isMobilePlatform)
|
| | | {
|
| | | //读取的一定是StreamingAssetPath路径
|
| | | StartCoroutine(ReadText("daimazijie", (isOK, value) =>
|
| | | StartCoroutine(ReadText("logicbytes", (isOK, value) =>
|
| | | {
|
| | | if (isOK)
|
| | | InitLocalLogicbytes(value);
|