public static IObservable <string> Get(string url, IDictionary <string, string> headers = null, IProgress <float> progress = null) { return (ObservableUnity.FromCoroutine <string>( (observer, cancellation) => FetchText(UnityWebRequest.Get(url), headers, observer, progress, cancellation))); }
public static IObservable <WWW> PostWWW(string url, byte[] postData, IProgress <float> progress = null) { return(Observable.FromCoroutine <WWW>((IObserver <WWW> observer, CancellationToken cancellation) => ObservableWWW.Fetch(new WWW(url, postData), observer, progress, cancellation))); }
public static IObservable <UnityWebRequest> PostRequest(string url, Dictionary <string, string> postData, IDictionary <string, string> headers, IProgress <float> progress = null) { return(ObservableUnity.FromCoroutine <UnityWebRequest>((observer, cancellation) => Fetch(UnityWebRequest.Post(url, postData), headers, observer, progress, cancellation))); }
public static IObservable <byte[]> GetAndGetBytes(string url, Hash headers = null, IProgress <float> progress = null) { return(Observable.FromCoroutine <byte[]>((observer, cancellation) => FetchBytes(new WWW(url, null, (headers ?? new Hash())), observer, progress, cancellation))); }
// T: where T : AsyncOperation is ambigious with IObservable<T>.AsObservable public static IObservable <T> AsAsyncOperationObservable <T>(this T asyncOperation, IProgress <float> progress = null) where T : AsyncOperation { return(ObservableUnity.FromCoroutine <T>((observer, cancellation) => AsObservableCore(asyncOperation, observer, progress, cancellation))); }
public static IObservable <WWW> PostWWW(string url, byte[] postData, Hash headers, IProgress <float> progress = null) { return(Observable.FromCoroutine <WWW>((observer, cancellation) => Fetch(new WWW(url, postData, headers), observer, progress, cancellation))); }
public static IObservable <WWW> PostWWW(string url, WWWForm content, Hash headers, IProgress <float> progress = null) { var contentHeaders = content.headers; return(Observable.FromCoroutine <WWW>((observer, cancellation) => Fetch(new WWW(url, content.data, MergeHash(contentHeaders, headers)), observer, progress, cancellation))); }
public static IObservable <string> Post(string url, byte[] postData, IProgress <float> progress = null) { return(Observable.FromCoroutine((IObserver <string> observer, CancellationToken cancellation) => FetchText(new WWW(url, postData), observer, progress, cancellation))); }
public static IObservable <byte[]> PostAndGetBytes(string url, WWWForm content, IProgress <float> progress = null) { return(Observable.FromCoroutine((IObserver <byte[]> observer, CancellationToken cancellation) => FetchBytes(new WWW(url, content), observer, progress, cancellation))); }
// Interval, Timer, Delay, Sample, Throttle, Timeout public static IObservable <Unit> NextFrame(FrameCountType frameCountType = FrameCountType.Update) { return(Observable.FromCoroutine <Unit>((observer, cancellation) => NextFrameCore(observer, frameCountType, cancellation))); }
public static IObservable <long> TimerFrame(int dueTimeFrameCount, int periodFrameCount, FrameCountType frameCountType = FrameCountType.Update) { return(Observable.FromCoroutine <long>((observer, cancellation) => TimerFrameCore(observer, dueTimeFrameCount, periodFrameCount, frameCountType, cancellation))); }
/// <summary> /// Note: publishEveryYield is always false. If you want to set true, use Observable.FromCoroutine(() => selector(x), true). This is workaround of Unity compiler's bug. /// </summary> public static IObservable <Unit> SelectMany <T>(this IObservable <T> source, Func <T, IEnumerator> selector) { return(source.SelectMany(x => Observable.FromCoroutine(() => selector(x), false))); }
public static IObservable <Unit> SelectMany <T>(this IObservable <T> source, Func <IEnumerator> selector, bool publishEveryYield = false) { return(source.SelectMany(Observable.FromCoroutine(() => selector(), publishEveryYield))); }
/// <summary>Convert coroutine to typed IObservable. If nullAsNextUpdate = true then yield return null when Enumerator.Current and no null publish observer.OnNext.</summary> public static IObservable <T> FromCoroutineValue <T>(Func <IEnumerator> coroutine, bool nullAsNextUpdate = true) { return(Observable.FromCoroutine <T>((observer, cancellationToken) => WrapEnumeratorYieldValue <T>(coroutine(), observer, cancellationToken, nullAsNextUpdate))); }
public static IObservable <WWW> LoadFromCacheOrDownload(string url, int version, uint crc, IProgress <float> progress = null) { return(Observable.FromCoroutine <WWW>((observer, cancellation) => Fetch(WWW.LoadFromCacheOrDownload(url, version, crc), observer, progress, cancellation))); }
public static IObservable <WWW> PostWWW(string url, byte[] postData, Dictionary <string, string> headers, IProgress <float> progress = null) { return(Observable.FromCoroutine((IObserver <WWW> observer, CancellationToken cancellation) => Fetch(new WWW(url, postData, headers), observer, progress, cancellation))); }
public static IObservable <byte[]> PostAndGetBytes(string url, byte[] postData, IProgress <float> progress = null) { return(Observable.FromCoroutine <byte[]>((observer, cancellation) => FetchBytes(new WWW(url, postData), observer, progress, cancellation))); }
public static IObservable <WWW> PostWWW(string url, WWWForm content, Dictionary <string, string> headers, IProgress <float> progress = null) { Dictionary <string, string> contentHeaders = content.headers; return(Observable.FromCoroutine((IObserver <WWW> observer, CancellationToken cancellation) => Fetch(new WWW(url, content.data, MergeHash(contentHeaders, headers)), observer, progress, cancellation))); }
public static IObservable <WWW> PostWWW(string url, WWWForm content, IProgress <float> progress = null) { return(Observable.FromCoroutine <WWW>((observer, cancellation) => Fetch(new WWW(url, content), observer, progress, cancellation))); }
public static IObservable <string> Get(string url, Dictionary <string, string> headers = null, IProgress <float> progress = null) { return(Observable.FromCoroutine((IObserver <string> observer, CancellationToken cancellation) => FetchText(new WWW(url, (byte[])null, headers ?? new Dictionary <string, string>()), observer, progress, cancellation))); }
public static IObservable <AssetBundle> LoadFromCacheOrDownload(string url, Hash128 hash128, uint crc, IProgress <float> progress = null) { return(Observable.FromCoroutine <AssetBundle>((observer, cancellation) => FetchAssetBundle(WWW.LoadFromCacheOrDownload(url, hash128, crc), observer, progress, cancellation))); }
public static IObservable <AssetBundle> LoadFromCacheOrDownload(string url, int version, uint crc, IProgress <float> progress = null) { return(Observable.FromCoroutine((IObserver <AssetBundle> observer, CancellationToken cancellation) => FetchAssetBundle(WWW.LoadFromCacheOrDownload(url, version, crc), observer, progress, cancellation))); }
/// <summary> /// If you needs return value, use AsAsyncOperationObservable instead. /// </summary> public static IObservable <AsyncOperation> AsObservable(this AsyncOperation asyncOperation, IProgress <float> progress = null) { return(ObservableUnity.FromCoroutine <AsyncOperation>((observer, cancellation) => AsObservableCore(asyncOperation, observer, progress, cancellation))); }
public static UniRx.IObservable <T> AsAsyncOperationObservable <T>(this T asyncOperation, IProgress <float> progress = null) where T : AsyncOperation { return(Observable.FromCoroutine((UniRx.IObserver <T> observer, CancellationToken cancellation) => AsObservableCore(asyncOperation, observer, progress, cancellation))); }
public static IObservable <byte[]> ToBytesObservable(this UnityWebRequest request, IProgress <float> progress = null) { return(ObservableUnity.FromCoroutine <byte[]>((observer, cancellation) => Fetch(request, null, observer, progress, cancellation))); }
public static UniRx.IObservable <AsyncOperation> AsObservable(this AsyncOperation asyncOperation, IProgress <float> progress = null) { return(Observable.FromCoroutine((UniRx.IObserver <AsyncOperation> observer, CancellationToken cancellation) => AsObservableCore(asyncOperation, observer, progress, cancellation))); }
public static IObservable <byte[]> PostAndGetBytes(string url, Dictionary <string, string> postData, IProgress <float> progress = null) { return(ObservableUnity.FromCoroutine <byte[]>((observer, cancellation) => FetchBytes(UnityWebRequest.Post(url, postData), null, observer, progress, cancellation))); }
public static IObservable <byte[]> PostAndGetBytes(string url, WWWForm content, Hash headers, IProgress <float> progress = null) { var contentHeaders = (Hash)(object)content.headers; return(Observable.FromCoroutine <byte[]>((observer, cancellation) => FetchBytes(new WWW(url, content.data, MergeHash(contentHeaders, headers)), observer, progress, cancellation))); }
public static IObservable <AssetBundle> LoadFromCacheOrDownload(string url, uint version, uint crc, IProgress <float> progress = null) { return(ObservableUnity.FromCoroutine <AssetBundle>((observer, cancellation) => FetchAssetBundle(UnityWebRequestAssetBundle.GetAssetBundle(url, version, crc), null, observer, progress, cancellation))); }
public static IObservable <byte[]> PostAndGetBytes(string url, WWWForm content, Dictionary <string, string> headers, IProgress <float> progress = null) { Dictionary <string, string> contentHeaders = content.headers; return(Observable.FromCoroutine <byte[]>((IObserver <byte[]> observer, CancellationToken cancellation) => ObservableWWW.FetchBytes(new WWW(url, content.data, ObservableWWW.MergeHash(contentHeaders, headers)), observer, progress, cancellation))); }