Example #1
0
 private void Close()
 {
     if (ConfirmScene.CloseImmediately)
     {
         this._backgroundCanvasGroup.set_alpha(0.0f);
         this._panelCanvasGroup.set_blocksRaycasts(false);
         Object.Destroy((Object)((Component)this).get_gameObject());
         GC.Collect();
         Resources.UnloadUnusedAssets();
     }
     else
     {
         this._panelCanvasGroup.set_blocksRaycasts(false);
         ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.1f, true), true), (Action <M0>)(x =>
         {
             CanvasGroup backgroundCanvasGroup = this._backgroundCanvasGroup;
             float num1 = 1f - ((TimeInterval <float>) ref x).get_Value();
             this._panelCanvasGroup.set_alpha(num1);
             double num2 = (double)num1;
             backgroundCanvasGroup.set_alpha((float)num2);
         }), (Action <Exception>)(ex => Debug.LogException(ex)), (Action)(() =>
         {
             Object.Destroy((Object)((Component)this).get_gameObject());
             GC.Collect();
             Resources.UnloadUnusedAssets();
         }));
     }
 }
Example #2
0
        private void Close(Action onCompleted)
        {
            this._panelCanvasGroup.set_blocksRaycasts(false);
            Time.set_timeScale(this._timeScale);
            if (Singleton <Input> .IsInstance())
            {
                Singleton <Input> .Instance.ReserveState(this._validType);

                Singleton <Input> .Instance.SetupState();
            }
            ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.2f, true), true), (Action <M0>)(x =>
            {
                CanvasGroup backgroundCanvasGroup = this._backgroundCanvasGroup;
                float num1 = 1f - ((TimeInterval <float>) ref x).get_Value();
                this._panelCanvasGroup.set_alpha(num1);
                double num2 = (double)num1;
                backgroundCanvasGroup.set_alpha((float)num2);
            }), (Action <Exception>)(ex => Debug.LogException(ex)), onCompleted);
        }
