Files
BlueArchiveMiniGame/Assets/Scripts/Runtime/Boot.cs

55 lines
1.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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");
AssetHandle patchWindowHandle = YooAssets.GetPackage("Preload").LoadAssetAsync<GameObject>("PatchWindow");
patchWindowHandle.InstantiateAsync(GameManager.Inst.MainUICanvas.transform);
}
}