mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-07-03 20:43:43 +00:00
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
@@ -71,5 +72,115 @@ namespace YooAsset
|
||||
{
|
||||
return $"{Setting.ManifestFileName}_{packageName}.version";
|
||||
}
|
||||
|
||||
#region 路径相关
|
||||
/// <summary>
|
||||
/// 获取YOO的Resources目录的加载路径
|
||||
/// </summary>
|
||||
public static string GetYooResourcesLoadPath(string packageName, string fileName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return PathUtility.Combine(packageName, fileName);
|
||||
else
|
||||
return PathUtility.Combine(Setting.DefaultYooFolderName, packageName, fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO的Resources目录的全路径
|
||||
/// </summary>
|
||||
public static string GetYooResourcesFullPath()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return $"Assets/Resources";
|
||||
else
|
||||
return $"Assets/Resources/{Setting.DefaultYooFolderName}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO的编辑器下内置文件根目录
|
||||
/// </summary>
|
||||
public static string GetYooEditorBuildinRoot()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return PathUtility.Combine(Application.dataPath, "StreamingAssets");
|
||||
else
|
||||
return PathUtility.Combine(Application.dataPath, "StreamingAssets", Setting.DefaultYooFolderName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO的PC端内置文件根目录
|
||||
/// </summary>
|
||||
public static string GetYooStandaloneBuildinRoot()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return Application.streamingAssetsPath;
|
||||
else
|
||||
return PathUtility.Combine(Application.streamingAssetsPath, Setting.DefaultYooFolderName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO的移动端内置文件根目录
|
||||
/// </summary>
|
||||
public static string GetYooMobileBuildinRoot()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return Application.streamingAssetsPath;
|
||||
else
|
||||
return PathUtility.Combine(Application.streamingAssetsPath, Setting.DefaultYooFolderName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO的Web端内置文件根目录
|
||||
/// </summary>
|
||||
public static string GetYooWebBuildinRoot()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return Application.streamingAssetsPath;
|
||||
else
|
||||
return PathUtility.Combine(Application.streamingAssetsPath, Setting.DefaultYooFolderName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO的编辑器下缓存文件根目录
|
||||
/// </summary>
|
||||
public static string GetYooEditorCacheRoot()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
{
|
||||
string projectPath = Path.GetDirectoryName(Application.dataPath);
|
||||
projectPath = PathUtility.RegularPath(projectPath);
|
||||
return projectPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 注意:为了方便调试查看,编辑器下把存储目录放到项目根目录下。
|
||||
string projectPath = Path.GetDirectoryName(Application.dataPath);
|
||||
projectPath = PathUtility.RegularPath(projectPath);
|
||||
return PathUtility.Combine(projectPath, Setting.DefaultYooFolderName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO的PC端缓存文件根目录
|
||||
/// </summary>
|
||||
public static string GetYooStandaloneCacheRoot()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return Application.dataPath;
|
||||
else
|
||||
return PathUtility.Combine(Application.dataPath, Setting.DefaultYooFolderName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取YOO的移动端缓存文件根目录
|
||||
/// </summary>
|
||||
public static string GetYooMobileCacheRoot()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||
return Application.persistentDataPath;
|
||||
else
|
||||
return PathUtility.Combine(Application.persistentDataPath, Setting.DefaultYooFolderName);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user