Files
BlueArchiveMiniGame/Assets/Scripts/HotUpdate/Main/GameStart.cs

60 lines
1.7 KiB
C#
Raw Normal View History

2025-10-13 07:35:57 +08:00
using System.Collections;
2025-09-17 18:56:28 +08:00
using UnityEngine;
using UnityEngine.SceneManagement;
using YooAsset;
public class GameStart : MonoBehaviour
{
2025-09-29 11:03:26 +08:00
2025-09-17 18:56:28 +08:00
void Start()
{
2025-09-18 10:15:40 +08:00
DontDestroyOnLoad(gameObject);
2025-09-29 11:03:26 +08:00
StartCoroutine(StartupSequence());
}
IEnumerator StartupSequence()
{
2025-10-09 07:51:05 +08:00
Debug.Log("开始游戏启动流程...");
2025-09-29 11:03:26 +08:00
yield return StartCoroutine(InitializeGameSystems());
yield return StartCoroutine(LoadMainScene());
2025-10-09 07:51:05 +08:00
Debug.Log("游戏启动流程完成");
2025-09-29 11:03:26 +08:00
}
IEnumerator InitializeGameSystems()
{
2025-10-09 07:51:05 +08:00
Debug.Log("初始化游戏系统...");
2025-09-29 11:03:26 +08:00
GameSystem.Inst.Init();
2025-10-09 07:51:05 +08:00
Debug.Log("游戏系统初始化完成");
2025-09-29 11:03:26 +08:00
yield return null;
2025-09-17 18:56:28 +08:00
}
2025-09-29 11:03:26 +08:00
IEnumerator LoadMainScene()
2025-09-17 18:56:28 +08:00
{
2025-10-23 11:50:16 +08:00
SceneHandle sceneHandle = YooAssets.LoadSceneAsync("MirrorRoomOffline");
UIManager.Inst.ShowWindow<LoadingWindow>("LoadingWindow", window =>
{
window.TrackOperation(sceneHandle);
sceneHandle.UnSuspend();
});
2025-09-17 18:56:28 +08:00
sceneHandle.Completed += (handle) =>
{
2025-10-23 11:50:16 +08:00
GameManager.Inst.MainUICanvas.transform.Find("PatchWindow").gameObject.SetActive(false);
2025-09-17 18:56:28 +08:00
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-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;
}
}