[Add] UniRX

V7.1.0
This commit is contained in:
2026-05-27 03:26:36 +07:00
parent 73dee3a113
commit 9d28d1bc39
506 changed files with 42627 additions and 0 deletions
@@ -0,0 +1,37 @@
using System;
#if UniRxLibrary
using UnityObservable = UniRx.ObservableUnity;
#else
using UnityObservable = UniRx.Observable;
#endif
namespace UniRx.Operators
{
internal class DelayFrameSubscriptionObservable<T> : OperatorObservableBase<T>
{
readonly IObservable<T> source;
readonly int frameCount;
readonly FrameCountType frameCountType;
public DelayFrameSubscriptionObservable(IObservable<T> source, int frameCount, FrameCountType frameCountType)
: base(source.IsRequiredSubscribeOnCurrentThread())
{
this.source = source;
this.frameCount = frameCount;
this.frameCountType = frameCountType;
}
protected override IDisposable SubscribeCore(IObserver<T> observer, IDisposable cancel)
{
var d = new MultipleAssignmentDisposable();
d.Disposable = UnityObservable.TimerFrame(frameCount, frameCountType)
.SubscribeWithState3(observer, d, source, (_, o, disp, s) =>
{
disp.Disposable = s.Subscribe(o);
});
return d;
}
}
}