breakpoint
before update unity version
This commit is contained in:
@@ -25,17 +25,17 @@ namespace BITKit
|
||||
private static void Reload()
|
||||
{
|
||||
_ActionQueue.Clear();
|
||||
_AddActionQueue.Clear();
|
||||
_RemoveQueue.Clear();
|
||||
//_TickActions.Clear();
|
||||
TickCount = ulong.MinValue;
|
||||
}
|
||||
private static readonly Queue<Action> _ActionQueue = new();
|
||||
private static readonly Queue<Action<float>> _AddActionQueue = new();
|
||||
private static readonly Queue<Action<float>> _RemoveQueue = new();
|
||||
private static readonly Queue<Action> _ActionQueue = new();
|
||||
// private static readonly CacheList<Action<float>> _TickActions = new();
|
||||
// public static void Add(Action<float> action) => _TickActions.Add(action);
|
||||
// public static void Remove(Action<float> action) => _TickActions.Remove(action);
|
||||
private static event Action<float> _TickEvents;
|
||||
public static void Add( Action<float> action)=>_TickEvents += action;
|
||||
public static void Remove( Action<float> action)=>_TickEvents -= action;
|
||||
public static void Add(Action action)=>_ActionQueue.Enqueue(action);
|
||||
public static void Add(Action<float> action)=>_AddActionQueue.Enqueue(action);
|
||||
public static void Remove(Action<float> action)=>_RemoveQueue.Enqueue(action);
|
||||
public static ulong TickCount { get; private set; }
|
||||
|
||||
ulong ITicker.TickCount => TickCount;
|
||||
@@ -71,14 +71,20 @@ namespace BITKit
|
||||
TickCount++;
|
||||
try
|
||||
{
|
||||
var delta = BITApp.Time.TimeAsDouble - _lastTime;
|
||||
var delta = (float)(BITApp.Time.TimeAsDouble - _lastTime);
|
||||
_lastTime = BITApp.Time.TimeAsDouble;
|
||||
if (isMainThread) await UniTask.SwitchToMainThread(destroyCancellationToken);
|
||||
while (_ActionQueue.TryDequeue(out var action))
|
||||
{
|
||||
action?.Invoke();
|
||||
}
|
||||
_TickEvents?.Invoke((float)delta);
|
||||
_TickEvents?.Invoke(delta);
|
||||
// using var xEnumerator = _TickActions.GetEnumerator();
|
||||
// while (xEnumerator.MoveNext())
|
||||
// {
|
||||
// xEnumerator.Current!.Invoke(delta);
|
||||
// }
|
||||
//_TickEvents?.Invoke((float)delta);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
@@ -89,15 +95,6 @@ namespace BITKit
|
||||
BIT4Log.LogException(exception);
|
||||
}
|
||||
|
||||
while (_AddActionQueue.TryDequeue(out var action))
|
||||
{
|
||||
_TickEvents += action;
|
||||
}
|
||||
while (_RemoveQueue.TryDequeue(out var action))
|
||||
{
|
||||
_TickEvents -= action;
|
||||
}
|
||||
|
||||
if (isConcurrent is false && destroyCancellationToken.IsCancellationRequested is false)
|
||||
{
|
||||
_timer.Start();
|
||||
|
Reference in New Issue
Block a user