protected virtual void Start()
        {
            if (Object.op_Inequality((Object)this._nameLabel, (Object)null))
            {
                UnityUIComponentExtensions.SubscribeToText((IObservable <string>) this._name, this._nameLabel);
            }
            if (Object.op_Inequality((Object)this._successLabel, (Object)null))
            {
                UnityUIComponentExtensions.SubscribeToInteractable((IObservable <bool>) this._isSuccess, (Selectable)this._button);
                UnityUIComponentExtensions.SubscribeToText <bool>((IObservable <M0>) this._isSuccess, this._successLabel, (Func <M0, string>)(success => success ? "OK!" : string.Empty));
                ObservableExtensions.Subscribe <bool>((IObservable <M0>) this._isSuccess, (System.Action <M0>)(success => ((Graphic)this._successLabel).set_color(Define.Get(!success ? Colors.White : Colors.Blue))));
            }
            EasingFunction easing;

            if (!Tween.MotionFunctionTable.TryGetValue(this._motionType, ref easing))
            {
                ;
            }
            if (!Tween.MotionFunctionTable.TryGetValue(this._alphaMotionType, ref easing))
            {
                return;
            }
            DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Create(easing, this._easingDuration, true), true), (System.Action <M0>)(x => this._canvasGroup.set_alpha(Mathf.Lerp(this._fromAlpha, this._toAlpha, ((TimeInterval <float>) ref x).get_Value())))), (ICollection <IDisposable>) this.disposables);
        }
示例#2
0
        protected virtual void Start()
        {
            if (Object.op_Inequality((Object)this._nameLabel, (Object)null))
            {
                UnityUIComponentExtensions.SubscribeToText((IObservable <string>) this._name, this._nameLabel);
            }
            if (Object.op_Inequality((Object)this._stackCountText, (Object)null))
            {
                UnityUIComponentExtensions.SubscribeToText <int>((IObservable <M0>) this._stackCount, this._stackCountText);
            }
            if (Object.op_Inequality((Object)this._rateText, (Object)null))
            {
                UnityUIComponentExtensions.SubscribeToText <int>((IObservable <M0>) this._rate, this._rateText, (Func <M0, string>)(x => x >= 0 ? x.ToString() : string.Empty));
            }
            if (Object.op_Inequality((Object)this._iconText, (Object)null))
            {
                ((Behaviour)this._iconText).set_enabled(false);
            }
            if (Object.op_Inequality((Object)this._rarelityText, (Object)null))
            {
                UnityUIComponentExtensions.SubscribeToText <Rarelity>((IObservable <M0>) this._rarelity, this._rarelityText, (Func <M0, string>)(x => x.GetType().IsEnumDefined((object)x) ? x.ToString() : string.Empty));
                ObservableExtensions.Subscribe <Sprite>((IObservable <M0>) this._rarelitySprite, (System.Action <M0>)(sprite => ((Behaviour)this._rarelityText).set_enabled(Object.op_Equality((Object)sprite, (Object)null))));
            }
            if (Object.op_Inequality((Object)this._rarelityImage, (Object)null))
            {
                ObservableExtensions.Subscribe <Sprite>((IObservable <M0>) this._rarelitySprite, (System.Action <M0>)(sprite =>
                {
                    ((Behaviour)this._rarelityImage).set_enabled(!Object.op_Equality((Object)sprite, (Object)null));
                    this._rarelityImage.set_sprite(sprite);
                }));
            }
            EasingFunction easing;

            if (!Tween.MotionFunctionTable.TryGetValue(this._motionType, ref easing))
            {
                ;
            }
            if (!Tween.MotionFunctionTable.TryGetValue(this._alphaMotionType, ref easing))
            {
                return;
            }
            DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Create(easing, this._easingDuration, true), true), (System.Action <M0>)(x => this._canvasGroup.set_alpha(Mathf.Lerp(this._fromAlpha, this._toAlpha, ((TimeInterval <float>) ref x).get_Value())))), (ICollection <IDisposable>) this.disposables);
        }
        public IObservable <TimeInterval <float>[]> Close()
        {
            Vector2 diff = Vector2.op_Subtraction(this._source, this._destination);
            IConnectableObservable <TimeInterval <float> > iconnectableObservable1 = (IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Create(Tween.MotionFunctionTable.get_Item(this._motionTypes.@out), 0.3f, true), true));
            IConnectableObservable <TimeInterval <float> > iconnectableObservable2 = (IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Create(Tween.MotionFunctionTable.get_Item(this._alphaFadingTypes.@out), 0.3f, true), true));

            iconnectableObservable1.Connect();
            iconnectableObservable2.Connect();
            ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable1, (System.Action <M0>)(x => this.SetPosition(diff, ((TimeInterval <float>) ref x).get_Value())));
            ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable2, (System.Action <M0>)(x => this._canvasGroup.set_alpha(1f - ((TimeInterval <float>) ref x).get_Value())));
            return((IObservable <TimeInterval <float>[]>)Observable.WhenAll <TimeInterval <float> >((IObservable <M0>[]) new IObservable <TimeInterval <float> >[2]
            {
                (IObservable <TimeInterval <float> >)iconnectableObservable1,
                (IObservable <TimeInterval <float> >)iconnectableObservable2
            }));
        }
示例#4
0
        protected virtual void Start()
        {
            if (Object.op_Inequality((Object)this._nameLabel, (Object)null))
            {
                UnityUIComponentExtensions.SubscribeToText((IObservable <string>) this._name, this._nameLabel);
            }
            if (Object.op_Inequality((Object)this._stackCountText, (Object)null))
            {
                int itemSlotMax = Singleton <Resources> .Instance.DefinePack.MapDefines.ItemSlotMax;
                UnityUIComponentExtensions.SubscribeToText <int>((IObservable <M0>) this._stackCount, this._stackCountText, (Func <M0, string>)(i =>
                {
                    if (i < 0)
                    {
                        return(string.Empty);
                    }
                    return(i <= itemSlotMax ? string.Format("{0}", (object)i) : string.Format("{0}+", (object)itemSlotMax));
                }));
            }
            EasingFunction easing;

            if (!Tween.MotionFunctionTable.TryGetValue(this._motionType, ref easing))
            {
                ;
            }
            if (!Tween.MotionFunctionTable.TryGetValue(this._alphaMotionType, ref easing))
            {
                return;
            }
            DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Create(easing, this._easingDuration, true), true), (System.Action <M0>)(x => this._canvasGroup.set_alpha(Mathf.Lerp(this._fromAlpha, this._toAlpha, ((TimeInterval <float>) ref x).get_Value())))), (ICollection <IDisposable>) this.disposables);
        }