using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UniFramework.Event; using YooAsset; public class Boot : SingletonMono { public GameObject MainUICanvas; public Camera UICamera; public List DepDlls = new List() { "mscorlib.dll", "System.dll", "System.Core.dll", "Mirror.dll" }; public List DontDestroyObjs = new List(); /// /// 资源系统运行模式 /// 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"); YooAssets.GetPackage("Preload").LoadAssetAsync("PatchWindow").Completed+=(handle)=> { GameObject patchWindow = Instantiate((GameObject)handle.AssetObject, GameManager.Inst.MainUICanvas.transform); patchWindow.name = "PatchWindow"; }; } }