Files
TuanTuan-Engine/Assets/GameFramework/Runtime/Boot.cs

34 lines
969 B
C#
Raw Normal View History

2025-11-03 17:46:28 +08:00
using Cysharp.Threading.Tasks;
2025-11-03 00:24:36 +08:00
using UnityEngine;
using YooAsset;
2025-11-12 07:04:31 +08:00
namespace Tuan.GameFramework
2025-11-03 00:24:36 +08:00
{
2025-11-12 07:04:31 +08:00
public class Boot : MonoBehaviour
2025-11-03 00:24:36 +08:00
{
2025-11-12 07:04:31 +08:00
public Camera MainCamera;
public EPlayMode PlayMode = EPlayMode.EditorSimulateMode;
void Awake()
{
2025-11-03 00:24:36 +08:00
#if UNITY_EDITOR
2025-11-12 07:04:31 +08:00
//PlayerPrefs.DeleteAll();
2025-11-03 00:24:36 +08:00
#endif
2025-11-12 07:04:31 +08:00
Application.targetFrameRate = 60;
Application.runInBackground = true;
DontDestroyOnLoad(MainCamera);
}
async void Start()
{
bool updateSuccess = await PatchManager.Inst.StartOperation(PlayMode);
if (updateSuccess)
await EnterGame();
}
private async UniTask EnterGame()
2025-11-04 16:19:53 +08:00
{
2025-11-12 07:04:31 +08:00
Debug.Log("EnterGame");
2025-11-12 18:39:09 +08:00
var assetHandle = YooAssets.LoadAssetAsync<GameObject>("GameStart");
2025-11-12 07:04:31 +08:00
await assetHandle.ToUniTask();
2025-11-12 18:39:09 +08:00
GameObject.Instantiate(assetHandle.AssetObject);
2025-11-04 16:19:53 +08:00
}
2025-11-03 00:24:36 +08:00
}
2025-11-12 07:04:31 +08:00
}