diff --git a/ProjectNLD/Assets/Code/Scripts/HotUpdate/GameLauncher.cs b/ProjectNLD/Assets/Code/Scripts/HotUpdate/GameLauncher.cs index 853c6a019bc..25765a9f171 100644 --- a/ProjectNLD/Assets/Code/Scripts/HotUpdate/GameLauncher.cs +++ b/ProjectNLD/Assets/Code/Scripts/HotUpdate/GameLauncher.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; +using Cysharp.Threading.Tasks; using PhxhSDK.AOT; using PhxhSDK.AOT.SimpleLoader; using UnityEngine; @@ -25,8 +26,6 @@ public class GameLauncher : MonoBehaviour //最大能容忍的下载卡住时长,一旦超过则重新开始下载 // private const float DOWNLOAD_STUCK_TIME_MAX = 10; - private Coroutine _launchCoroutine; - private HybridCLRHelper _hybridCLRHelper; //version update @@ -48,27 +47,21 @@ public class GameLauncher : MonoBehaviour private void Start() { - _launchCoroutine = StartCoroutine(Launch()); + Launch(); } - private void OnDestroy() - { - StopCoroutine(_launchCoroutine); - _launchCoroutine = null; - } - - private IEnumerator Launch() + private async UniTask Launch() { #if UNITY_EDITOR enableHotUpdate = false; #endif #if USE_YOO - yield return YooAssetHelper.Init(); + await YooAssetHelper.Init(); #endif Debug.Log($"Launch Game! enableHotUpdate:{enableHotUpdate}"); - yield return VersionCheck(); + await VersionCheck(); if (HasContentToDownload) - yield return VersionUpdate(); + await VersionUpdate(); if (enableHotUpdate) { @@ -82,11 +75,11 @@ public class GameLauncher : MonoBehaviour _hybridCLRHelper.RegistLoader(new SimpleLoader_Addressables()); #endif - yield return _hybridCLRHelper.LoadAssemblies(); + await _hybridCLRHelper.LoadAssemblies(); Debug.Log("加载程序集结束!"); } - yield return EnterGame(); + await EnterGame(); } private IEnumerator VersionCheck() @@ -247,7 +240,6 @@ public class GameLauncher : MonoBehaviour { Debug.LogError( $"load scene failed,exception:{op.OperationException.Message} \r\n {op.OperationException.StackTrace}"); - yield break; } } diff --git a/ProjectNLD/Assets/PhxhSDK b/ProjectNLD/Assets/PhxhSDK index ec77ab3adb7..d6a427c9be3 160000 --- a/ProjectNLD/Assets/PhxhSDK +++ b/ProjectNLD/Assets/PhxhSDK @@ -1 +1 @@ -Subproject commit ec77ab3adb730c08bfc9dc9aa4e661f398108abb +Subproject commit d6a427c9be3372616285a4dda9bb6a900374018d