From 2c714da5b7ab96481255f0e4ccce16722e2b6b1b Mon Sep 17 00:00:00 2001 From: CortexCore <2630229280@qq.com> Date: Wed, 25 Dec 2024 11:11:31 +0800 Subject: [PATCH] 1 --- Src/Core/Mod/ModService_IO.cs | 4 ++++ Src/Core/Ticker/ITicker.cs | 14 ++++++++++++-- Src/Unity/Scripts/UX/Library/DashBoardProgress.cs | 13 ++++++++++++- Src/Unity/Scripts/UX/Utils/UXUtils.cs | 2 +- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Src/Core/Mod/ModService_IO.cs b/Src/Core/Mod/ModService_IO.cs index 5ccc936..7057577 100644 --- a/Src/Core/Mod/ModService_IO.cs +++ b/Src/Core/Mod/ModService_IO.cs @@ -11,6 +11,10 @@ namespace BITKit.Mod public static async UniTask LoadAsset(string location) where T : class { + if (LoadAssetAsyncFactory is null) + { + throw new Exception("LoadAssetAsyncFactory is null!Make sure Processor has been initialized."); + } foreach (var func in LoadAssetAsyncFactory.CastAsFunc()) { var value = await func.Invoke(location); diff --git a/Src/Core/Ticker/ITicker.cs b/Src/Core/Ticker/ITicker.cs index 2fa972a..1825d11 100644 --- a/Src/Core/Ticker/ITicker.cs +++ b/Src/Core/Ticker/ITicker.cs @@ -98,10 +98,18 @@ namespace BITKit try { if(_isDisposed)return; - if (IsSyncContext) { await BITApp.SwitchToMainThread(); + +#if UNITY_EDITOR + if (UnityEditor.EditorApplication.isPaused) + { + _timer.Start(); + return; + } +#endif + if(_isDisposed)return; } @@ -165,7 +173,9 @@ namespace BITKit public void Dispose() { - + _isDisposed = true; + _timer.Stop(); + _timer.Dispose(); } } diff --git a/Src/Unity/Scripts/UX/Library/DashBoardProgress.cs b/Src/Unity/Scripts/UX/Library/DashBoardProgress.cs index 8fc994c..2a43883 100644 --- a/Src/Unity/Scripts/UX/Library/DashBoardProgress.cs +++ b/Src/Unity/Scripts/UX/Library/DashBoardProgress.cs @@ -6,7 +6,7 @@ namespace BITKit.UX { // An element that displays progress inside a partially filled circle - public class DashBoardProgress : VisualElement + public class DashBoardProgress : VisualElement,INotifyValueChanged { public new class UxmlTraits : VisualElement.UxmlTraits { @@ -97,5 +97,16 @@ namespace BITKit.UX painter.Arc(new Vector2(width * 0.5f, height * 0.5f), width*0.5f - painter.lineWidth/2f, startAngle, endAngle); painter.Stroke(); } + + public void SetValueWithoutNotify(float newValue) + { + value = newValue; + } + + public float value + { + get => progress; + set => progress = value; + } } } \ No newline at end of file diff --git a/Src/Unity/Scripts/UX/Utils/UXUtils.cs b/Src/Unity/Scripts/UX/Utils/UXUtils.cs index 9942ed8..b4d1d0e 100644 --- a/Src/Unity/Scripts/UX/Utils/UXUtils.cs +++ b/Src/Unity/Scripts/UX/Utils/UXUtils.cs @@ -92,7 +92,7 @@ namespace BITKit.UX //ve = document.rootVisualElement.Q(bindPathAtt.Path); if (bindPathAtt.CanBeNull is false && ve is null) - BIT4Log.LogException(new NullReferenceException($"{self.GetType().Name}上未找到{bindPathAtt.Path}")); + BIT4Log.LogException(new NullReferenceException($"{self.GetType().Name},{rootVisualElement.name}上未找到{bindPathAtt.Path}")); try {