diff --git a/Assets/YooAsset/Runtime/AssetSystem/Handles/AssetOperationHandle.cs b/Assets/YooAsset/Runtime/AssetSystem/Handles/AssetOperationHandle.cs
index c8349e8..6a74dbf 100644
--- a/Assets/YooAsset/Runtime/AssetSystem/Handles/AssetOperationHandle.cs
+++ b/Assets/YooAsset/Runtime/AssetSystem/Handles/AssetOperationHandle.cs
@@ -139,4 +139,4 @@ namespace YooAsset
return operation;
}
}
-}
\ No newline at end of file
+}
diff --git a/Assets/YooAsset/Runtime/AssetSystem/Operations/InstantiateOperation.cs b/Assets/YooAsset/Runtime/AssetSystem/Operations/InstantiateOperation.cs
index 1241982..65dd24d 100644
--- a/Assets/YooAsset/Runtime/AssetSystem/Operations/InstantiateOperation.cs
+++ b/Assets/YooAsset/Runtime/AssetSystem/Operations/InstantiateOperation.cs
@@ -82,4 +82,4 @@ namespace YooAsset
}
}
}
-}
\ No newline at end of file
+}
diff --git a/Assets/YooAsset/Runtime/PatchSystem/AssetInfo.cs b/Assets/YooAsset/Runtime/PatchSystem/AssetInfo.cs
index 9642b16..621fe0e 100644
--- a/Assets/YooAsset/Runtime/PatchSystem/AssetInfo.cs
+++ b/Assets/YooAsset/Runtime/PatchSystem/AssetInfo.cs
@@ -91,4 +91,4 @@ namespace YooAsset
Error = error;
}
}
-}
\ No newline at end of file
+}
diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs
index 2bf3c56..fd33316 100644
--- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs
+++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs
@@ -25,12 +25,12 @@ namespace YooAsset
///
/// 异步初始化
///
- public InitializationOperation InitializeAsync(bool locationToLower, bool clearCacheWhenDirty, string defaultHostServer, string fallbackHostServer)
+ public InitializationOperation InitializeAsync(bool locationToLower, bool clearCacheWhenDirty, IRemoteHostServices hostServerServices)
{
_locationToLower = locationToLower;
_clearCacheWhenDirty = clearCacheWhenDirty;
- _defaultHostServer = defaultHostServer;
- _fallbackHostServer = fallbackHostServer;
+ _defaultHostServer = hostServerServices.GetDefaultHost();
+ _fallbackHostServer = hostServerServices.GetFallbackHost();
var operation = new HostPlayModeInitializationOperation(this);
OperationSystem.StartOperaiton(operation);
@@ -370,4 +370,4 @@ namespace YooAsset
}
#endregion
}
-}
\ No newline at end of file
+}
diff --git a/Assets/YooAsset/Runtime/Services/IRemoteHostServices.cs b/Assets/YooAsset/Runtime/Services/IRemoteHostServices.cs
new file mode 100644
index 0000000..15f2bbd
--- /dev/null
+++ b/Assets/YooAsset/Runtime/Services/IRemoteHostServices.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace YooAsset
+{
+ public interface IRemoteHostServices
+ {
+ ///
+ /// 默认的资源服务器下载地址
+ ///
+ ///
+ string GetDefaultHost();
+
+ ///
+ /// 备用的资源服务器下载地址
+ ///
+ ///
+ string GetFallbackHost();
+ }
+}
diff --git a/Assets/YooAsset/Runtime/Services/IRemoteHostServices.cs.meta b/Assets/YooAsset/Runtime/Services/IRemoteHostServices.cs.meta
new file mode 100644
index 0000000..be6c441
--- /dev/null
+++ b/Assets/YooAsset/Runtime/Services/IRemoteHostServices.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 863c6fcb409e9c4448fab48de69316b2
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs
index 0e0338d..01ced65 100644
--- a/Assets/YooAsset/Runtime/YooAssets.cs
+++ b/Assets/YooAsset/Runtime/YooAssets.cs
@@ -85,21 +85,14 @@ namespace YooAsset
///
public class HostPlayModeParameters : InitializeParameters
{
- ///
- /// 当缓存池被污染的时候清理缓存池
- ///
- public bool ClearCacheWhenDirty;
-
- ///
- /// 默认的资源服务器下载地址
- ///
- public string DefaultHostServer;
-
- ///
- /// 备用的资源服务器下载地址
- ///
- public string FallbackHostServer;
-
+ ///
+ /// 资源更新获取URL服务接口
+ ///
+ public IRemoteHostServices HostAddressServices;
+ ///
+ /// 当缓存池被污染的时候清理缓存池
+ ///
+ public bool ClearCacheWhenDirty;
///
/// 启用断点续传功能的文件大小
///
@@ -215,9 +208,7 @@ namespace YooAsset
var hostPlayModeParameters = parameters as HostPlayModeParameters;
initializeOperation = _hostPlayModeImpl.InitializeAsync(
hostPlayModeParameters.LocationToLower,
- hostPlayModeParameters.ClearCacheWhenDirty,
- hostPlayModeParameters.DefaultHostServer,
- hostPlayModeParameters.FallbackHostServer);
+ hostPlayModeParameters.ClearCacheWhenDirty, hostPlayModeParameters.HostAddressServices);
}
else
{
@@ -234,11 +225,17 @@ namespace YooAsset
_initializeError = op.Error;
}
- ///
- /// 向网络端请求静态资源版本
- ///
- /// 超时时间(默认值:60秒)
- public static UpdateStaticVersionOperation UpdateStaticVersionAsync(int timeout = 60)
+ ///
+ ///
+ ///
+ public static bool IsInitialized => _isInitialize;
+
+
+ ///
+ /// 向网络端请求静态资源版本
+ ///
+ /// 超时时间(默认值:60秒)
+ public static UpdateStaticVersionOperation UpdateStaticVersionAsync(int timeout = 60)
{
DebugCheckInitialize();
if (_playMode == EPlayMode.EditorSimulateMode)
@@ -557,7 +554,7 @@ namespace YooAsset
///
/// 资源类型
/// 资源的定位地址
- public static AssetOperationHandle LoadAssetAsync(string location)
+ public static AssetOperationHandle LoadAssetAsync(string location) where TObject : UnityEngine.Object
{
DebugCheckInitialize();
AssetInfo assetInfo = ConvertLocationToAssetInfo(location, typeof(TObject));
@@ -1012,4 +1009,4 @@ namespace YooAsset
}
#endregion
}
-}
\ No newline at end of file
+}