Update BITFramework.cs
This commit is contained in:
parent
ebd23c3537
commit
2564cd0790
|
@ -7,6 +7,7 @@ using BITKit.IO;
|
|||
using BITKit.UX;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UIElements;
|
||||
|
@ -52,6 +53,8 @@ namespace BITKit
|
|||
|
||||
[SerializeField] private bool isOffline;
|
||||
[SerializeField] private bool IsEditorSimulateMode;
|
||||
|
||||
[SerializeField] private UnityEvent<Action<float>,Action<string>> afterInitialize=new();
|
||||
|
||||
[UXBindPath("progress-bar",true)]
|
||||
private ProgressBar _progressBar;
|
||||
|
@ -61,6 +64,7 @@ namespace BITKit
|
|||
private Label _progressLabel;
|
||||
|
||||
private Action<float> _setProgressValue;
|
||||
private Action<string> _setProgressLabel;
|
||||
private async void Start()
|
||||
{
|
||||
try
|
||||
|
@ -79,8 +83,11 @@ namespace BITKit
|
|||
_setProgressValue = value =>
|
||||
_progressFill.style.width = new Length() { value = value*100, unit = LengthUnit.Percent };
|
||||
}
|
||||
_setProgressLabel = value => _progressLabel.text = value;
|
||||
|
||||
_setProgressValue?.Invoke(0f);
|
||||
|
||||
_setProgressLabel?.Invoke("正在初始化资源系统...");
|
||||
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
|
@ -174,7 +181,10 @@ namespace BITKit
|
|||
_progressLabel.text =e.Message;
|
||||
}
|
||||
|
||||
_setProgressLabel?.Invoke("资源系统初始化完成,后处理中...");
|
||||
afterInitialize.Invoke(_setProgressValue,_setProgressLabel);
|
||||
|
||||
_setProgressLabel?.Invoke("资源系统初始化完成,后处理完成");
|
||||
if (addressableName is not null)
|
||||
{
|
||||
_progressLabel.text ="正在初始化Framework";
|
||||
|
|
Loading…
Reference in New Issue