Delay
DelayFrame
DelayFrameSubscription
DelaySubscription
Delay
延迟一定的时间来继续执行之前的流,延迟的时间不计算在基础流里面,权当附加的一个功能,只针对基于时间的流有效果,图解
输出结果
代码示例
public class No05_Delay : MonoBehaviour
{
void Start()
{
var timerStream = Observable.Timer(TimeSpan.FromSeconds(3f));
var timerSubscribe = timerStream.Subscribe(_ => Debug.Log("after 3 seconds"));
var delayStream = timerStream.Delay(TimeSpan.FromSeconds(1f));
var disposable = delayStream.Subscribe(Next, Error, Complete);
disposable.AddTo(gameObject);
timerSubscribe.AddTo(gameObject);
}
void Next(long time)
{
Debug.LogFormat("delay 1 second");
}
void Error