From a4c8fb6e1b3dac47520c98c96c4fe5599f0eb11e Mon Sep 17 00:00:00 2001 From: hevinci Date: Wed, 28 Sep 2022 11:55:12 +0800 Subject: [PATCH] Update runtime logic --- .../Runtime/CacheSystem/PatchCacheVerifier.cs | 26 ++-- .../Operations/InitializationOperation.cs | 64 +--------- .../Operations/UpdateManifestOperation.cs | 4 +- .../Operations/UpdatePackageOperation.cs | 8 +- .../Runtime/PatchSystem/PatchBundle.cs | 40 +++---- .../Runtime/PatchSystem/PatchManifest.cs | 5 - .../PatchSystem/PlayMode/HostPlayModeImpl.cs | 79 +++++------- .../Runtime/Services/IQueryServices.cs | 11 ++ .../Runtime/Services/IQueryServices.cs.meta | 11 ++ Assets/YooAsset/Runtime/YooAssets.cs | 112 ++++++++++-------- 10 files changed, 146 insertions(+), 214 deletions(-) create mode 100644 Assets/YooAsset/Runtime/Services/IQueryServices.cs create mode 100644 Assets/YooAsset/Runtime/Services/IQueryServices.cs.meta diff --git a/Assets/YooAsset/Runtime/CacheSystem/PatchCacheVerifier.cs b/Assets/YooAsset/Runtime/CacheSystem/PatchCacheVerifier.cs index f82c2a4..ce9e027 100644 --- a/Assets/YooAsset/Runtime/CacheSystem/PatchCacheVerifier.cs +++ b/Assets/YooAsset/Runtime/CacheSystem/PatchCacheVerifier.cs @@ -11,7 +11,7 @@ namespace YooAsset /// internal abstract class PatchCacheVerifier { - public abstract bool InitVerifier(PatchManifest appPatchManifest, PatchManifest localPatchManifest, bool weaklyUpdate); + public abstract bool InitVerifier(HostPlayModeImpl impl, bool weaklyUpdate); public abstract bool UpdateVerifier(); public abstract float GetVerifierProgress(); @@ -42,22 +42,18 @@ namespace YooAsset private int _verifyMaxNum; private int _verifyTotalCount; - public override bool InitVerifier(PatchManifest appPatchManifest, PatchManifest localPatchManifest, bool weaklyUpdate) + public override bool InitVerifier(HostPlayModeImpl impl, bool weaklyUpdate) { // 遍历所有文件然后验证并缓存合法文件 - foreach (var patchBundle in localPatchManifest.BundleList) + foreach (var patchBundle in impl.LocalPatchManifest.BundleList) { // 忽略缓存文件 if (CacheSystem.IsCached(patchBundle)) continue; // 忽略APP资源 - // 注意:如果是APP资源并且哈希值相同,则不需要下载 - if (appPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle)) - { - if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle)) - continue; - } + if (impl.IsBuildinPatchBundle(patchBundle)) + continue; // 注意:在弱联网模式下,我们需要验证指定资源版本的所有资源完整性 if (weaklyUpdate) @@ -167,22 +163,18 @@ namespace YooAsset private int _verifyMaxNum; private int _verifyTotalCount; - public override bool InitVerifier(PatchManifest appPatchManifest, PatchManifest localPatchManifest, bool weaklyUpdate) + public override bool InitVerifier(HostPlayModeImpl impl, bool weaklyUpdate) { // 遍历所有文件然后验证并缓存合法文件 - foreach (var patchBundle in localPatchManifest.BundleList) + foreach (var patchBundle in impl.LocalPatchManifest.BundleList) { // 忽略缓存文件 if (CacheSystem.IsCached(patchBundle)) continue; // 忽略APP资源 - // 注意:如果是APP资源并且哈希值相同,则不需要下载 - if (appPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle)) - { - if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle)) - continue; - } + if (impl.IsBuildinPatchBundle(patchBundle)) + continue; // 注意:在弱联网模式下,我们需要验证指定资源版本的所有资源完整性 if (weaklyUpdate) diff --git a/Assets/YooAsset/Runtime/PatchSystem/Operations/InitializationOperation.cs b/Assets/YooAsset/Runtime/PatchSystem/Operations/InitializationOperation.cs index 2753163..9dc7ccf 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/Operations/InitializationOperation.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/Operations/InitializationOperation.cs @@ -134,75 +134,15 @@ namespace YooAsset /// internal sealed class HostPlayModeInitializationOperation : InitializationOperation { - private enum ESteps + internal HostPlayModeInitializationOperation() { - None, - LoadManifest, - CopyManifest, - Done, - } - - private readonly HostPlayModeImpl _impl; - private readonly string _buildinPackageName; - private AppManifestLoader _appManifestLoader; - private AppManifestCopyer _appManifestCopyer; - private ESteps _steps = ESteps.None; - - internal HostPlayModeInitializationOperation(HostPlayModeImpl impl, string buildinPackageName) - { - _impl = impl; - _buildinPackageName = buildinPackageName; - _appManifestLoader = new AppManifestLoader(buildinPackageName); } internal override void Start() { - _steps = ESteps.LoadManifest; + Status = EOperationStatus.Succeed; } internal override void Update() { - if (_steps == ESteps.None || _steps == ESteps.Done) - return; - - if (_steps == ESteps.LoadManifest) - { - _appManifestLoader.Update(); - Progress = _appManifestLoader.Progress(); - if (_appManifestLoader.IsDone() == false) - return; - - if (_appManifestLoader.Result == null) - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = _appManifestLoader.Error; - } - else - { - _impl.SetAppPatchManifest(_appManifestLoader.Result); - _impl.SetLocalPatchManifest(_appManifestLoader.Result); - _appManifestCopyer = new AppManifestCopyer(_buildinPackageName, _appManifestLoader.BuildinPackageCRC); - _steps = ESteps.CopyManifest; - } - } - - if (_steps == ESteps.CopyManifest) - { - _appManifestCopyer.Update(); - if (_appManifestCopyer.IsDone() == false) - return; - - if (_appManifestCopyer.Result == false) - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = _appManifestCopyer.Error; - } - else - { - _steps = ESteps.Done; - Status = EOperationStatus.Succeed; - } - } } } diff --git a/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdateManifestOperation.cs b/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdateManifestOperation.cs index 214416e..dd26511 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdateManifestOperation.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdateManifestOperation.cs @@ -154,7 +154,7 @@ namespace YooAsset if (_steps == ESteps.InitVerifyingCache) { - _patchCacheVerifier.InitVerifier(_impl.AppPatchManifest, _impl.LocalPatchManifest, false); + _patchCacheVerifier.InitVerifier(_impl, false); _verifyTime = UnityEngine.Time.realtimeSinceStartup; _steps = ESteps.UpdateVerifyingCache; } @@ -286,7 +286,7 @@ namespace YooAsset if (_steps == ESteps.InitVerifyingCache) { - if (_patchCacheVerifier.InitVerifier(_impl.AppPatchManifest, _impl.LocalPatchManifest, true)) + if (_patchCacheVerifier.InitVerifier(_impl, true)) { _verifyTime = UnityEngine.Time.realtimeSinceStartup; _steps = ESteps.UpdateVerifyingCache; diff --git a/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageOperation.cs b/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageOperation.cs index 3d74a38..b054ede 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageOperation.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageOperation.cs @@ -205,12 +205,8 @@ namespace YooAsset continue; // 忽略APP资源 - // 注意:如果是APP资源并且哈希值相同,则不需要下载 - if (_impl.AppPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle)) - { - if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle)) - continue; - } + if (_impl.IsBuildinPatchBundle(patchBundle)) + continue; downloadList.Add(patchBundle); } diff --git a/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs b/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs index 1944ce1..4ea56d2 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs @@ -38,21 +38,16 @@ namespace YooAsset public int Flags; - /// - /// 是否为加密文件 - /// - public bool IsEncrypted { private set; get; } - - /// - /// 是否为内置文件 - /// - public bool IsBuildin { private set; get; } - /// /// 是否为原生文件 /// public bool IsRawFile { private set; get; } + /// + /// 是否为加密文件 + /// + public bool IsEncrypted { private set; get; } + /// /// 文件名称 /// @@ -69,7 +64,7 @@ namespace YooAsset if (string.IsNullOrEmpty(_cachedFilePath) == false) return _cachedFilePath; - string cacheRoot = SandboxHelper.GetCacheFolderPath(); + string cacheRoot = SandboxHelper.GetCacheFolderPath(); _cachedFilePath = $"{cacheRoot}/{FileName}"; return _cachedFilePath; } @@ -104,16 +99,14 @@ namespace YooAsset /// /// 设置Flags /// - public void SetFlagsValue(bool isEncrypted, bool isBuildin, bool isRawFile) + public void SetFlagsValue(bool isRawFile, bool isEncrypted) { - IsEncrypted = isEncrypted; - IsBuildin = isBuildin; IsRawFile = isRawFile; + IsEncrypted = isEncrypted; BitMask32 mask = new BitMask32(0); - if (isEncrypted) mask.Open(0); - if (isBuildin) mask.Open(1); - if (isRawFile) mask.Open(2); + if (isRawFile) mask.Open(0); + if (isEncrypted) mask.Open(1); Flags = mask; } @@ -123,9 +116,8 @@ namespace YooAsset public void ParseFlagsValue() { BitMask32 value = Flags; - IsEncrypted = value.Test(0); - IsBuildin = value.Test(1); - IsRawFile = value.Test(2); + IsRawFile = value.Test(0); + IsEncrypted = value.Test(1); } /// @@ -179,11 +171,11 @@ namespace YooAsset } /// - /// 是否为纯内置资源(不带任何Tag的资源) + /// 是否包含任意Tags /// - public bool IsPureBuildin() + public bool HasAnyTags() { - if (Tags == null || Tags.Length == 0) + if (Tags != null && Tags.Length > 0) return true; else return false; @@ -196,7 +188,7 @@ namespace YooAsset { if (FileHash == otherBundle.FileHash) return true; - + return false; } } diff --git a/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs b/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs index adf5468..840e404 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs @@ -32,11 +32,6 @@ namespace YooAsset /// public string PackageName; - /// - /// 内置资源的标签列表(首包资源) - /// - public string BuildinTags; - /// /// 资源列表(主动收集的资源列表) /// diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs index b7b5517..cf6bc30 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs @@ -8,24 +8,25 @@ namespace YooAsset internal class HostPlayModeImpl : IBundleServices { // 补丁清单 - internal PatchManifest AppPatchManifest { private set; get; } internal PatchManifest LocalPatchManifest { private set; get; } // 参数相关 private bool _locationToLower; private string _defaultHostServer; private string _fallbackHostServer; + private IQueryServices _queryServices; /// /// 异步初始化 /// - public InitializationOperation InitializeAsync(bool locationToLower, string buildinPackageName, string defaultHostServer, string fallbackHostServer) + public InitializationOperation InitializeAsync(bool locationToLower, string defaultHostServer, string fallbackHostServer, IQueryServices queryServices) { _locationToLower = locationToLower; _defaultHostServer = defaultHostServer; _fallbackHostServer = fallbackHostServer; + _queryServices = queryServices; - var operation = new HostPlayModeInitializationOperation(this, buildinPackageName); + var operation = new HostPlayModeInitializationOperation(); OperationSystem.StartOperation(operation); return operation; } @@ -118,12 +119,8 @@ namespace YooAsset continue; // 忽略APP资源 - // 注意:如果是APP资源并且哈希值相同,则不需要下载 - if (AppPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle)) - { - if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle)) - continue; - } + if (IsBuildinPatchBundle(patchBundle)) + continue; downloadList.Add(patchBundle); } @@ -150,17 +147,11 @@ namespace YooAsset continue; // 忽略APP资源 - // 注意:如果是APP资源并且哈希值相同,则不需要下载 - if (AppPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle)) - { - if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle)) - continue; - } + if (IsBuildinPatchBundle(patchBundle)) + continue; - // 如果是纯内置资源,则统一下载 - // 注意:可能是新增的或者变化的内置资源 - // 注意:可能是由热更资源转换的内置资源 - if (patchBundle.IsPureBuildin()) + // 如果未带任何标记,则统一下载 + if (patchBundle.HasAnyTags() == false) { downloadList.Add(patchBundle); } @@ -220,12 +211,8 @@ namespace YooAsset continue; // 忽略APP资源 - // 注意:如果是APP资源并且哈希值相同,则不需要下载 - if (AppPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle)) - { - if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle)) - continue; - } + if (IsBuildinPatchBundle(patchBundle)) + continue; downloadList.Add(patchBundle); } @@ -245,20 +232,19 @@ namespace YooAsset private List GetUnpackListByTags(string[] tags) { List downloadList = new List(1000); - foreach (var patchBundle in AppPatchManifest.BundleList) + foreach (var patchBundle in LocalPatchManifest.BundleList) { - // 如果不是内置资源 - if (patchBundle.IsBuildin == false) - continue; - // 忽略缓存文件 if (CacheSystem.IsCached(patchBundle)) continue; // 查询DLC资源 - if (patchBundle.HasTag(tags)) + if (IsBuildinPatchBundle(patchBundle)) { - downloadList.Add(patchBundle); + if (patchBundle.HasTag(tags)) + { + downloadList.Add(patchBundle); + } } } @@ -277,17 +263,16 @@ namespace YooAsset private List GetUnpackListByAll() { List downloadList = new List(1000); - foreach (var patchBundle in AppPatchManifest.BundleList) + foreach (var patchBundle in LocalPatchManifest.BundleList) { - // 如果不是内置资源 - if (patchBundle.IsBuildin == false) - continue; - // 忽略缓存文件 if (CacheSystem.IsCached(patchBundle)) continue; - downloadList.Add(patchBundle); + if (IsBuildinPatchBundle(patchBundle)) + { + downloadList.Add(patchBundle); + } } return PatchHelper.ConvertToUnpackList(downloadList); @@ -322,16 +307,15 @@ namespace YooAsset return bundleInfo; } - // 设置资源清单 - internal void SetAppPatchManifest(PatchManifest patchManifest) - { - AppPatchManifest = patchManifest; - } internal void SetLocalPatchManifest(PatchManifest patchManifest) { LocalPatchManifest = patchManifest; LocalPatchManifest.InitAssetPathMapping(_locationToLower); } + internal bool IsBuildinPatchBundle(PatchBundle patchBundle) + { + return _queryServices.QueryStreamingAssets(patchBundle.FileName); + } #region IBundleServices接口 private BundleInfo CreateBundleInfo(PatchBundle patchBundle) @@ -347,13 +331,10 @@ namespace YooAsset } // 查询APP资源 - if (AppPatchManifest.TryGetPatchBundle(patchBundle.BundleName, out PatchBundle appPatchBundle)) + if (IsBuildinPatchBundle(patchBundle)) { - if (appPatchBundle.IsBuildin && appPatchBundle.Equals(patchBundle)) - { - BundleInfo bundleInfo = new BundleInfo(appPatchBundle, BundleInfo.ELoadMode.LoadFromStreaming); - return bundleInfo; - } + BundleInfo bundleInfo = new BundleInfo(patchBundle, BundleInfo.ELoadMode.LoadFromStreaming); + return bundleInfo; } // 从服务端下载 diff --git a/Assets/YooAsset/Runtime/Services/IQueryServices.cs b/Assets/YooAsset/Runtime/Services/IQueryServices.cs new file mode 100644 index 0000000..2d3b100 --- /dev/null +++ b/Assets/YooAsset/Runtime/Services/IQueryServices.cs @@ -0,0 +1,11 @@ + +namespace YooAsset +{ + public interface IQueryServices + { + /// + /// 查询内置资源 + /// + bool QueryStreamingAssets(string fileName); + } +} \ No newline at end of file diff --git a/Assets/YooAsset/Runtime/Services/IQueryServices.cs.meta b/Assets/YooAsset/Runtime/Services/IQueryServices.cs.meta new file mode 100644 index 0000000..9726499 --- /dev/null +++ b/Assets/YooAsset/Runtime/Services/IQueryServices.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 71b4ac2c7d7f15b40a457f355d535f33 +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 88eb8b5..4f4a91f 100644 --- a/Assets/YooAsset/Runtime/YooAssets.cs +++ b/Assets/YooAsset/Runtime/YooAssets.cs @@ -40,11 +40,6 @@ namespace YooAsset /// public bool LocationToLower = false; - /// - /// 内置的资源包裹名称 - /// - public string BuildinPackageName = string.Empty; - /// /// 资源定位服务接口 /// @@ -83,6 +78,10 @@ namespace YooAsset /// public class OfflinePlayModeParameters : InitializeParameters { + /// + /// 内置的资源包裹名称 + /// + public string BuildinPackageName = string.Empty; } /// @@ -100,11 +99,6 @@ namespace YooAsset /// public string FallbackHostServer; - /// - /// 当缓存池被污染的时候清理缓存池 - /// - public bool ClearCacheWhenDirty = false; - #if UNITY_WEBGL /// /// WEBGL模式不支持多线程下载 @@ -121,6 +115,11 @@ namespace YooAsset /// 下载文件校验等级 /// public EVerifyLevel VerifyLevel = EVerifyLevel.High; + + /// + /// 查询服务类 + /// + public IQueryServices QueryServices = null; } @@ -151,36 +150,45 @@ namespace YooAsset if (parameters == null) throw new Exception($"YooAsset create parameters is null."); - if (string.IsNullOrEmpty(parameters.BuildinPackageName)) - throw new Exception($"{nameof(parameters.BuildinPackageName)} is empty."); - - if (parameters.LocationServices == null) - throw new Exception($"{nameof(IBundleServices)} is null."); - #if !UNITY_EDITOR if (parameters is EditorSimulateModeParameters) throw new Exception($"Editor simulate mode only support unity editor."); #endif - _locationServices = parameters.LocationServices; - - // 创建驱动器 - if (_isInitialize == false) - { - _isInitialize = true; - UnityEngine.GameObject driverGo = new UnityEngine.GameObject("[YooAsset]"); - driverGo.AddComponent(); - UnityEngine.Object.DontDestroyOnLoad(driverGo); - -#if DEBUG - driverGo.AddComponent(); -#endif - } + // 鉴定运行模式 + if (parameters is EditorSimulateModeParameters) + _playMode = EPlayMode.EditorSimulateMode; + else if (parameters is OfflinePlayModeParameters) + _playMode = EPlayMode.OfflinePlayMode; + else if (parameters is HostPlayModeParameters) + _playMode = EPlayMode.HostPlayMode; else + throw new NotImplementedException(); + + if (parameters.LocationServices == null) + throw new Exception($"{nameof(IBundleServices)} is null."); + + if (_playMode == EPlayMode.OfflinePlayMode) + { + var playModeParameters = parameters as OfflinePlayModeParameters; + if (string.IsNullOrEmpty(playModeParameters.BuildinPackageName)) + throw new Exception($"{nameof(playModeParameters.BuildinPackageName)} is empty."); + } + + if (_playMode == EPlayMode.HostPlayMode) + { + var playModeParameters = parameters as HostPlayModeParameters; + if (playModeParameters.QueryServices == null) + throw new Exception($"{nameof(IQueryServices)} is null."); + } + + if (_isInitialize) { throw new Exception("YooAsset is initialized yet."); } + _locationServices = parameters.LocationServices; + // 检测参数范围 if (parameters.AssetLoadingMaxNumber < 1) { @@ -193,17 +201,20 @@ namespace YooAsset YooLogger.Warning($"{nameof(parameters.OperationSystemMaxTimeSlice)} minimum value is 30 milliseconds"); } - // 鉴定运行模式 - if (parameters is EditorSimulateModeParameters) - _playMode = EPlayMode.EditorSimulateMode; - else if (parameters is OfflinePlayModeParameters) - _playMode = EPlayMode.OfflinePlayMode; - else if (parameters is HostPlayModeParameters) - _playMode = EPlayMode.HostPlayMode; - else - throw new NotImplementedException(); + // 创建驱动器 + if (_isInitialize == false) + { + _isInitialize = true; + UnityEngine.GameObject driverGo = new UnityEngine.GameObject("[YooAsset]"); + driverGo.AddComponent(); + UnityEngine.Object.DontDestroyOnLoad(driverGo); - // 初始化异步操作系统 +#if DEBUG + driverGo.AddComponent(); +#endif + } + + // 初始化异步系统 OperationSystem.Initialize(parameters.OperationSystemMaxTimeSlice); // 初始化下载系统 @@ -226,29 +237,32 @@ namespace YooAsset _editorSimulateModeImpl = new EditorSimulateModeImpl(); _bundleServices = _editorSimulateModeImpl; AssetSystem.Initialize(true, parameters.AssetLoadingMaxNumber, parameters.DecryptionServices, _bundleServices); - var editorSimulateModeParameters = parameters as EditorSimulateModeParameters; + var simulateModeParameters = parameters as EditorSimulateModeParameters; initializeOperation = _editorSimulateModeImpl.InitializeAsync( - editorSimulateModeParameters.LocationToLower, - editorSimulateModeParameters.SimulatePatchManifestPath); + simulateModeParameters.LocationToLower, + simulateModeParameters.SimulatePatchManifestPath); } else if (_playMode == EPlayMode.OfflinePlayMode) { _offlinePlayModeImpl = new OfflinePlayModeImpl(); _bundleServices = _offlinePlayModeImpl; AssetSystem.Initialize(false, parameters.AssetLoadingMaxNumber, parameters.DecryptionServices, _bundleServices); - initializeOperation = _offlinePlayModeImpl.InitializeAsync(parameters.LocationToLower, parameters.BuildinPackageName); + var playModeParameters = parameters as OfflinePlayModeParameters; + initializeOperation = _offlinePlayModeImpl.InitializeAsync( + playModeParameters.LocationToLower, + playModeParameters.BuildinPackageName); } else if (_playMode == EPlayMode.HostPlayMode) { _hostPlayModeImpl = new HostPlayModeImpl(); _bundleServices = _hostPlayModeImpl; AssetSystem.Initialize(false, parameters.AssetLoadingMaxNumber, parameters.DecryptionServices, _bundleServices); - var hostPlayModeParameters = parameters as HostPlayModeParameters; + var playModeParameters = parameters as HostPlayModeParameters; initializeOperation = _hostPlayModeImpl.InitializeAsync( - hostPlayModeParameters.LocationToLower, - hostPlayModeParameters.BuildinPackageName, - hostPlayModeParameters.DefaultHostServer, - hostPlayModeParameters.FallbackHostServer); + playModeParameters.LocationToLower, + playModeParameters.DefaultHostServer, + playModeParameters.FallbackHostServer, + playModeParameters.QueryServices); } else {