Init
This commit is contained in:
34
Assets/GameFramework/Runtime/Boot.cs
Normal file
34
Assets/GameFramework/Runtime/Boot.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
|
||||
namespace Tuan.GameFramework
|
||||
{
|
||||
public class Boot : MonoBehaviour
|
||||
{
|
||||
public GameObject player;
|
||||
public EPlayMode PlayMode = EPlayMode.EditorSimulateMode;
|
||||
void Awake()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
//PlayerPrefs.DeleteAll();
|
||||
#endif
|
||||
Application.targetFrameRate = 60;
|
||||
Application.runInBackground = true;
|
||||
DontDestroyOnLoad(player);
|
||||
}
|
||||
async void Start()
|
||||
{
|
||||
bool updateSuccess = await PatchManager.Inst.StartOperation(PlayMode);
|
||||
if (updateSuccess)
|
||||
await EnterGame();
|
||||
}
|
||||
private async UniTask EnterGame()
|
||||
{
|
||||
Debug.Log("EnterGame");
|
||||
var assetHandle = YooAssets.LoadAssetAsync<GameObject>("GameStart");
|
||||
await assetHandle.ToUniTask();
|
||||
GameObject.Instantiate(assetHandle.AssetObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user