UniRx 에셋 추가
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user