From 889000d8a8070b34f96fa0e74f48c50d03aff360 Mon Sep 17 00:00:00 2001 From: hevinci Date: Mon, 12 Dec 2022 20:16:34 +0800 Subject: [PATCH] update samples --- .../PatchLogic/FsmNode/FsmInitialize.cs | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 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 601f807..1590d7a 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 @@ -32,6 +32,8 @@ internal class FsmInitialize : IStateNode private IEnumerator InitPackage() { + yield return new WaitForSeconds(1f); + var playMode = PatchManager.Instance.PlayMode; // 创建默认的资源包 @@ -44,11 +46,12 @@ internal class FsmInitialize : IStateNode } // 编辑器下的模拟模式 + InitializationOperation initializationOperation = null; if (playMode == EPlayMode.EditorSimulateMode) { var createParameters = new EditorSimulateModeParameters(); createParameters.SimulatePatchManifestPath = EditorSimulateModeHelper.SimulateBuild(packageName); - yield return package.InitializeAsync(createParameters); + initializationOperation = package.InitializeAsync(createParameters); } // 单机运行模式 @@ -56,7 +59,7 @@ internal class FsmInitialize : IStateNode { var createParameters = new OfflinePlayModeParameters(); createParameters.DecryptionServices = new GameDecryptionServices(); - yield return package.InitializeAsync(createParameters); + initializationOperation = package.InitializeAsync(createParameters); } // 联机运行模式 @@ -67,13 +70,19 @@ internal class FsmInitialize : IStateNode createParameters.QueryServices = new GameQueryServices(); createParameters.DefaultHostServer = GetHostServerURL(); createParameters.FallbackHostServer = GetHostServerURL(); - yield return package.InitializeAsync(createParameters); + initializationOperation = package.InitializeAsync(createParameters); } - if (package.InitializeStatus == EOperationStatus.Succeed) - _machine.ChangeState(); - else - PatchEventDefine.InitializeFailed.SendEventMessage(); + yield return initializationOperation; + if (package.InitializeStatus == EOperationStatus.Succeed) + { + _machine.ChangeState(); + } + else + { + Debug.LogWarning($"{initializationOperation.Error}"); + PatchEventDefine.InitializeFailed.SendEventMessage(); + } } ///