版本验证配置

This commit is contained in:
xianyi
2025-08-28 17:44:28 +08:00
parent c458b0c46e
commit 565e2ddf46
6 changed files with 128 additions and 14 deletions

View File

@@ -0,0 +1,49 @@
using UnityEngine;
namespace TcgEngine
{
/// <summary>
/// 资源下载器配置文件
/// 用于存储服务器URL、资源端点等配置信息
/// </summary>
[CreateAssetMenu(fileName = "ResourceDownloaderConfig", menuName = "TcgEngine/ResourceDownloaderConfig", order = 0)]
public class ResourceDownloaderConfig : ScriptableObject
{
[Header("CDN Configuration")]
[Tooltip("资源服务器的基础URL")]
public string cdnUrl = "";
[Tooltip("游戏服务器URL")]
public string serverUrl = "";
[Tooltip("资源文件下载路径,{version}会被替换为实际版本号")]
public string resourcesEndpoint = "";
[Tooltip("版本检查接口")]
public string versionEndpoint = "";
[Header("Download Settings")]
[Tooltip("检查版本化文件是否存在")]
public bool validateVersionedUrl = true;
/// <summary>
/// 获取完整的资源下载URL
/// </summary>
/// <param name="version">版本号</param>
/// <returns>完整的下载URL</returns>
public string GetResourceUrl(string version)
{
string endpoint = resourcesEndpoint.Replace("{version}", version);
return cdnUrl + endpoint;
}
/// <summary>
/// 获取版本检查URL
/// </summary>
/// <returns>版本检查URL</returns>
public string GetVersionUrl()
{
return serverUrl + versionEndpoint;
}
}
}