少年修仙传客户端基础资源
hch
2024-05-17 0dbb961d8dc9a7fe65021916760c2d9eb8194972
Assets/Launch/ResourcesModel.cs
@@ -5,7 +5,8 @@
using LitJsonForAot;
using System.Collections;
using UnityEngine.Networking;
using System.Linq;
using StartAotSDK;
namespace StartAot
{
@@ -13,7 +14,7 @@
    {
        //不下载时本地安卓测试路径
        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; }
@@ -25,7 +26,7 @@
        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; }
@@ -64,7 +65,7 @@
        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; }
@@ -230,49 +231,9 @@
        }
        //将文件名倒序,加上_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))
            {
@@ -373,7 +334,7 @@
        //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);
@@ -474,7 +435,7 @@
            if (isPCTestDownLoad || Application.isMobilePlatform)
            {
                //读取的一定是StreamingAssetPath路径
                StartCoroutine(ReadText("daimazijie", (isOK, value) =>
                StartCoroutine(ReadText("logicbytes", (isOK, value) =>
                {
                    if (isOK)
                        InitLocalLogicbytes(value);