using UnityEngine; using Cysharp.Threading.Tasks; using Tuan.GameFramework; using Tuan.GameScripts.Preload; using YooAsset; namespace Tuan.GameScripts.Main { public class GameStart : MonoBehaviour { // Start is called once before the first execution of Update after the MonoBehaviour is created async void Start() { Debug.Log("GameStart"); GamePreload.Inst.Test("call by GameStart"); _ = LoadSceneTest(); // _ = FrameSplittingTest(1); //SimpleR3Test ui = await UIManager.Inst.ShowUIAsync("test1", MainUICanvas.Inst.Medium); //UIManager.Inst.CloseUI(ui); //await UIManager.Inst.ShowUIAsync("test2", MainUICanvas.Inst.Medium); //await UIManager.Inst.ShowUIAsync("test3", MainUICanvas.Inst.Medium); //await UIManager.Inst.ShowUIAsync("test1"); } async UniTask FrameSplittingTest(int delayFrame) { for (int i = 0; i < 100; i++) { Debug.Log(i); await UniTask.DelayFrame(delayFrame); } } async UniTask LoadSceneTest() { PatchEvent.ClosePatchWindow(); LoadingWindow loadingWindow = await UIManager.Inst.ShowUIAsync("LoadSceneTest",MainUICanvas.Inst.Medium); await SceneLoader.Inst.LoadSceneAsync("SampleScene", loadingWindow); GameObject startPos = GameObject.Find("StartPos"); GameManager.Inst.Player.transform.position += startPos.transform.position; GameManager.Inst.Player.transform.eulerAngles += startPos.transform.eulerAngles; } } }