Example #3
0
        void OnGUI()
        {
            if (GUILayout.Button("Linear"))
            {
                MoveStart(ObservableEasing.Linear(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.linear));
            }

            if (GUILayout.Button("EaseInSine"))
            {
                MoveStart(ObservableEasing.EaseInSine(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInSine));
            }

            if (GUILayout.Button("EaseOutSine"))
            {
                MoveStart(ObservableEasing.EaseOutSine(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeOutSine));
            }

            if (GUILayout.Button("EaseInOutSine"))
            {
                MoveStart(ObservableEasing.EaseInOutSine(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInOutSine));
            }

            if (GUILayout.Button("EaseInQuad"))
            {
                MoveStart(ObservableEasing.EaseInQuad(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInQuad));
            }

            if (GUILayout.Button("EaseOutQuad"))
            {
                MoveStart(ObservableEasing.EaseOutQuad(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeOutQuad));
            }

            if (GUILayout.Button("EaseInOutQuad"))
            {
                MoveStart(ObservableEasing.EaseInOutQuad(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInOutQuad));
            }

            if (GUILayout.Button("EaseInCubic"))
            {
                MoveStart(ObservableEasing.EaseInCubic(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInCubic));
            }

            if (GUILayout.Button("EaseOutCubic"))
            {
                MoveStart(ObservableEasing.EaseOutCubic(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeOutCubic));
            }

            if (GUILayout.Button("EaseInOutCubic"))
            {
                MoveStart(ObservableEasing.EaseInOutCubic(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInOutCubic));
            }

            if (GUILayout.Button("EaseInQuart"))
            {
                MoveStart(ObservableEasing.EaseInQuart(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInQuart));
            }

            if (GUILayout.Button("EaseOutQuart"))
            {
                MoveStart(ObservableEasing.EaseOutQuart(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeOutQuart));
            }

            if (GUILayout.Button("EaseInOutQuart"))
            {
                MoveStart(ObservableEasing.EaseInOutQuart(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInOutQuart));
            }

            if (GUILayout.Button("EaseInQuint"))
            {
                MoveStart(ObservableEasing.EaseInQuint(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInQuint));
            }

            if (GUILayout.Button("EaseOutQuint"))
            {
                MoveStart(ObservableEasing.EaseOutQuint(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeOutQuint));
            }

            if (GUILayout.Button("EaseInOutQuint"))
            {
                MoveStart(ObservableEasing.EaseInOutQuint(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInOutQuint));
            }

            if (GUILayout.Button("EaseInExpo"))
            {
                MoveStart(ObservableEasing.EaseInExpo(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInExpo));
            }

            if (GUILayout.Button("EaseOutExpo"))
            {
                MoveStart(ObservableEasing.EaseOutExpo(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeOutExpo));
            }

            if (GUILayout.Button("EaseInOutExpo"))
            {
                MoveStart(ObservableEasing.EaseInOutExpo(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInOutExpo));
            }

            if (GUILayout.Button("EaseInCirc"))
            {
                MoveStart(ObservableEasing.EaseInCirc(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInCirc));
            }

            if (GUILayout.Button("EaseOutCirc"))
            {
                MoveStart(ObservableEasing.EaseOutCirc(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeOutCirc));
            }

            if (GUILayout.Button("EaseInOutCirc"))
            {
                MoveStart(ObservableEasing.EaseInOutCirc(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInOutCirc));
            }

            if (GUILayout.Button("EaseInBack"))
            {
                MoveStart(ObservableEasing.EaseInBack(1.0f));
                //DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInBack));
                DrawGraphYellow(DoTweenObservable(Ease.InBack));
            }

            if (GUILayout.Button("EaseOutBack"))
            {
                MoveStart(ObservableEasing.EaseOutBack(1.0f));
                //DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeOutBack));
                DrawGraphYellow(DoTweenObservable(Ease.OutBack));
            }

            if (GUILayout.Button("EaseInOutBack"))
            {
                MoveStart(ObservableEasing.EaseInOutBack(1.0f));
                //DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInOutBack));
                DrawGraphYellow(DoTweenObservable(Ease.InOutBack));
            }

            if (GUILayout.Button("EaseInElastic"))
            {
                MoveStart(ObservableEasing.EaseInElastic(1.0f));
                //DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInElastic));
                DrawGraphYellow(DoTweenObservable(Ease.InElastic));
            }

            if (GUILayout.Button("EaseOutElastic"))
            {
                MoveStart(ObservableEasing.EaseOutElastic(1.0f));
                //DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeOutElastic));
                DrawGraphYellow(DoTweenObservable(Ease.OutElastic));
            }

            if (GUILayout.Button("EaseInOutElastic"))
            {
                MoveStart(ObservableEasing.EaseInOutElastic(1.0f));
                //DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInOutElastic));
                DrawGraphYellow(DoTweenObservable(Ease.InOutElastic));
            }

            if (GUILayout.Button("EaseInBounce"))
            {
                MoveStart(ObservableEasing.EaseInBounce(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInBounce));
            }

            if (GUILayout.Button("EaseOutBounce"))
            {
                MoveStart(ObservableEasing.EaseOutBounce(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeOutBounce));
            }

            if (GUILayout.Button("EaseInOutBounce"))
            {
                MoveStart(ObservableEasing.EaseInOutBounce(1.0f));
                DrawGraphBlue(LeanTweenObservable(LeanTweenType.easeInOutBounce));
            }

            if (GUILayout.Button("ShowAvgResult"))
            {
                UnityEngine.Debug.Log("Avg:" + stopList.Where(x => x > 3.0f).Average());
            }

            if (GUILayout.Button("ReMotion"))
            {
                InitPerf();
                Observable.NextFrame().Subscribe(____ =>
                {
                    var sw = System.Diagnostics.Stopwatch.StartNew();
                    foreach (var xxx in testObjects)
                    {
                        xxx.transform.TweenPosition(new Vector3(10, 10, 10), 3.0f, EasingFunctions.Linear);
                    }
                    sw.Stop();
                    UnityEngine.Debug.Log("ReMotion Initial:" + sw.Elapsed.TotalMilliseconds + "ms");

                    Observable.TimerFrame(3).Subscribe(__ => startStopwatch = true);
                });
            }

            if (GUILayout.Button("DOTween"))
            {
                InitPerf();
                Observable.NextFrame().Subscribe(____ =>
                {
                    var sw = System.Diagnostics.Stopwatch.StartNew();
                    foreach (var xxx in testObjects)
                    {
                        xxx.transform.DOMove(new Vector3(10, 10, 10), 3f).SetEase(Ease.Linear);
                    }
                    sw.Stop();
                    UnityEngine.Debug.Log("DOTween Initial:" + sw.Elapsed.TotalMilliseconds + "ms");

                    Observable.TimerFrame(3).Subscribe(__ => startStopwatch = true);
                });
            }

            if (GUILayout.Button("LeanTween"))
            {
                InitPerf();

                Observable.NextFrame().Subscribe(____ =>
                {
                    var sw = System.Diagnostics.Stopwatch.StartNew();
                    foreach (var xxx in testObjects)
                    {
                        LeanTween.move(xxx, new Vector3(10, 10, 10), 3.0f).setEase(LeanTweenType.linear);
                    }
                    sw.Stop();
                    UnityEngine.Debug.Log("LeanTween Initial:" + sw.Elapsed.TotalMilliseconds + "ms");

                    Observable.TimerFrame(3).Subscribe(__ => startStopwatch = true);
                });
            }

            if (GUILayout.Button("iTween"))
            {
                InitPerf();

                Observable.NextFrame().Subscribe(____ =>
                {
                    var sw = System.Diagnostics.Stopwatch.StartNew();
                    foreach (var xxx in testObjects)
                    {
                        iTween.MoveTo(xxx, new Vector3(10f, 10f, 10f), 3.0f);
                    }
                    sw.Stop();
                    UnityEngine.Debug.Log("iTween Initial:" + sw.Elapsed.TotalMilliseconds + "ms");

                    Observable.TimerFrame(3).Subscribe(__ => startStopwatch = true);
                });
            }

            if (GUILayout.Button("Uween"))
            {
                InitPerf();

                Observable.NextFrame().Subscribe(____ =>
                {
                    var sw = System.Diagnostics.Stopwatch.StartNew();
                    foreach (var xxx in testObjects)
                    {
                        Uween.TweenXYZ.Add(xxx, 3.0f, new Vector3(10, 10, 10));
                    }
                    sw.Stop();
                    UnityEngine.Debug.Log("Uween Initial:" + sw.Elapsed.TotalMilliseconds + "ms");

                    Observable.TimerFrame(3).Subscribe(__ => startStopwatch = true);
                });
            }
        }
Example #4
0
        public virtual void OnStart()
        {
            AgentActor agent = this.Agent;

            if (agent.EquipedItem != null)
            {
                return;
            }
            ((Task)this).OnStart();
            agent.StateType = AIProject.Definitions.State.Type.Greet;
            agent.StopNavMeshAgent();
            agent.ChangeStaticNavMeshAgentAvoidance();
            this.StartActionAnimation();
            ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEnd, 1), (System.Action <M0>)(_ =>
            {
                agent.Animation.StopAllAnimCoroutine();
                agent.Animation.PlayOutAnimation(this._outEnableFade, this._outFadeTime, this._layer);
            }));
            Quaternion rotation = this.Agent.Rotation;
            Vector3    vector3  = Vector3.op_Subtraction(this.Agent.TargetInSightActor.Position, this.Agent.Position);

            vector3.y = (__Null)0.0;
            Quaternion forwardRotation = Quaternion.LookRotation(Vector3.Normalize(vector3));

            ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.2f, false), false), (System.Action <M0>)(x => this.Agent.Rotation = Quaternion.Slerp(rotation, forwardRotation, ((TimeInterval <float>) ref x).get_Value())));
            agent.AgentData.Greeted = true;
        }
