Init
This commit is contained in:
55
Assets/Scripts/Runtime/Boot.cs
Normal file
55
Assets/Scripts/Runtime/Boot.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UniFramework.Event;
|
||||
using YooAsset;
|
||||
|
||||
public class Boot : Singleton<Boot>
|
||||
{
|
||||
public GameObject MainUICanvas;
|
||||
public Camera UICamera;
|
||||
public List<string> DepDlls = new List<string>()
|
||||
{
|
||||
"mscorlib.dll",
|
||||
"System.dll",
|
||||
"System.Core.dll",
|
||||
"Mirror.dll"
|
||||
};
|
||||
public List<GameObject> DontDestroyObjs = new List<GameObject>();
|
||||
/// <summary>
|
||||
/// 资源系统运行模式
|
||||
/// </summary>
|
||||
public EPlayMode PlayMode = EPlayMode.EditorSimulateMode;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
Debug.Log($"资源系统运行模式:{PlayMode}");
|
||||
Debug.Log($"Application.persistentDataPath:{Application.persistentDataPath}");
|
||||
Application.targetFrameRate = 60;
|
||||
Application.runInBackground = true;
|
||||
}
|
||||
IEnumerator Start()
|
||||
{
|
||||
foreach (GameObject obj in DontDestroyObjs)
|
||||
{
|
||||
DontDestroyOnLoad(obj);
|
||||
}
|
||||
GameManager.Inst.Behaviour = this;
|
||||
GameManager.Inst.MainUICanvas = MainUICanvas;
|
||||
GameManager.Inst.UICamera = UICamera;
|
||||
GameManager.Inst.LoadServerSettings();
|
||||
|
||||
YooAssets.Initialize();
|
||||
|
||||
//更新Preload
|
||||
var operation = new PatchOperation(PatchManager.Inst.PreloadData(PlayMode));
|
||||
YooAssets.StartOperation(operation);
|
||||
yield return operation;
|
||||
|
||||
//加载更新界面,Main更新流程以及GameStart调用在PatchWindow中
|
||||
GameManager.Inst.LoadDll(YooAssets.GetPackage("Preload"), "Preload");
|
||||
AssetHandle patchWindowHandle = YooAssets.GetPackage("Preload").LoadAssetAsync<GameObject>("PatchWindow");
|
||||
patchWindowHandle.InstantiateAsync(GameManager.Inst.MainUICanvas.transform);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user