This commit is contained in:
CortexCore
2025-08-03 02:28:50 +08:00
parent ecae0f809c
commit c3f0a8e840
8 changed files with 114 additions and 6 deletions

View File

@@ -52,7 +52,7 @@ namespace BITKit.Entities
{
while (_onAddQueue.TryDequeue(out var entity))
{
if(_addingEntities.Remove(entity) is false)continue;
if(_addingEntities.Remove(entity) is false || entity.CancellationToken.IsCancellationRequested)continue;
OnAdd?.Invoke(entity);
MakeCache(entity);
}

View File

@@ -113,6 +113,19 @@ namespace BITKit
}
return false;
}
public static bool Contains<T>(this Span<T> span, T value)
{
foreach (var t in span)
{
if (Equals(t, value))
return true;
}
return false;
}
public static bool Contains<T>(IEnumerable<T> a, IEnumerable<T> b)
{
foreach (var x in b)

View File

@@ -5,6 +5,9 @@ using System.Threading;
using System.Threading.Tasks;
using Cysharp.Threading.Tasks;
using Unity.Mathematics;
#if UNITY_5_3_OR_NEWER
using UnityEngine;
#endif
namespace BITKit.Tween
{
@@ -68,7 +71,13 @@ namespace BITKit.Tween
//BIT4Log.Log<TweenSequence>($"已创建Tween,from:[{from}]to:[{to}]duration:[{duration}]delta:[{delta}]");
while (t < 1 && cancellationToken.IsCancellationRequested is false)
{
t = math.clamp(t + delta*BITApp.Time.DeltaTime, 0, 1);
var value = t + delta * BITApp.Time.DeltaTime;
#if UNITY_5_3_OR_NEWER
value = t+ delta * Time.deltaTime;
#endif
t = math.clamp(value, 0, 1);
var next = func(from, to, t);
#if UNITY_5_3_OR_NEWER
await UniTask.NextFrame(cancellationToken);