using System.Collections.Generic; using YooAsset; namespace AOT.Patch { /// /// YooAsset 远端地址查询(CDN)。 /// public sealed class CdnRemoteService : IRemoteService { readonly string _primary; readonly string _fallback; public CdnRemoteService(string primaryRoot, string fallbackRoot = null) { _primary = TrimSlash(primaryRoot); _fallback = string.IsNullOrEmpty(fallbackRoot) ? _primary : TrimSlash(fallbackRoot); } public IReadOnlyList GetRemoteUrls(string fileName) { return new[] { $"{_primary}/{fileName}", $"{_fallback}/{fileName}", }; } static string TrimSlash(string root) { if (string.IsNullOrEmpty(root)) return string.Empty; return root.TrimEnd('/'); } } }