Example #5
0
        protected override void OnBeforeStart()
        {
            base.OnBeforeStart();
            ObservableExtensions.Subscribe <bool>((IObservable <M0>) this.OnActiveChangedAsObservable(), (Action <M0>)(x => this.SetActiveControl(x)));
            this._lerpStream = (IObservable <TimeInterval <float> >)Observable.TakeUntilDestroy <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(this._alphaAccelerationTime, true), true), (Component)this);
            if (this._closeButton != null)
            {
                // ISSUE: method pointer
                ((UnityEvent)this._closeButton.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(\u003COnBeforeStart\u003Em__1)));
            }
            ActionIDDownCommand actionIdDownCommand = new ActionIDDownCommand()
            {
                ActionID = ActionID.Cancel
            };

            // ISSUE: method pointer
            actionIdDownCommand.TriggerEvent.AddListener(new UnityAction((object)this, __methodptr(\u003COnBeforeStart\u003Em__2)));
            this._actionCommands.Add(actionIdDownCommand);
            KeyCodeDownCommand keyCodeDownCommand = new KeyCodeDownCommand()
            {
                KeyCode = (KeyCode)324
            };

            // ISSUE: method pointer
            keyCodeDownCommand.TriggerEvent.AddListener(new UnityAction((object)this, __methodptr(\u003COnBeforeStart\u003Em__3)));
            this._keyCommands.Add(keyCodeDownCommand);
            if (this._escapeButton != null)
            {
                // ISSUE: method pointer
                ((UnityEvent)this._escapeButton.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(\u003COnBeforeStart\u003Em__4)));
            }
            ObservableExtensions.Subscribe <bool>((IObservable <M0>)UnityUIComponentExtensions.OnValueChangedAsObservable(this._chaseToggle), (Action <M0>)(x => this.ChangeChaseActor(x)));
            if (this._nameChangeButton != null)
            {
                // ISSUE: method pointer
                ((UnityEvent)this._nameChangeButton.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(\u003COnBeforeStart\u003Em__6)));
            }
            this._nameChangeUI.SubmitAction += (Action <string>)(str => this.NameChanged(str));
            ((MonoBehaviour)this).StartCoroutine(this.UISettingCoroutine());
        }
        protected override void OnBeforeStart()
        {
            ObservableExtensions.Subscribe <bool>((IObservable <M0>) this.OnActiveChangedAsObservable(), (Action <M0>)(x => this.SetActiveControl(x)));
            this._lerpStream = (IObservable <TimeInterval <float> >)Observable.TakeUntilDestroy <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(this._alphaAccelerationTime, true), true), (Component)this);
            // ISSUE: method pointer
            ((UnityEvent)this._submitButton.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(\u003COnBeforeStart\u003Em__1)));
            // ISSUE: method pointer
            ((UnityEvent)this._cancelButton.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(\u003COnBeforeStart\u003Em__2)));
            ActionIDDownCommand actionIdDownCommand = new ActionIDDownCommand()
            {
                ActionID = ActionID.Cancel
            };

            // ISSUE: method pointer
            actionIdDownCommand.TriggerEvent.AddListener(new UnityAction((object)this, __methodptr(\u003COnBeforeStart\u003Em__3)));
            this._actionCommands.Add(actionIdDownCommand);
            KeyCodeDownCommand keyCodeDownCommand = new KeyCodeDownCommand()
            {
                KeyCode = (KeyCode)324
            };

            // ISSUE: method pointer
            keyCodeDownCommand.TriggerEvent.AddListener(new UnityAction((object)this, __methodptr(\u003COnBeforeStart\u003Em__4)));
            this._keyCommands.Add(keyCodeDownCommand);
        }
Example #7
0
        protected override void OnBeforeStart()
        {
            this._elementPool = new GameLog.GameLogElementPool()
            {
                Source = this._node
            };
            this._lerpStream = (IObservable <TimeInterval <float> >)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.1f, true), true);
            ObservableExtensions.Subscribe <bool>((IObservable <M0>) this.OnActiveChangedAsObservable(), (Action <M0>)(x => this.SetActiveControl(x)));
            if (Object.op_Inequality((Object)this._closeButton, (Object)null))
            {
                // ISSUE: method pointer
                ((UnityEvent)this._closeButton.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(\u003COnBeforeStart\u003Em__1)));
            }
            KeyCodeDownCommand keyCodeDownCommand = new KeyCodeDownCommand()
            {
                KeyCode = (KeyCode)324
            };

            // ISSUE: method pointer
            keyCodeDownCommand.TriggerEvent.AddListener(new UnityAction((object)this, __methodptr(\u003COnBeforeStart\u003Em__2)));
            this._keyCommands.Add(keyCodeDownCommand);
        }
        private IConnectableObservable <TimeInterval <float> > GetObservableEasing(
            ResultMessageElement.FadeType _fadeType,
            float _duration)
        {
            switch (_fadeType)
            {
            case ResultMessageElement.FadeType.Linear:
                return((IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>(Observable.TakeUntilDisable <float>((IObservable <M0>)ObservableEasing.Linear(_duration, true), ((Component)this).get_gameObject()), false)));

            case ResultMessageElement.FadeType.EaseOutQuint:
                return((IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>(Observable.TakeUntilDisable <float>((IObservable <M0>)ObservableEasing.EaseOutQuint(_duration, true), ((Component)this).get_gameObject()), false)));

            case ResultMessageElement.FadeType.EaseInQuint:
                return((IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>(Observable.TakeUntilDisable <float>((IObservable <M0>)ObservableEasing.EaseInQuint(_duration, true), ((Component)this).get_gameObject()), false)));

            default:
                return((IConnectableObservable <TimeInterval <float> >)null);
            }
        }
