| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 | using System;using System.Collections.Generic;using System.IO;using ThirdParty.DownloadSystem;using UnityEngine;namespace ThirdParty{    /// <summary>    /// 和热更包里面同步的类容    /// </summary>    public class HotSyncContent    {        /// <summary>        /// 资源服地址        /// </summary>        public static string AssetURL = "http://129.204.254.216:8080/resource/010test";        public static string Currversion;        public static bool isOpenHotFix;        public static bool isOpenDllStreamingLoad;        public static int assetsVer;        private static string m_rootStreamingURL;        public static string RootStreamingURL        {            get            {                m_rootStreamingURL = Application.streamingAssetsPath;#if UNITY_EDITOR#elif UNITY_IPHONE         m_rootStreamingURL = "file://" + m_rootStreamingURL;#endif                return m_rootStreamingURL;            }        }    // #if UNITY_EDITOR//         public static string platform = "Android";//         // public static string platform = "PC";// #elif UNITY_IOS        /// <summary>        /// 1= 本地模式        /// </summary>        public static int loadType;#if UNITY_IOS        public static string platform = "iOS";#elif UNITY_ANDROID        public static string platform = "Android";#else        public static string platform = "Android";#endif        public static IDownloadUI DownloadUI;        /// <summary>        ///应用程序外部资源路径存放路径(热更新资源路径)        /// </summary>        public static string AppHotfixResPath        {            get            {                if (!Directory.Exists($"{Application.persistentDataPath}/Dll/"))                {                    Debug.Log("创建目录:" + $"{Application.persistentDataPath}/Dll/");                    Directory.CreateDirectory($"{Application.persistentDataPath}/Dll/");                }                return $"{Application.persistentDataPath}/Dll/";            }        }        /// <summary>        /// 先从热更路径读取(表示已经热更过),在从内部路径读取(Application.streamingAssetsPath不能用File.Exists判断,无效)        /// </summary>        /// <param name="resourceName"></param>        /// <returns></returns>        public static string GetResPath(string resourceName)        {            string p = Path.Combine(AppHotfixResPath, resourceName);            if (!File.Exists(p))            {                p = Path.Combine(Application.streamingAssetsPath, resourceName);            }            return p;        }        public static string GetWebRequestPath(string resourceName)        {            string p = GetResPath(resourceName);            // webRequest要加file://            if (!p.Contains("://"))            {                p = "file://" + p;            }            return p;        }        public static string GetDllWebRequestPath(string resourceName)        {            string p = Path.Combine(AppHotfixResPath, resourceName);            if (!File.Exists(p))            {                p = Path.Combine(RootStreamingURL + "/Dll/", resourceName);            }#if !UNITY_EDITOR            // webRequest要加file://            if (!p.Contains("://"))            {                p = "file://" + p;            }#endif            return p;        }        /// <summary>        /// 需要热更的的dll资源        /// </summary>        public static List<string> HotFixDll { get; } = new List<string>()        {            "init", //这个是进入热更场景的入口            "Fort23.Proto.dll",            "Fort23.Core.dll",            "Fort23.GameData.dll",            "Fort23.CombatCore.dll",            "Fort23.UTool.dll",            "Fort23.Combat.dll",            "Fort23.Mono.dll",            "spine-unity.dll",            "spine-timeline.dll",            "Assembly-CSharp.dll",        };        /// <summary>        /// 需要补充元数据的泛型函数实例化的dll(注意,不要把热更dll放在这里了。)        /// </summary>        public static List<string> AOTMetaAssemblyNames { get; } = new List<string>()        {            "mscorlib.dll",            "System.dll",            "System.Core.dll",            "spine-csharp.dll",            "Newtonsoft.Json.dll",            "Unity.Timeline.dll",            "UnityEngine.CoreModule.dll",            "ThirdParty.dll"        };    }    // [Serializable]    // public class AssetMD5Info    // {    //     public List<MD5FileInfo> fileInfo;    // }    //    // [Serializable]    // public class MD5FileInfo    // {    //     public string fileName;    //     public string md5;    //    //     public long size;    //    //     // TODO 暂时不验证    //     public string md5Verification;    // }}
 |