From 4490c99eee245ab74217720a21039a956c04a0af Mon Sep 17 00:00:00 2001 From: hevinci Date: Fri, 14 Apr 2023 16:43:27 +0800 Subject: [PATCH] update samples --- .../Runtime/GameLogic/FsmNode/FsmSceneBattle.cs | 6 +++--- .../Runtime/GameLogic/FsmNode/FsmSceneHome.cs | 11 ++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs index eef86f7..df1486e 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs @@ -35,13 +35,13 @@ internal class FsmSceneBattle : IStateNode private IEnumerator Prepare() { - yield return UniWindow.OpenWindowAsync("UILoading"); yield return YooAssets.LoadSceneAsync("scene_battle"); _battleRoom = new BattleRoom(); yield return _battleRoom.LoadRoom(); - // 等所有数据准备完毕后,关闭加载界面。 - UniWindow.CloseWindow(); + // 释放资源 + var package = YooAssets.GetPackage("DefaultPackage"); + package.UnloadUnusedAssets(); } } \ No newline at end of file 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 a92d193..df6e8d9 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 @@ -28,14 +28,11 @@ internal class FsmSceneHome : IStateNode private IEnumerator Prepare() { - if (_machine.PreviousNode != typeof(FsmInitGame).FullName) - yield return UniWindow.OpenWindowAsync("UILoading"); - yield return YooAssets.LoadSceneAsync("scene_home"); yield return UniWindow.OpenWindowAsync("UIHome"); - yield return new WaitForSeconds(0.5f); - - // 等所有数据准备完毕后,关闭加载界面。 - UniWindow.CloseWindow(); + + // 释放资源 + var package = YooAssets.GetPackage("DefaultPackage"); + package.UnloadUnusedAssets(); } } \ No newline at end of file