Example #9
0
        public void SetStand(IAnimalActionPointUser animal, Transform t)
        {
            if (animal == null || Object.op_Equality((Object)t, (Object)null))
            {
                return;
            }
            IConnectableObservable <TimeInterval <float> > iconnectableObservable = (IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.2f, false), false));

            iconnectableObservable.Connect();
            Vector3    position = animal.Position;
            Quaternion rotation = animal.Rotation;

            switch (this._directionType)
            {
            case AnimalActionPoint.DirectionKind.Lock:
                ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x => animal.Rotation = Quaternion.Slerp(rotation, t.get_rotation(), ((TimeInterval <float>) ref x).get_Value())));
                break;

            case AnimalActionPoint.DirectionKind.Look:
                Quaternion lookRotation = Quaternion.LookRotation(Vector3.Normalize(Vector3.op_Subtraction(t.get_position(), animal.Position)));
                ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x => animal.Rotation = Quaternion.Slerp(rotation, lookRotation, ((TimeInterval <float>) ref x).get_Value())));
                break;
            }
            if (!this._enabledPositionValue)
            {
                return;
            }
            ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x => animal.Position = Vector3.Lerp(position, t.get_position(), ((TimeInterval <float>) ref x).get_Value())));
        }
 private void Open()
 {
     this.EnabledInput = false;
     this._canvasGroup.set_blocksRaycasts(false);
     ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.2f, true), true), (Action <M0>)(x => this._canvasGroup.set_alpha(((TimeInterval <float>) ref x).get_Value())), (Action <Exception>)(ex => Debug.LogException(ex)), (Action)(() =>
     {
         this._canvasGroup.set_blocksRaycasts(true);
         this.EnabledInput = true;
     }));
 }
        private void Close(Action onCompleted)
        {
            this.EnabledInput = false;
            this._canvasGroup.set_blocksRaycasts(false);
            if (Singleton <Input> .IsInstance())
            {
                Singleton <Input> .Instance.ReserveState(this._validType);

                Singleton <Input> .Instance.SetupState();
            }
            ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.2f, true), true), (Action <M0>)(x => this._canvasGroup.set_alpha(1f - ((TimeInterval <float>) ref x).get_Value())), (Action <Exception>)(ex => Debug.LogException(ex)), (Action)(() =>
            {
                Action action = onCompleted;
                if (action != null)
                {
                    action();
                }
                Action closedEvent = MapShortcutUI.ClosedEvent;
                if (closedEvent == null)
                {
                    return;
                }
                closedEvent();
            }));
        }
Example #12
0
 private void Close()
 {
     ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(1f, true), true), (Action <M0>)(x => this._canvasGroup.set_alpha(1f - ((TimeInterval <float>) ref x).get_Value())));
 }
    public void ChangeAccelerationLinear(float _acceleration, float _second)
    {
        if (this.changeAccelerationLinearDisposable != null)
        {
            this.changeAccelerationLinearDisposable.Dispose();
        }
        float _prevAcceleration = this.Acceleration;
        float _startTime        = Time.get_realtimeSinceStartup();

        this.changeAccelerationLinearDisposable = ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>(Observable.TakeUntilDestroy <float>((IObservable <M0>)ObservableEasing.Linear(_second, false), ((Component)this).get_gameObject()), false), (Action <M0>)(x =>
        {
            this.Acceleration = Mathf.Lerp(_prevAcceleration, _acceleration, ((TimeInterval <float>) ref x).get_Value());
            Debug.Log((object)string.Format("Linear x[{0}] PrevAcceleration[{1}] SetAcceleration[{2}] Acceleration[{3}]", (object)((TimeInterval <float>) ref x).get_Value(), (object)_prevAcceleration, (object)_acceleration, (object)this.Acceleration));
        }), (Action)(() => Debug.Log((object)string.Format("使用時間[{0}]", (object)(float)((double)Time.get_realtimeSinceStartup() - (double)_startTime)))));
    }
        protected IObservable <TimeInterval <float> > FadeOutActionAsObservable(
            PlayerActor actor,
            int sex,
            Transform t,
            ActionPoint actionPoint)
        {
            if (Object.op_Inequality((Object)t, (Object)null))
            {
                Vector3         position = actor.Position;
                Quaternion      rotation = actor.Rotation;
                ActionPointInfo outInfo;
                actionPoint.TryGetPlayerActionPointInfo(actor.EventKey, out outInfo);
                Dictionary <int, Dictionary <int, PlayState> > dictionary1;
                Dictionary <int, PlayState> dictionary2;
                PlayState playState;
                if (Singleton <Resources> .Instance.Animation.PlayerActionAnimTable.TryGetValue(sex, out dictionary1) && dictionary1.TryGetValue(outInfo.eventID, out dictionary2) && dictionary2.TryGetValue(outInfo.poseID, out playState))
                {
                    IConnectableObservable <TimeInterval <float> > iconnectableObservable = (IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(playState.MainStateInfo.OutStateInfo.FadeSecond, false), false));
                    iconnectableObservable.Connect();
                    switch (playState.DirectionType)
                    {
                    case 0:
                        if (playState.MainStateInfo.OutStateInfo.EnableFade)
                        {
                            ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x =>
                            {
                                actor.Position = Vector3.Lerp(position, t.get_position(), ((TimeInterval <float>) ref x).get_Value());
                                actor.Rotation = Quaternion.Slerp(rotation, t.get_rotation(), ((TimeInterval <float>) ref x).get_Value());
                            }));
                            break;
                        }
                        actor.Position = t.get_position();
                        actor.Rotation = t.get_rotation();
                        break;

                    case 1:
                        Quaternion lookRotation = Quaternion.LookRotation(Vector3.op_Subtraction(actionPoint.Position, position));
                        if (playState.MainStateInfo.OutStateInfo.EnableFade)
                        {
                            ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x => actor.Rotation = Quaternion.Slerp(rotation, lookRotation, ((TimeInterval <float>) ref x).get_Value())));
                            break;
                        }
                        actor.Rotation = lookRotation;
                        break;
                    }
                    return((IObservable <TimeInterval <float> >)iconnectableObservable);
                }
            }
            return((IObservable <TimeInterval <float> >)Observable.Empty <TimeInterval <float> >());
        }
        public void SetStand(
            MerchantActor merchant,
            Transform t,
            bool enableFade,
            float fadeTime,
            int dirc,
            System.Action onComplete = null)
        {
            if (Object.op_Equality((Object)merchant, (Object)null) || Object.op_Equality((Object)t, (Object)null))
            {
                System.Action action = onComplete;
                if (action == null)
                {
                    return;
                }
                action();
            }
            else
            {
                IConnectableObservable <TimeInterval <float> > iconnectableObservable = (IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(fadeTime, false), false));
                IDisposable disposable1 = iconnectableObservable.Connect();
                merchant.DisposeSequenceAction();
                Vector3    position = merchant.Position;
                Quaternion rotation = merchant.Rotation;
                switch (dirc)
                {
                case 0:
                    if (enableFade)
                    {
                        merchant.AddSequenceActionDisposable(disposable1);
                        IDisposable disposable2 = (IDisposable)DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (System.Action <M0>)(x =>
                        {
                            merchant.Position = Vector3.Lerp(position, t.get_position(), ((TimeInterval <float>) ref x).get_Value());
                            merchant.Rotation = Quaternion.Lerp(rotation, t.get_rotation(), ((TimeInterval <float>) ref x).get_Value());
                        })), (Component)merchant);
                        merchant.AddSequenceActionDisposable(disposable2);
                        IDisposable disposable3 = (IDisposable)DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <TimeInterval <float>[]>((IObservable <M0>)Observable.WhenAll <TimeInterval <float> >((IObservable <M0>[]) new IObservable <TimeInterval <float> >[1]
                        {
                            (IObservable <TimeInterval <float> >)iconnectableObservable
                        }), (System.Action <M0>)(_ =>
                        {
                            System.Action action = onComplete;
                            if (action != null)
                            {
                                action();
                            }
                            merchant.ClearSequenceAction();
                        })), (Component)merchant);
                        merchant.AddSequenceActionDisposable(disposable3);
                        merchant.AddSequenceActionOnComplete(onComplete);
                        break;
                    }
                    merchant.Position = t.get_position();
                    merchant.Rotation = t.get_rotation();
                    System.Action action1 = onComplete;
                    if (action1 == null)
                    {
                        break;
                    }
                    action1();
                    break;

                case 1:
                    Vector3 vector3 = Vector3.op_Subtraction(((Component)this).get_transform().get_position(), merchant.Position);
                    vector3.y = (__Null)0.0;
                    Quaternion lookRotation = Quaternion.LookRotation(((Vector3) ref vector3).get_normalized(), Vector3.get_up());
                    if (enableFade)
                    {
                        IDisposable disposable2 = ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (System.Action <M0>)(x => merchant.Rotation = Quaternion.Lerp(rotation, lookRotation, ((TimeInterval <float>) ref x).get_Value())));
                        merchant.AddSequenceActionDisposable(disposable2);
                        IDisposable disposable3 = (IDisposable)DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <TimeInterval <float>[]>((IObservable <M0>)Observable.WhenAll <TimeInterval <float> >((IObservable <M0>[]) new IObservable <TimeInterval <float> >[1]
                        {
                            (IObservable <TimeInterval <float> >)iconnectableObservable
                        }), (System.Action <M0>)(_ =>
                        {
                            System.Action action = onComplete;
                            if (action == null)
                            {
                                return;
                            }
                            action();
                        })), (Component)merchant);
                        merchant.AddSequenceActionDisposable(disposable3);
                        merchant.AddSequenceActionOnComplete(onComplete);
                        break;
                    }
                    merchant.Rotation = lookRotation;
                    System.Action action3 = onComplete;
                    if (action3 == null)
                    {
                        break;
                    }
                    action3();
                    break;

                default:
                    System.Action action4 = onComplete;
                    if (action4 == null)
                    {
                        break;
                    }
                    action4();
                    break;
                }
            }
        }
