public void Play() { widget.alpha = 1f; UniRx.IObservable <Unit> source = Observable.FromCoroutine(InDisplay); UniRx.IObservable <Unit> source2 = Observable.FromCoroutine(WaitRoll); Observable.FromCoroutine(StartRoll); source.SelectMany(source2.SelectMany(StartRoll)).Subscribe(); }
public ResetAfterObservable(UniRx.IObservable <T> source, T defaultValue, TimeSpan dueTime, IScheduler scheduler) : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) { this.source = source; this.dueTime = dueTime; this.scheduler = scheduler; this.defaultValue = defaultValue; }
public static void Name(this IUnirxBind s, UniRx.IObservable <string> o) { var sub = o.Subscribe((str) => { s.GetGObject().name = str; }); s.GetUIBase().AddDisposable(sub); }
public static UniRx.IObservable <T> EmitWhenEnabled <T>(this UniRx.IObservable <T> obs, UniRx.IObservable <bool> enabler) { return((from e in enabler where e select e into _ select obs.TakeUntil(from e in enabler where !e select e)).Switch()); }
private void Awake() { client = new YnetConnecter(); if (ConnectOnAwake) { Connect(); } stream = client.OnRecievedMessage.ObserveOnMainThread().Publish().RefCount(); }
private UniRx.IObservable <bool> CreateUpgradeAfterPrestigeObservable() { UniRx.IObservable <bool> observable = Observable.Return <bool>(value: true); foreach (GearRunner item in Gears()) { observable = observable.CombineLatest(item.UpgradeAfterPrestigeAvailable, (bool old, bool current) => old && !current); } return(observable); }
protected virtual UniRx.IObservable <Command> AsyncSetCommandGetCacheByPath( UniRx.IObservable <Command> observable) { return(observable .ObserveOn(Scheduler.ThreadPool) .Select(command => this.SetCommandGetCacheByPath(command)) .ObserveOnMainThread() ); }
private UniRx.IObservable <bool> CreateUpgradeObservable() { UniRx.IObservable <bool> observable = Observable.Return <bool>(value: false); foreach (GearRunner item in Gears()) { observable = observable.CombineLatest(item.UpgradeAvailable, (bool old, bool current) => current || old); } return(observable); }
public UniRx.IObservable <SkillsEnum> CreateUnlockedObservable() { UniRx.IObservable <SkillsEnum> observable = Observable.Never <SkillsEnum>(); for (int i = 0; i < 5; i++) { observable = observable.Merge(GetOrCreateSkillRunner((SkillsEnum)i).UnlockTriggered); } return(observable); }
private UniRx.IObservable <int> CreateGearsLevelObservable() { UniRx.IObservable <int> observable = Observable.Return(0); foreach (GearRunner item in Gears()) { observable = observable.CombineLatest(item.Level, (int old, int current) => old + current); } return(observable); }
public UniRx.IObservable <int> CreateGearChestsObservable() { UniRx.IObservable <int> observable = Observable.Return(0); foreach (ReactiveProperty <int> item in PlayerData.Instance.GearChestsToCollect) { observable = observable.CombineLatest(item, (int org, int num) => org + num); } return(observable); }
public void SpriteIdx(UniRx.IObservable <int> index) { var g = gObject; var sub = index.Subscribe((idx) => { g.frame = idx; }); uiBase.AddDisposable(sub); }
public UniRx.IObservable <Unit> InvokeOut(GameObject owner) { var observers = new UniRx.IObservable <Unit> [this.elements.Length]; for (int i = 0; i < this.elements.Length; i++) { observers[i] = this.elements[i].InvokeOut(owner, this.tweenInterval * i); } return(Observable.Zip(observers).AsUnitObservable()); }
public void Editable(UniRx.IObservable <bool> editable) { var g = gObject; var sub = editable.Subscribe((b) => { g.asTextInput.editable = b; }); uiBase.AddDisposable(sub); }
public void Title(UniRx.IObservable <string> title) { var g = gObject; var dis = title.Subscribe((str) => { g.title = str; }); this.uiBase.AddDisposable(dis); }
public void Gray(UniRx.IObservable <bool> gray) { var g = gObject; var sub = gray.Subscribe((v) => { g.grayed = v; }); uiBase.AddDisposable(sub); }
public void SetSelectIndex(UniRx.IObservable <int> selectedIdx) { var g = gObject; var sub = selectedIdx.Subscribe((idx) => { g.selectedIndex = idx; }); uiBase.AddDisposable(sub); }
protected void Start() { GearRunner gearRunner = (GearRunner)Singleton <PropertyManager> .Instance.GetContext("GearRunner", base.transform); UniRx.IObservable <CraftingRequirement> left = GearCollectionRunner.CreateBlocksObservable(); left.CombineLatest(gearRunner.UpgradeRequirement, (CraftingRequirement blks, CraftingRequirement req) => req).Subscribe(delegate(CraftingRequirement req) { SetupResources(req); }).AddTo(this); }
public void Touchable(UniRx.IObservable <bool> o) { var g = gObject; var sub = o.Subscribe((b) => { g.touchable = b; }); uiBase.AddDisposable(sub); }
public static void Alpha(this IUnirxBind s, UniRx.IObservable <float> alpha) { var g = s.GetGObject(); var sub = alpha.Subscribe((a) => { g.alpha = a; }); s.GetUIBase().AddDisposable(sub); }
public void Editable(UniRx.IObservable <bool> editable) { var g = gObject; var sub = editable.Subscribe((b) => { g.richTextField.touchable = true; }); uiBase.AddDisposable(sub); }
//TODO 设置进度 秒数 public void Seconds(CustomController.VideoCtrl videoCtrl, UniRx.IObservable <float> seconds) { var g = gObject; var sub = seconds.Subscribe((s) => { videoCtrl.SetSeconds(s); }); uiBase.AddDisposable(sub); }
public void Text(UniRx.IObservable <string> text) { var g = gObject; var sub = text.Subscribe((str) => { g.text = str; }); uiBase.AddDisposable(sub); }
public void URL(UniRx.IObservable <string> url) { var g = gObject; var sub = url.Subscribe((str) => { g.url = str; }); uiBase.AddDisposable(sub); }
public void PlayVideo(UniRx.IObservable <Texture> videoTexture) { var g = gObject; var sub = videoTexture.Subscribe((texture) => { g.texture = new FairyGUI.NTexture(texture); }); uiBase.AddDisposable(sub); }
public void Visible(UniRx.IObservable <bool> visible) { var g = gObject; var sub = visible.Subscribe((a) => { g.visible = a; }); uiBase.AddDisposable(sub); }
public void Alpha(UniRx.IObservable <float> alpha) { var g = gObject; var sub = alpha.Subscribe((a) => { g.alpha = a; }); uiBase.AddDisposable(sub); }
//[UIAttributes.UIBindPropertyInfo("name")] public void Name(UniRx.IObservable <string> o) { var g = gObject; var sub = o.Subscribe((str) => { g.name = str; }); uiBase.AddDisposable(sub); }
void Start() { // generate clickstream UniRx.IObservable <long> clickStream = Observable.EveryUpdate() .Where(_ => Input.GetMouseButtonDown(0)); // multiple click counter with time window clickStream.Buffer(clickStream.Throttle(TimeSpan.FromMilliseconds(500))) .Where(x => x.Count >= 2) .Subscribe(x => Debug.Log($"multiple clicks detected! Count: {x.Count}")); }
public static UniRx.IObservable <float> CreateCombine(BonusTypeEnum type, List <UniRx.IObservable <float> > multipliers) { Func <float, float, float> func = CreateFunction(type); UniRx.IObservable <float> observable = CreateOrigin(type); foreach (UniRx.IObservable <float> multiplier in multipliers) { observable = observable.CombineLatest(multiplier, (float left, float right) => func(left, right)); } return(observable); }