private void bindFacebookLoading(List <LoadingProvider> providers) { if (providers.Count != 0) { UniRx.IObservable <bool> nobodyIsLoading = from l in (from p in (IEnumerable <LoadingProvider>) providers select p.Loading).CombineLatest(seed: false, (bool a, bool b) => a || b) where !l select l; UniRx.IObservable <bool> observable = (from p in (IEnumerable <LoadingProvider>) providers select p.AdsReady).CombineLatest(seed: false, (bool a, bool b) => a || b); UniRx.IObservable <bool> adsBecomesReady = from r in observable where r select r; UniRx.IObservable <long> source = beginningsOfLoadingCycle(observable); source.Select((Func <long, UniRx.IObservable <LoadingProvider> >) delegate { int index = 0; return(from i in (from loading in nobodyIsLoading select++ index).Take(providers.Count).TakeUntil(adsBecomesReady) select providers[i]); }).Switch().Subscribe(delegate(LoadingProvider p) { preload(p); }) .AddTo(_disposable); } }
private void bindAdMobLoading(AdMobFlooredProvider adMob) { if (adMob._data.Count != 0) { UniRx.IObservable <bool> nobodyIsLoading = from l in adMob._provider.Loading where !l select l; UniRx.IObservable <bool> adsBecomesReady = from r in adMob.AdsReady where r select r; UniRx.IObservable <long> source = beginningsOfLoadingCycle(adMob.AdsReady); (from data in source.Select((Func <long, UniRx.IObservable <ZoneData> >) delegate { int index = 0; return(from i in (from loading in nobodyIsLoading select++ index).Take(adMob._data.Count).TakeUntil(adsBecomesReady) select adMob._data[i]); }).Switch() select data.Zone).Subscribe(delegate(string zone) { adMob.SetZone(zone); preload(adMob); }).AddTo(_disposable); } }
public static UniRx.IObservable <Unit> AsTrigger <T>(this UniRx.IObservable <T> observable) { return(observable.Select(x => Unit.Default)); }
protected override UniRx.IObservable <Command> AsyncSetCommandGetCacheByPath(UniRx.IObservable <Command> observable) { return(observable.Select(_command => this.SetCommandGetCacheByPath(_command))); }