Example #16
0
        public void SetStand(IAnimalActionPointUser animal, Transform t, Action completeEvent)
        {
            if (animal == null || Object.op_Equality((Object)t, (Object)null))
            {
                if (completeEvent == null)
                {
                    return;
                }
                completeEvent();
            }
            else
            {
                IConnectableObservable <TimeInterval <float> > iconnectableObservable = (IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.2f, false), false));
                iconnectableObservable.Connect();
                Vector3    position = animal.Position;
                Quaternion rotation = animal.Rotation;
                switch (this._directionType)
                {
                case AnimalActionPoint.DirectionKind.Lock:
                    ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x => animal.Rotation = Quaternion.Slerp(rotation, t.get_rotation(), ((TimeInterval <float>) ref x).get_Value())));
                    break;

                case AnimalActionPoint.DirectionKind.Look:
                    Quaternion lookRotation = Quaternion.LookRotation(Vector3.Normalize(Vector3.op_Subtraction(t.get_position(), animal.Position)));
                    ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x => animal.Rotation = Quaternion.Slerp(rotation, lookRotation, ((TimeInterval <float>) ref x).get_Value())));
                    break;
                }
                if (this._enabledPositionValue)
                {
                    ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x => animal.Position = Vector3.Lerp(position, t.get_position(), ((TimeInterval <float>) ref x).get_Value())));
                }
                Action comEvent = completeEvent;
                ObservableExtensions.Subscribe <TimeInterval <float>[]>(Observable.TakeUntilDestroy <TimeInterval <float>[]>((IObservable <M0>)Observable.WhenAll <TimeInterval <float> >((IObservable <M0>[]) new IObservable <TimeInterval <float> >[1]
                {
                    (IObservable <TimeInterval <float> >)iconnectableObservable
                }), ((Component)this).get_gameObject()), (Action <M0>)(_ =>
                {
                    Action action = comEvent;
                    if (action == null)
                    {
                        return;
                    }
                    action();
                }));
            }
        }
        public void SetStand(
            Transform root,
            Transform t,
            bool enableFade,
            float fadeTime,
            int dirc,
            System.Action onComplete = null)
        {
            if (Object.op_Equality((Object)root, (Object)null) || Object.op_Equality((Object)t, (Object)null))
            {
                System.Action action = onComplete;
                if (action == null)
                {
                    return;
                }
                action();
            }
            else
            {
                IConnectableObservable <TimeInterval <float> > iconnectableObservable = (IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(fadeTime, false), false));
                iconnectableObservable.Connect();
                Vector3    position = root.get_position();
                Quaternion rotation = root.get_rotation();
                switch (dirc)
                {
                case 0:
                    if (enableFade)
                    {
                        ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (System.Action <M0>)(x =>
                        {
                            root.set_position(Vector3.Lerp(position, t.get_position(), ((TimeInterval <float>) ref x).get_Value()));
                            root.set_rotation(Quaternion.Lerp(rotation, t.get_rotation(), ((TimeInterval <float>) ref x).get_Value()));
                        }));
                        ObservableExtensions.Subscribe <TimeInterval <float>[]>((IObservable <M0>)Observable.WhenAll <TimeInterval <float> >((IObservable <M0>[]) new IObservable <TimeInterval <float> >[1]
                        {
                            (IObservable <TimeInterval <float> >)iconnectableObservable
                        }), (System.Action <M0>)(_ =>
                        {
                            System.Action action = onComplete;
                            if (action == null)
                            {
                                return;
                            }
                            action();
                        }));
                        break;
                    }
                    root.set_position(t.get_position());
                    root.set_rotation(t.get_rotation());
                    System.Action action1 = onComplete;
                    if (action1 == null)
                    {
                        break;
                    }
                    action1();
                    break;

                case 1:
                    Vector3 vector3 = Vector3.op_Subtraction(((Component)this).get_transform().get_position(), root.get_position());
                    vector3.y = (__Null)0.0;
                    Quaternion lookRotation = Quaternion.LookRotation(((Vector3) ref vector3).get_normalized(), Vector3.get_up());
                    if (enableFade)
                    {
                        ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (System.Action <M0>)(x => root.set_rotation(Quaternion.Lerp(rotation, lookRotation, ((TimeInterval <float>) ref x).get_Value()))));
                        ObservableExtensions.Subscribe <TimeInterval <float>[]>((IObservable <M0>)Observable.WhenAll <TimeInterval <float> >((IObservable <M0>[]) new IObservable <TimeInterval <float> >[1]
                        {
                            (IObservable <TimeInterval <float> >)iconnectableObservable
                        }), (System.Action <M0>)(_ =>
                        {
                            System.Action action = onComplete;
                            if (action == null)
                            {
                                return;
                            }
                            action();
                        }));
                        break;
                    }
                    root.set_rotation(lookRotation);
                    System.Action action3 = onComplete;
                    if (action3 == null)
                    {
                        break;
                    }
                    action3();
                    break;

                default:
                    System.Action action4 = onComplete;
                    if (action4 == null)
                    {
                        break;
                    }
                    action4();
                    break;
                }
            }
        }
