public static GetResourceFullPathType GetResourceFullPath(string url, bool withFileProtocol, out string fullPath,
bool isLog = true)
{
if (string.IsNullOrEmpty(url))
Log.Error("尝试获取一个空的资源路径!");
string docUrl;
bool hasDocUrl = TryGetDocumentResourceUrl(url, withFileProtocol, out docUrl);
string inAppUrl;
bool hasInAppUrl;
{
hasInAppUrl = TryGetInAppStreamingUrl(url, withFileProtocol, out inAppUrl);
}
if (ResourcePathPriorityType == KResourcePathPriorityType.PersistentDataPathPriority) // 優先下載資源模式
{
if (hasDocUrl)
{
if (Application.isEditor)
Log.Warning("[Use PersistentDataPath] {0}", docUrl);
fullPath = docUrl;
return GetResourceFullPathType.InDocument;
}
// 優先下載資源,但又沒有下載資源文件!使用本地資源目錄
}
if (!hasInAppUrl) // 连本地资源都没有,直接失败吧 ?? 沒有本地資源但又遠程資源?竟然!!?
{
if (isLog)
Log.Error("[Not Found] StreamingAssetsPath Url Resource: {0}", url);
fullPath = null;
return GetResourceFullPathType.Invalid;
}
fullPath = inAppUrl; // 直接使用本地資源!
return GetResourceFullPathType.InApp;
}