update samples

pull/98/head^2
hevinci 2023-04-14 16:43:27 +08:00
parent 9a84cdef9f
commit 4490c99eee
2 changed files with 7 additions and 10 deletions

View File

@ -35,13 +35,13 @@ internal class FsmSceneBattle : IStateNode
private IEnumerator Prepare() private IEnumerator Prepare()
{ {
yield return UniWindow.OpenWindowAsync<UILoadingWindow>("UILoading");
yield return YooAssets.LoadSceneAsync("scene_battle"); yield return YooAssets.LoadSceneAsync("scene_battle");
_battleRoom = new BattleRoom(); _battleRoom = new BattleRoom();
yield return _battleRoom.LoadRoom(); yield return _battleRoom.LoadRoom();
// 等所有数据准备完毕后,关闭加载界面。 // 释放资源
UniWindow.CloseWindow<UILoadingWindow>(); var package = YooAssets.GetPackage("DefaultPackage");
package.UnloadUnusedAssets();
} }
} }

View File

@ -28,14 +28,11 @@ internal class FsmSceneHome : IStateNode
private IEnumerator Prepare() private IEnumerator Prepare()
{ {
if (_machine.PreviousNode != typeof(FsmInitGame).FullName)
yield return UniWindow.OpenWindowAsync<UILoadingWindow>("UILoading");
yield return YooAssets.LoadSceneAsync("scene_home"); yield return YooAssets.LoadSceneAsync("scene_home");
yield return UniWindow.OpenWindowAsync<UIHomeWindow>("UIHome"); yield return UniWindow.OpenWindowAsync<UIHomeWindow>("UIHome");
yield return new WaitForSeconds(0.5f);
// 释放资源
// 等所有数据准备完毕后,关闭加载界面。 var package = YooAssets.GetPackage("DefaultPackage");
UniWindow.CloseWindow<UILoadingWindow>(); package.UnloadUnusedAssets();
} }
} }