Example #18
0
        private void Initialize(PlayerActor player)
        {
            this.hasAnimal.SetState(AnimalState.WithPlayer, (Action)null);
            player.CameraControl.CrossFade.FadeStart(-1f);
            Quaternion quaternion  = Quaternion.LookRotation(Vector3.op_Subtraction(this.hasAnimal.Position, player.Position), Vector3.get_up());
            Vector3    eulerAngles = ((Quaternion) ref quaternion).get_eulerAngles();

            eulerAngles.x   = (__Null)(double)(eulerAngles.z = (__Null)0.0f);
            player.Rotation = Quaternion.Euler(eulerAngles);
            this.hasAnimal.SetWithActorGetPoint((Actor)player);
            this.hasAnimal.PlayInAnim(AnimationCategoryID.Idle, 0, (Action)null);
            int _poseID = !this.getAnimalFlag ? 1 : 0;

            this.SetPlayerAnimationState(player, _poseID);
            this.onEndGetAnimal = new Subject <Unit>();
            DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>(Observable.TakeUntilDestroy <Unit>((IObservable <M0>) this.onEndGetAnimal, (Component)player), 1), (Action <M0>)(_ =>
            {
                this.hasAnimal.Destroy();
                this.ToEnd(player);
            })), (ICollection <IDisposable>) this.disposable);
            this.onEndInAnimation = new Subject <Unit>();
            DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>(Observable.TakeUntilDestroy <Unit>((IObservable <M0>) this.onEndInAnimation, (Component)player), 1), (Action <M0>)(_ =>
            {
                if (this.getAnimalFlag)
                {
                    this.hasAnimal.PlayInAnim(AnimationCategoryID.Locomotion, 0, (Action)null);
                    this.hasAnimal.SetFloat(Singleton <Resources> .Instance.AnimalDefinePack.AnimatorInfo.LocomotionParamName, 0.5f);
                    this.isWait      = (Func <PlayerActor, bool>)(actor => !this.isNextEnabled);
                    this.onEndAction = this.onEndGetAnimal;
                    IConnectableObservable <TimeInterval <float> > iconnectableObservable = (IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(1f, true), false));
                    iconnectableObservable.Connect();
                    Vector3 _start = this.hasAnimal.Position;
                    Vector3 _end   = Vector3.op_Addition(_start, Vector3.op_Multiply(this.hasAnimal.Forward, 1f));
                    DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <TimeInterval <float> >(Observable.TakeUntilDestroy <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Component)player), (Action <M0>)(x => this.hasAnimal.Position = Vector3.Lerp(_start, _end, ((TimeInterval <float>) ref x).get_Value()))), (ICollection <IDisposable>) this.disposable);
                    DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <TimeInterval <float>[]>(Observable.TakeUntilDestroy <TimeInterval <float>[]>((IObservable <M0>)Observable.WhenAll <TimeInterval <float> >((IObservable <M0>[]) new IObservable <TimeInterval <float> >[1]
                    {
                        (IObservable <TimeInterval <float> >)iconnectableObservable
                    }), (Component)player), (Action <M0>)(__ => this.isNextEnabled = true)), (ICollection <IDisposable>) this.disposable);
                    if (!Singleton <Resources> .IsInstance())
                    {
                        return;
                    }
                    SoundPack soundPack = Singleton <Resources> .Instance.SoundPack;
                    AnimalDefinePack.SoundIDInfo soundId = Singleton <Resources> .Instance.AnimalDefinePack.SoundID;
                    AudioSource audioSource = (AudioSource)null;
                    switch (this.hasAnimal.AnimalType)
                    {
                    case AnimalTypes.Cat:
                        audioSource = soundPack.Play(soundId.GetCat, Sound.Type.GameSE3D, 0.0f);
                        break;

                    case AnimalTypes.Chicken:
                        audioSource = soundPack.Play(soundId.GetChicken, Sound.Type.GameSE3D, 0.0f);
                        break;
                    }
                    if (!Object.op_Inequality((Object)audioSource, (Object)null))
                    {
                        return;
                    }
                    audioSource.Stop();
                    ((Component)audioSource).get_transform().SetPositionAndRotation(this.hasAnimal.Position, this.hasAnimal.Rotation);
                    audioSource.Play();
                }
                else
                {
                    if (this.hasAnimal is WildGround)
                    {
                        (this.hasAnimal as WildGround).StartAvoid(player.Position, (Action)null);
                    }
                    else
                    {
                        this.hasAnimal.BadMood = true;
                        this.hasAnimal.PlayOutAnim((Action)(() => this.hasAnimal.SetState(AnimalState.Locomotion, (Action)null)));
                    }
                    this.isWait = (Func <PlayerActor, bool>)(actor => true);
                    this.ToEnd(player);
                }
            })), (ICollection <IDisposable>) this.disposable);
            this.onStart = new Subject <Unit>();
            DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>(Observable.TakeUntilDestroy <Unit>((IObservable <M0>) this.onStart, (Component)player), 1), (Action <M0>)(_ =>
            {
                player.Animation.PlayInAnimation(this.playerPlayState.MainStateInfo.InStateInfo.EnableFade, this.playerPlayState.MainStateInfo.InStateInfo.FadeSecond, this.playerPlayState.MainStateInfo.FadeOutTime, this.playerPlayState.Layer);
                this.isWait      = (Func <PlayerActor, bool>)(actor => actor.Animation.PlayingInAnimation);
                this.onEndAction = this.onEndInAnimation;
            })), (ICollection <IDisposable>) this.disposable);
            this.onEndAction = this.onStart;
        }
