From 995b0c80504e8ce4788658209374dfa065942678 Mon Sep 17 00:00:00 2001 From: hevinci Date: Tue, 15 Aug 2023 18:19:07 +0800 Subject: [PATCH] update space shooter --- .../PatchLogic/FsmNode/FsmInitialize.cs | 22 ++++++++++++++++--- .../StreamingAssetsHelper.cs | 12 +--------- .../StreamingAssetsHelper2.cs | 12 +--------- 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitialize.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitialize.cs index 91c0614..f25b2bc 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitialize.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmInitialize.cs @@ -69,19 +69,20 @@ internal class FsmInitialize : IStateNode string fallbackHostServer = GetHostServerURL(); var createParameters = new HostPlayModeParameters(); createParameters.DecryptionServices = new GameDecryptionServices(); - createParameters.QueryServices = new GameQueryServices(); + createParameters.BuildinQueryServices = new GameQueryServices(); + createParameters.DeliveryQueryServices = new DefaultDeliveryQueryServices(); createParameters.RemoteServices = new RemoteServices(defaultHostServer, fallbackHostServer); initializationOperation = package.InitializeAsync(createParameters); } // WebGL运行模式 - if(playMode == EPlayMode.WebPlayMode) + if (playMode == EPlayMode.WebPlayMode) { string defaultHostServer = GetHostServerURL(); string fallbackHostServer = GetHostServerURL(); var createParameters = new WebPlayModeParameters(); createParameters.DecryptionServices = new GameDecryptionServices(); - createParameters.QueryServices = new GameQueryServices(); + createParameters.BuildinQueryServices = new GameQueryServices(); createParameters.RemoteServices = new RemoteServices(defaultHostServer, fallbackHostServer); initializationOperation = package.InitializeAsync(createParameters); } @@ -178,4 +179,19 @@ internal class FsmInitialize : IStateNode return 1024; } } + + /// + /// 默认的分发资源查询服务类 + /// + private class DefaultDeliveryQueryServices : IDeliveryQueryServices + { + public DeliveryFileInfo GetDeliveryFileInfo(string packageName, string fileName) + { + throw new NotImplementedException(); + } + public bool QueryDeliveryFiles(string packageName, string fileName) + { + return false; + } + } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/StreamingAssetsHelper/StreamingAssetsHelper.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/StreamingAssetsHelper/StreamingAssetsHelper.cs index dd264ca..f2f5521 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/StreamingAssetsHelper/StreamingAssetsHelper.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/StreamingAssetsHelper/StreamingAssetsHelper.cs @@ -6,18 +6,8 @@ using YooAsset; /// /// 资源文件查询服务类 /// -public class GameQueryServices : IQueryServices +public class GameQueryServices : IBuildinQueryServices { - public DeliveryFileInfo GetDeliveryFileInfo(string packageName, string fileName) - { - throw new System.NotImplementedException(); - } - - public bool QueryDeliveryFiles(string packageName, string fileName) - { - return false; - } - public bool QueryStreamingAssets(string packageName, string fileName) { // 注意:fileName包含文件格式 diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/StreamingAssetsHelper/StreamingAssetsHelper2.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/StreamingAssetsHelper/StreamingAssetsHelper2.cs index 2dbbc28..987f1b8 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/StreamingAssetsHelper/StreamingAssetsHelper2.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/StreamingAssetsHelper/StreamingAssetsHelper2.cs @@ -9,18 +9,8 @@ using YooAsset; /// /// 资源文件查询服务类 /// -public class GameQueryServices2 : IQueryServices +public class GameQueryServices2 : IBuildinQueryServices { - public DeliveryFileInfo GetDeliveryFileInfo(string packageName, string fileName) - { - throw new System.NotImplementedException(); - } - - public bool QueryDeliveryFiles(string packageName, string fileName) - { - return false; - } - public bool QueryStreamingAssets(string packageName, string fileName) { return StreamingAssetsHelper2.FileExists($"{StreamingAssetsDefine.RootFolderName}/{packageName}/{fileName}");