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