2025-09-17 18:56:28 +08:00
|
|
|
using System.Collections;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
using YooAsset;
|
|
|
|
|
|
|
|
|
|
public class GameStart : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
SceneHandle sceneHandle;
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
2025-09-18 10:15:40 +08:00
|
|
|
DontDestroyOnLoad(gameObject);
|
2025-09-17 18:56:28 +08:00
|
|
|
StartCoroutine(LoadScene());
|
2025-09-29 07:45:07 +08:00
|
|
|
//StartCoroutine(LoadUIManager());
|
2025-09-17 18:56:28 +08:00
|
|
|
}
|
|
|
|
|
IEnumerator LoadScene()
|
|
|
|
|
{
|
|
|
|
|
sceneHandle = YooAssets.LoadSceneAsync("MirrorRoomOffline");
|
|
|
|
|
//sceneHandle = YooAssets.LoadSceneAsync("Game");
|
|
|
|
|
sceneHandle.Completed += (handle) =>
|
|
|
|
|
{
|
|
|
|
|
handle.ActivateScene();
|
2025-09-18 10:15:40 +08:00
|
|
|
StartCoroutine(LoadNetWorkHUD());
|
2025-09-17 18:56:28 +08:00
|
|
|
};
|
|
|
|
|
yield return sceneHandle;
|
|
|
|
|
}
|
2025-09-29 07:45:07 +08:00
|
|
|
//IEnumerator LoadUIManager()
|
|
|
|
|
//{
|
|
|
|
|
// AssetHandle _handle = YooAssets.LoadAssetAsync<GameObject>("UIManager");
|
|
|
|
|
// _handle.Completed += (handle) =>
|
|
|
|
|
// {
|
|
|
|
|
// GameObject go = Instantiate((GameObject)_handle.AssetObject);
|
|
|
|
|
// DontDestroyOnLoad(go);
|
|
|
|
|
// Debug.Log(_handle.AssetObject);
|
|
|
|
|
// };
|
|
|
|
|
// yield return _handle;
|
|
|
|
|
//}
|
2025-09-18 10:15:40 +08:00
|
|
|
IEnumerator LoadNetWorkHUD()
|
2025-09-17 18:56:28 +08:00
|
|
|
{
|
2025-09-18 10:15:40 +08:00
|
|
|
AssetHandle _handle = YooAssets.LoadAssetAsync<GameObject>("MyNetWorkHUD");
|
2025-09-17 18:56:28 +08:00
|
|
|
_handle.Completed += (handle) =>
|
|
|
|
|
{
|
2025-09-18 10:15:40 +08:00
|
|
|
GameObject go = Instantiate((GameObject)_handle.AssetObject,GameManager.Inst.MainUICanvas.transform);
|
2025-09-17 18:56:28 +08:00
|
|
|
Debug.Log(_handle.AssetObject);
|
|
|
|
|
};
|
|
|
|
|
yield return _handle;
|
|
|
|
|
}
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
2025-09-22 09:40:24 +08:00
|
|
|
//if(sceneHandle!=null && sceneHandle.IsValid)
|
|
|
|
|
//{
|
|
|
|
|
// Debug.Log(sceneHandle.Progress);
|
|
|
|
|
//}
|
2025-09-17 18:56:28 +08:00
|
|
|
}
|
|
|
|
|
}
|