using System;
using System.Collections.Generic;
using System.IO;
using ThirdParty.DownloadSystem;
using UnityEngine;
namespace ThirdParty
{
///
/// 和热更包里面同步的类容
///
public class HotSyncContent
{
///
/// 资源服地址
///
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
///
/// 1= 本地模式
///
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;
///
///应用程序外部资源路径存放路径(热更新资源路径)
///
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/";
}
}
///
/// 先从热更路径读取(表示已经热更过),在从内部路径读取(Application.streamingAssetsPath不能用File.Exists判断,无效)
///
///
///
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;
}
///
/// 需要热更的的dll资源
///
public static List HotFixDll { get; } = new List()
{
"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",
};
///
/// 需要补充元数据的泛型函数实例化的dll(注意,不要把热更dll放在这里了。)
///
public static List AOTMetaAssemblyNames { get; } = new List()
{
"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 fileInfo;
// }
//
// [Serializable]
// public class MD5FileInfo
// {
// public string fileName;
// public string md5;
//
// public long size;
//
// // TODO 暂时不验证
// public string md5Verification;
// }
}