44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using Cysharp.Threading.Tasks;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using YooAsset;
|
|
using static UnityEngine.Rendering.VirtualTexturing.Debugging;
|
|
|
|
public class Boot : MonoBehaviour
|
|
{
|
|
public GameObject MainUICanvas;
|
|
public Camera UICamera;
|
|
public Camera MainCamera;
|
|
public EPlayMode PlayMode = EPlayMode.EditorSimulateMode;
|
|
void Awake()
|
|
{
|
|
#if UNITY_EDITOR
|
|
//PlayerPrefs.DeleteAll();
|
|
#endif
|
|
Application.targetFrameRate = 60;
|
|
Application.runInBackground = true;
|
|
DontDestroyOnLoad(MainUICanvas);
|
|
DontDestroyOnLoad(UICamera);
|
|
DontDestroyOnLoad(MainCamera);
|
|
}
|
|
async void Start()
|
|
{
|
|
GameManager.Inst.UICamera = UICamera;
|
|
GameManager.Inst.MainUICanvas = MainUICanvas;
|
|
bool updateSuccess = await PatchManager.Inst.StartOperation(PlayMode);
|
|
if (updateSuccess)
|
|
await EnterGame();
|
|
}
|
|
private async UniTask EnterGame()
|
|
{
|
|
Debug.Log("EnterGame");
|
|
var assetHandle = YooAssets.TryGetPackage("Main").LoadSceneAsync("Test");
|
|
await assetHandle.ToUniTask();
|
|
if (assetHandle.Status == EOperationStatus.Succeed)
|
|
{
|
|
assetHandle.ActivateScene();
|
|
PatchEvent.ClosePatchWindow();
|
|
}
|
|
}
|
|
}
|