From d12f4944295462b1b690701952d467c4502ba17b Mon Sep 17 00:00:00 2001 From: Compa <1158261439@qq.com> Date: Fri, 6 Jan 2023 20:03:31 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=85=E8=AF=BB=E6=BA=90=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/YooAsset/Samples~/Space Shooter/Boot.unity | 1 - .../Space Shooter/GameScript/Runtime/Boot.cs | 5 ++--- .../Runtime/GameLogic/FsmNode/FsmInitGame.cs | 5 ++++- .../Runtime/GameLogic/FsmNode/FsmSceneHome.cs | 5 ++++- .../PatchLogic/FsmNode/FsmUpdateVersion.cs | 15 +++++++++++++++ 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Assets/YooAsset/Samples~/Space Shooter/Boot.unity b/Assets/YooAsset/Samples~/Space Shooter/Boot.unity index 0640862..499c1da 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/Boot.unity +++ b/Assets/YooAsset/Samples~/Space Shooter/Boot.unity @@ -378,7 +378,6 @@ MonoBehaviour: m_Cameras: [] m_RendererIndex: -1 m_VolumeLayerMask: - serializedVersion: 2 m_Bits: 1 m_VolumeTrigger: {fileID: 0} m_VolumeFrameworkUpdateModeOption: 2 diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Boot.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Boot.cs index 909e526..8733aa5 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Boot.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Boot.cs @@ -3,7 +3,6 @@ using UniFramework.Event; using UniFramework.Module; using YooAsset; -//TODO wht real 框架加入该类 public class Boot : MonoBehaviour { /// @@ -14,8 +13,8 @@ public class Boot : MonoBehaviour void Awake() { Debug.Log($"资源系统运行模式:{PlayMode}"); - // Application.targetFrameRate = 60; - // Application.runInBackground = true; //TODO wht real 加入框架 + Application.targetFrameRate = 60; + Application.runInBackground = true; //TODO wht real 加入框架 } void Start() { diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmInitGame.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmInitGame.cs index 1843276..e348d51 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmInitGame.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmInitGame.cs @@ -29,8 +29,11 @@ internal class FsmInitGame : IStateNode private IEnumerator Prepare() { var handle = YooAssets.LoadAssetAsync("UICanvas"); + //TODO wht ref 参考;同步接口LoadAssetSync;关闭Enable Addressable,使用全路径 + //var handle = YooAssets.LoadAssetAsync("Assets/YooAsset/Assets/YooAsset/Samples/Space Shooter/GameRes/UIPanel/UICanvas.prefab"); + yield return handle; - var canvas = handle.InstantiateSync(); + var canvas = handle.InstantiateSync(); //TODO wht ref 参考; var desktop = canvas.transform.Find("Desktop").gameObject; GameObject.DontDestroyOnLoad(canvas); diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs index b3c1b1e..d22f22e 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs @@ -31,7 +31,10 @@ internal class FsmSceneHome : IStateNode if (_machine.PreviousNode != typeof(FsmInitGame).FullName) yield return UniWindow.OpenWindowAsync("UILoading"); - yield return YooAssets.LoadSceneAsync("scene_home"); + yield return YooAssets.LoadSceneAsync("scene_home"); + //TODO wht ref 参考;关闭Enable Addressable,使用全路径 + // yield return YooAssets.LoadSceneAsync("Assets/YooAsset/Assets/YooAsset/Samples/Space Shooter/GameRes/Scene/scene_home.unity"); + yield return UniWindow.OpenWindowAsync("UIHome"); yield return new WaitForSeconds(0.5f); diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateVersion.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateVersion.cs index e6f7679..8a241cb 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateVersion.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/PatchLogic/FsmNode/FsmUpdateVersion.cs @@ -45,6 +45,21 @@ internal class FsmUpdateVersion : IStateNode else { Debug.LogWarning(operation.Error); + + // 如果获取远端资源版本失败,说明当前网络无连接。 + // 在正常开始游戏之前,需要验证本地清单内容的完整性。 + string packageVersion = package.GetPackageVersion(); + var operation2 = package.CheckPackageContentsAsync(packageVersion); + yield return operation2; + if (operation2.Status == EOperationStatus.Succeed) + { + // TODO wht real 可开始游戏 + } + else + { + // TODO wht real资源内容本地并不完整,需要提示玩家联网更新。 + } + //TODO wht real 重试 PatchEventDefine.PackageVersionUpdateFailed.SendEventMessage(); //TODO wht real 不要 }