Exemple #1
0
 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;
 }
Exemple #3
0
        public static void Name(this IUnirxBind s, UniRx.IObservable <string> o)
        {
            var sub = o.Subscribe((str) =>
            {
                s.GetGObject().name = str;
            });

            s.GetUIBase().AddDisposable(sub);
        }
Exemple #4
0
 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());
 }
Exemple #5
0
 private void Awake()
 {
     client = new YnetConnecter();
     if (ConnectOnAwake)
     {
         Connect();
     }
     stream = client.OnRecievedMessage.ObserveOnMainThread().Publish().RefCount();
 }
Exemple #6
0
 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()
            );
 }
Exemple #8
0
 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);
 }
Exemple #9
0
 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);
 }
Exemple #10
0
 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);
 }
Exemple #11
0
 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);
 }
Exemple #12
0
        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());
            }
Exemple #14
0
        public void Editable(UniRx.IObservable <bool> editable)
        {
            var g   = gObject;
            var sub = editable.Subscribe((b) =>
            {
                g.asTextInput.editable = b;
            });

            uiBase.AddDisposable(sub);
        }
Exemple #15
0
        public void Title(UniRx.IObservable <string> title)
        {
            var g   = gObject;
            var dis = title.Subscribe((str) =>
            {
                g.title = str;
            });

            this.uiBase.AddDisposable(dis);
        }
Exemple #16
0
        public void Gray(UniRx.IObservable <bool> gray)
        {
            var g   = gObject;
            var sub = gray.Subscribe((v) =>
            {
                g.grayed = v;
            });

            uiBase.AddDisposable(sub);
        }
Exemple #17
0
        public void SetSelectIndex(UniRx.IObservable <int> selectedIdx)
        {
            var g   = gObject;
            var sub = selectedIdx.Subscribe((idx) =>
            {
                g.selectedIndex = idx;
            });

            uiBase.AddDisposable(sub);
        }
Exemple #18
0
    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);
    }
Exemple #19
0
        public void Touchable(UniRx.IObservable <bool> o)
        {
            var g   = gObject;
            var sub = o.Subscribe((b) =>
            {
                g.touchable = b;
            });

            uiBase.AddDisposable(sub);
        }
Exemple #20
0
        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);
        }
Exemple #21
0
        public void Editable(UniRx.IObservable <bool> editable)
        {
            var g   = gObject;
            var sub = editable.Subscribe((b) =>
            {
                g.richTextField.touchable = true;
            });

            uiBase.AddDisposable(sub);
        }
Exemple #22
0
        //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);
        }
Exemple #23
0
        public void Text(UniRx.IObservable <string> text)
        {
            var g   = gObject;
            var sub = text.Subscribe((str) =>
            {
                g.text = str;
            });

            uiBase.AddDisposable(sub);
        }
Exemple #24
0
        public void URL(UniRx.IObservable <string> url)
        {
            var g   = gObject;
            var sub = url.Subscribe((str) =>
            {
                g.url = str;
            });

            uiBase.AddDisposable(sub);
        }
Exemple #25
0
        public void PlayVideo(UniRx.IObservable <Texture> videoTexture)
        {
            var g   = gObject;
            var sub = videoTexture.Subscribe((texture) =>
            {
                g.texture = new FairyGUI.NTexture(texture);
            });

            uiBase.AddDisposable(sub);
        }
Exemple #26
0
        public void Visible(UniRx.IObservable <bool> visible)
        {
            var g   = gObject;
            var sub = visible.Subscribe((a) =>
            {
                g.visible = a;
            });

            uiBase.AddDisposable(sub);
        }
Exemple #27
0
        public void Alpha(UniRx.IObservable <float> alpha)
        {
            var g   = gObject;
            var sub = alpha.Subscribe((a) =>
            {
                g.alpha = a;
            });

            uiBase.AddDisposable(sub);
        }
Exemple #28
0
        //[UIAttributes.UIBindPropertyInfo("name")]
        public void Name(UniRx.IObservable <string> o)
        {
            var g   = gObject;
            var sub = o.Subscribe((str) =>
            {
                g.name = str;
            });

            uiBase.AddDisposable(sub);
        }
Exemple #29
0
    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}"));
    }
Exemple #30
0
    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);
    }