update samples

pull/62/head
hevinci 2022-12-12 20:16:34 +08:00
parent e827e74cc7
commit 889000d8a8
1 changed files with 16 additions and 7 deletions

View File

@ -32,6 +32,8 @@ internal class FsmInitialize : IStateNode
private IEnumerator InitPackage() private IEnumerator InitPackage()
{ {
yield return new WaitForSeconds(1f);
var playMode = PatchManager.Instance.PlayMode; var playMode = PatchManager.Instance.PlayMode;
// 创建默认的资源包 // 创建默认的资源包
@ -44,11 +46,12 @@ internal class FsmInitialize : IStateNode
} }
// 编辑器下的模拟模式 // 编辑器下的模拟模式
InitializationOperation initializationOperation = null;
if (playMode == EPlayMode.EditorSimulateMode) if (playMode == EPlayMode.EditorSimulateMode)
{ {
var createParameters = new EditorSimulateModeParameters(); var createParameters = new EditorSimulateModeParameters();
createParameters.SimulatePatchManifestPath = EditorSimulateModeHelper.SimulateBuild(packageName); 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(); var createParameters = new OfflinePlayModeParameters();
createParameters.DecryptionServices = new GameDecryptionServices(); 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.QueryServices = new GameQueryServices();
createParameters.DefaultHostServer = GetHostServerURL(); createParameters.DefaultHostServer = GetHostServerURL();
createParameters.FallbackHostServer = GetHostServerURL(); createParameters.FallbackHostServer = GetHostServerURL();
yield return package.InitializeAsync(createParameters); initializationOperation = package.InitializeAsync(createParameters);
} }
yield return initializationOperation;
if (package.InitializeStatus == EOperationStatus.Succeed) if (package.InitializeStatus == EOperationStatus.Succeed)
{
_machine.ChangeState<FsmUpdateVersion>(); _machine.ChangeState<FsmUpdateVersion>();
}
else else
{
Debug.LogWarning($"{initializationOperation.Error}");
PatchEventDefine.InitializeFailed.SendEventMessage(); PatchEventDefine.InitializeFailed.SendEventMessage();
}
} }
/// <summary> /// <summary>