58 lines
1.8 KiB
C#
58 lines
1.8 KiB
C#
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using UniFramework.Event;
|
||
using YooAsset;
|
||
|
||
public class Boot : SingletonMono<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");
|
||
YooAssets.GetPackage("Preload").LoadAssetAsync<GameObject>("PatchWindow").Completed+=(handle)=>
|
||
{
|
||
GameObject patchWindow = Instantiate((GameObject)handle.AssetObject, GameManager.Inst.MainUICanvas.transform);
|
||
patchWindow.name = "PatchWindow";
|
||
};
|
||
}
|
||
} |