Example #19
0
        public void EndADV(Action onCompleted = null)
        {
            this._canvasGroup.set_blocksRaycasts(false);
            if (this._subscriber != null)
            {
                this._subscriber.Dispose();
            }
            IObservable <TimeInterval <float> > observable = (IObservable <TimeInterval <float> >)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.3f, true), true);
            float startAlpha = this._canvasGroup.get_alpha();

            if (onCompleted != null)
            {
                this._subscriber = ObservableExtensions.Subscribe <TimeInterval <float> >(Observable.DoOnCompleted <TimeInterval <float> >((IObservable <M0>)observable, (Action)(() =>
                {
                    this.Active = false;
                    this._subscriber = (IDisposable)null;
                })), (Action <M0>)(x => this._canvasGroup.set_alpha(Mathf.Lerp(startAlpha, 0.0f, ((TimeInterval <float>) ref x).get_Value()))), (Action <Exception>)(ex => Debug.LogException(ex)), onCompleted);
            }
            else
            {
                this._subscriber = ObservableExtensions.Subscribe <TimeInterval <float> >(Observable.DoOnCompleted <TimeInterval <float> >((IObservable <M0>)observable, (Action)(() =>
                {
                    this.Active = false;
                    this._subscriber = (IDisposable)null;
                })), (Action <M0>)(x => this._canvasGroup.set_alpha(Mathf.Lerp(startAlpha, 0.0f, ((TimeInterval <float>) ref x).get_Value()))), (Action <Exception>)(ex => Debug.LogException(ex)));
            }
        }
Example #20
0
        private void FadeOutRoot(Tuple <int, CanvasGroup, IDisposable> root)
        {
            if (root == null)
            {
                return;
            }
            root.Item3?.Dispose();
            float startAlpha = root.Item2.get_alpha();

            root.Item3 = ObservableExtensions.Subscribe <TimeInterval <float> >(Observable.TakeUntilDestroy <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(this._groupFadeTime, true), true), (Component)root.Item2), (System.Action <M0>)(x => root.Item2.set_alpha(Mathf.Lerp(startAlpha, 0.0f, ((TimeInterval <float>) ref x).get_Value()))));
        }
