update samples

pull/62/head
hevinci 2022-12-05 16:30:47 +08:00
parent 824d1c1501
commit ac251114ff
1 changed files with 14 additions and 7 deletions

View File

@ -4,6 +4,7 @@ using UnityEngine;
using UniFramework.Pooling; using UniFramework.Pooling;
using UniFramework.Window; using UniFramework.Window;
using UniFramework.Machine; using UniFramework.Machine;
using UniFramework.Module;
using YooAsset; using YooAsset;
internal class FsmInitGame : IStateNode internal class FsmInitGame : IStateNode
@ -16,7 +17,19 @@ internal class FsmInitGame : IStateNode
} }
void IStateNode.OnEnter() void IStateNode.OnEnter()
{ {
var handle = YooAssets.LoadAssetSync<GameObject>("UICanvas"); UniModule.StartCoroutine(Prepare());
}
void IStateNode.OnUpdate()
{
}
void IStateNode.OnExit()
{
}
private IEnumerator Prepare()
{
var handle = YooAssets.LoadAssetAsync<GameObject>("UICanvas");
yield return handle;
var canvas = handle.InstantiateSync(); var canvas = handle.InstantiateSync();
var desktop = canvas.transform.Find("Desktop").gameObject; var desktop = canvas.transform.Find("Desktop").gameObject;
GameObject.DontDestroyOnLoad(canvas); GameObject.DontDestroyOnLoad(canvas);
@ -29,10 +42,4 @@ internal class FsmInitGame : IStateNode
_machine.ChangeState<FsmSceneHome>(); _machine.ChangeState<FsmSceneHome>();
} }
void IStateNode.OnUpdate()
{
}
void IStateNode.OnExit()
{
}
} }