Example #21
0
 protected override void EnterDepop()
 {
     this.AutoChangeAnimation = false;
     if (Object.op_Equality((Object)this.material, (Object)null))
     {
         this.SetState(AnimalState.Destroyed, (System.Action)null);
     }
     else
     {
         float _startAlpha = this.material.GetFloat(this.materialAlphaParamID);
         float _endAlpha   = 0.0f;
         ObservableExtensions.Subscribe <float>(Observable.TakeUntilDestroy <float>((IObservable <M0>)ObservableEasing.Linear(this.fadeOutTimeSecond, false), ((Component)this).get_gameObject()), (System.Action <M0>)(x => this.material.SetFloat(this.materialAlphaParamID, Mathf.Lerp(_startAlpha, _endAlpha, x))), (System.Action)(() =>
         {
             if (this.CurrentState != AnimalState.Depop)
             {
                 return;
             }
             this.SetState(AnimalState.Destroyed, (System.Action)null);
         }));
     }
 }
 private void Close(Action onCompleted)
 {
     this.canvasGroup.set_blocksRaycasts(false);
     ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.2f, true), true), (Action <M0>)(x => this.canvasGroup.set_alpha(1f - ((TimeInterval <float>) ref x).get_Value())), (Action <Exception>)(ex => Debug.LogException(ex)), onCompleted);
 }
        public void ChangeBackground(int id)
        {
            foreach (IDisposable disposable in this._backgroundDisposables ?? (this._backgroundDisposables = new IDisposable[this._backgrounds.Count]))
            {
                disposable?.Dispose();
            }
            IObservable <TimeInterval <float> > observable = (IObservable <TimeInterval <float> >)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.3f, true), true);
            int num = 0;

            using (Dictionary <int, CanvasGroup> .Enumerator enumerator = this._backgrounds.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <int, CanvasGroup> kvp = enumerator.Current;
                    float startAlpha = kvp.Value.get_alpha();
                    int   destAlpha  = kvp.Key != id ? 0 : 1;
                    this._backgroundDisposables[num++] = ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)observable, (Action <M0>)(x => kvp.Value.set_alpha(Mathf.Lerp(startAlpha, (float)destAlpha, ((TimeInterval <float>) ref x).get_Value()))));
                }
            }
        }
        public void SetActiveTimer(bool active)
        {
            if (Object.op_Equality((Object)this._timerText, (Object)null) || Object.op_Equality((Object)this._timerCanvasGroup, (Object)null) || this.ActiveTimer == active)
            {
                return;
            }
            this.ActiveTimer = active;
            if (this._timerDisposable != null)
            {
                this._timerDisposable.Dispose();
            }
            float startAlpha = this._timerCanvasGroup.get_alpha();
            int   destAlpha  = !active ? 0 : 1;

            ObservableExtensions.Subscribe <TimeInterval <float> >(Observable.DoOnError <TimeInterval <float> >(Observable.Do <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.3f, true), true), (Action <M0>)(x => this._timerCanvasGroup.set_alpha(Mathf.Lerp(startAlpha, (float)destAlpha, ((TimeInterval <float>) ref x).get_Value())))), (Action <Exception>)(ex => Debug.LogException(ex))));
        }
Example #25
0
 private void Open()
 {
     this._panelCanvasGroup.set_blocksRaycasts(false);
     ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.2f, true), true), (Action <M0>)(x =>
     {
         CanvasGroup backgroundCanvasGroup = this._backgroundCanvasGroup;
         float num1 = ((TimeInterval <float>) ref x).get_Value();
         this._panelCanvasGroup.set_alpha(num1);
         double num2 = (double)num1;
         backgroundCanvasGroup.set_alpha((float)num2);
     }), (Action <Exception>)(ex => Debug.LogException(ex)), (Action)(() => this._panelCanvasGroup.set_blocksRaycasts(true)));
 }
Example #26
0
 protected override void OnBeforeStart()
 {
     ObservableExtensions.Subscribe <bool>((IObservable <M0>) this.OnActiveChangedAsObservable(), (Action <M0>)(x => this.SetActiveControl(x)));
     this._lerpStream = (IObservable <TimeInterval <float> >)Observable.TakeUntilDestroy <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(this._alphaAccelerationTime, true), true), (Component)this);
 }
Example #27
0
        public virtual void OnStart()
        {
            ((Task)this).OnStart();
            this.Agent.StateType = AIProject.Definitions.State.Type.Normal;
            this.Agent.ActivateTransfer(true);
            float _speed = this.Agent.NavMeshAgent.get_speed();

            ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(1f, false), false), (System.Action <M0>)(x => this.Agent.NavMeshAgent.set_speed(Mathf.Lerp(_speed, Singleton <Resources> .Instance.LocomotionProfile.AgentSpeed.walkSpeed, ((TimeInterval <float>) ref x).get_Value()))));
        }
Example #28
0
 private void AlphaFadeList(float duration, float start, float end, Action onCompleted)
 {
     if (end.Equals(start))
     {
         return;
     }
     if (this._fadeSubscriber != null)
     {
         this._fadeSubscriber.Dispose();
     }
     this._fadeSubscriber = ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(duration, true), true), (Action <M0>)(x => this.Alpha = Mathf.Lerp(start, end, ((TimeInterval <float>) ref x).get_Value())), (Action)(() =>
     {
         Action action = onCompleted;
         if (action == null)
         {
             return;
         }
         action();
     }));
 }
Example #29
0
        public void SetStand(Transform t, bool enableFade, float fadeTime, int dirType)
        {
            if (this._standDisposable != null)
            {
                this._standDisposable.Dispose();
            }
            IConnectableObservable <TimeInterval <float> > iconnectableObservable = (IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(fadeTime, false), false));

            this._standDisposable = iconnectableObservable.Connect();
            Vector3    position = this.Position;
            Quaternion rotation = this.Rotation;

            if (!Object.op_Inequality((Object)t, (Object)null))
            {
                return;
            }
            switch (dirType)
            {
            case 0:
                if (enableFade)
                {
                    ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (System.Action <M0>)(x =>
                    {
                        this.Position = Vector3.Lerp(position, t.get_position(), ((TimeInterval <float>) ref x).get_Value());
                        this.Rotation = Quaternion.Slerp(rotation, t.get_rotation(), ((TimeInterval <float>) ref x).get_Value());
                    }));
                    break;
                }
                if (((Behaviour)this._navMeshAgent).get_enabled())
                {
                    this.NavMeshWarp(t, 0, 100f);
                    break;
                }
                this.Position = t.get_position();
                this.Rotation = t.get_rotation();
                break;

            case 1:
                Vector3 position1 = ((Component)this).get_transform().get_position();
                position1.y = (__Null)0.0;
                Vector3 position2 = this.Position;
                position2.y = (__Null)0.0;
                Quaternion lookRotation = Quaternion.LookRotation(Vector3.Normalize(Vector3.op_Subtraction(position1, position2)));
                if (enableFade)
                {
                    ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (System.Action <M0>)(x => this.Rotation = Quaternion.Slerp(rotation, lookRotation, ((TimeInterval <float>) ref x).get_Value())));
                    break;
                }
                this.Rotation = lookRotation;
                break;
            }
        }
Example #30
0
 private void OnDisable()
 {
     ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.5f, false), false), (Action <M0>)(x => this.weight = (__Null)(1.0 - (double)((TimeInterval <float>) ref x).get_Value())));
 }