public void Play(WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
        {
            var delay = this.GetDelay(parameters, forward);
            var tag   = (window != null ? "_" + window.GetInstanceID().ToString() : string.Empty) +
                        (parameters != null ? ("_" + parameters.GetInstanceID().ToString()) : string.Empty) +
                        (root != null ? ("_" + root.GetInstanceID().ToString()) : string.Empty);

            if (TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.removeTweens(tag);
            }

            if (delay > 0f && TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.addTween(this, delay, 0f, 0f).tag(tag).onComplete(() => {
                    this.OnPlay(window, tag, parameters, root, forward, callback);
                }).onCancel((obj) => {
                    if (callback != null)
                    {
                        callback();
                    }
                });
            }
            else
            {
                this.OnPlay(window, tag, parameters, root, forward, callback);
            }
        }
Exemple #2
0
        private ME.Tweener.MultiTag GetTag(WindowBase window, TransitionInputParameters parameters)
        {
            //return string.Format("{0}_{1}", (window != null) ? window.GetInstanceID() : 0, (parameters != null) ? parameters.GetInstanceID() : 0);

            return(new ME.Tweener.MultiTag()
            {
                tag1 = window, tag2 = parameters
            });
        }
Exemple #3
0
        public virtual void SetResetState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root)
        {
            var tag = this.GetTag(window, parameters);

            if (TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.removeTweens(tag);
            }
        }
        public virtual void SetResetState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root)
        {
            var tag = this.GetInstanceID().ToString() + (root != null ? ("_" + root.GetInstanceID().ToString()) : string.Empty);

            if (TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.removeTweens(tag);
            }
        }
        public override void OnPlay(WindowBase window, object tag, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                if (callback != null)
                {
                    callback();
                }
                return;
            }

            this.currentWindow = window;

            this.prevWindow = WindowSystem.GetPreviousWindow(window, (item) => item.window != null && item.window.GetState() == WindowObjectState.Shown);
            if (this.prevWindow == null)
            {
                window.transition.SaveToCache(this.clearScreen, () => {
                    this.material.SetTexture("_ClearScreen", this.clearScreen);
                }, this.grabEveryFrame);
            }
            else
            {
                if (forward == true)
                {
                    // Take screenshot from current view
                    this.prevWindow.transition.SaveToCache(this.clearScreen, () => {
                        this.material.SetTexture("_ClearScreen", this.clearScreen);
                    }, this.grabEveryFrame);
                }
                else
                {
                    // Take screenshot from previous view
                    this.prevWindow.transition.SaveToCache(this.clearScreen, () => {
                        this.material.SetTexture("_ClearScreen", this.clearScreen);
                    }, this.grabEveryFrame);
                }
            }

            var duration = this.GetDuration(parameters, forward);
            var result   = param.GetResult(forward);

            TweenerGlobal.instance.removeTweens(tag);
            TweenerGlobal.instance.addTween(this, duration, this.material.GetFloat("_Value"), result).onUpdate((obj, value) => {
                this.material.SetFloat("_Value", value);
            }).onComplete((obj) => { if (callback != null)
                                     {
                                         callback();
                                     }
                          }).onCancel((obj) => { if (callback != null)
                                                 {
                                                     callback();
                                                 }
                                      }).tag(tag);
        }
        public virtual float GetDuration(TransitionInputParameters parameters, bool forward)
        {
            var param = this.GetParams <ParametersBase>(parameters);

            if (forward == true)
            {
                return(param.inDuration);
            }

            return(param.outDuration);
        }
Exemple #7
0
        /*public void Play(WindowAnimationBase transitionBase, WindowBase window, bool forward, System.Action callback) {
         *
         *      var tag = new ME.Tweener.MultiTag() { tag1 = window };//((window != null) ? window.GetInstanceID() : 0).ToString();
         *      if (TweenerGlobal.instance != null) TweenerGlobal.instance.removeTweens(tag);
         *
         *      this.Play(tag, transitionBase, window, null, null, forward, callback);
         *
         * }*/

        public void Play(WindowAnimationBase transitionBase, WindowBase window, TransitionInputParameters parameters, bool forward, System.Action callback)
        {
            var tag = this.GetTag(window, parameters);

            if (TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.removeTweens(tag);
            }

            this.Play(tag, transitionBase, window, parameters, null, forward, callback);
        }
        public override void SetOutState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                return;
            }

            param.Apply(param.GetMaterialInstance(), this.GetRoot(param, window), param.GetOut());
        }
        public override void SetResetState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                return;
            }

            this.material.SetFloat("_Value", param.GetReset());
        }
        public override void SetResetState(TransitionInputParameters parameters, WindowComponentBase root)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                return;
            }

            this.GetRoot(param, root).anchoredPosition = param.GetReset();
        }
Exemple #11
0
        public override void SetResetState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                return;
            }

            param.Apply(this.GetRoot(param, root), param.GetReset());
        }
        private CanvasGroup GetCanvasGroup(TransitionInputParameters parameters)
        {
            CanvasGroup canvasGroup = null;

            if (parameters is WindowAnimationTransitionAlphaParameters)
            {
                canvasGroup = (parameters as WindowAnimationTransitionAlphaParameters).canvasGroup;
            }

            return(canvasGroup);
        }
        public override void OnPlay(WindowBase window, object tag, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                if (callback != null)
                {
                    callback();
                }
                return;
            }

            var duration    = this.GetDuration(parameters, forward);
            var resultState = param.GetResult(forward);

            var rect  = this.GetRoot(param, window);
            var state = new Parameters.State(rect);

            var material = param.GetMaterialInstance();

            if (TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.removeTweens(tag);
                TweenerGlobal.instance.addTween(rect, duration, 0f, 1f).onUpdate((obj, value) => {
                    if (obj != null)
                    {
                        param.Apply(material, obj, state, resultState, value);
                    }
                }).onComplete((obj) => {
                    if (callback != null)
                    {
                        callback();
                    }
                    CanvasUpdater.ForceUpdate();
                }).onCancel((obj) => {
                    if (callback != null)
                    {
                        callback();
                    }
                    CanvasUpdater.ForceUpdate();
                }).tag(tag).ease(ME.Ease.GetByType(forward == true ? param.inEase : param.outEase));
            }
            else
            {
                param.Apply(material, rect, resultState);
                if (callback != null)
                {
                    callback();
                }
                CanvasUpdater.ForceUpdate();
            }
        }
        public T GetParams <T>(TransitionInputParameters parameters) where T : ParametersBase
        {
            T param = null;

            if (parameters == null || parameters.useDefault == true)
            {
                param = this.GetDefaultInputParameters() as T;
            }
            else
            {
                param = parameters.GetParameters <T>();
            }

            return(param);
        }
Exemple #15
0
        public override void SetResetState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root)
        {
            base.SetResetState(parameters, window, root);

            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                return;
            }

            if (root != null && root.canvas != null)
            {
                root.canvas.alpha = param.GetReset();
            }
        }
        public override void Set(WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, float value)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                return;
            }

            var source = this.GetRoot(param, window);

            var state       = new Parameters.State(source);
            var resultState = param.GetResult(forward);

            param.Apply(source, state, resultState, ME.Ease.GetByType(forward == true ? param.inEase : param.outEase).interpolate(0f, 1f, value, 1f));
        }
        public override void OnPlay(WindowBase window, object tag, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null || root == null)
            {
                if (callback != null)
                {
                    callback();
                }
                return;
            }

            var duration = this.GetDuration(parameters, forward);
            var result   = param.GetResult(forward);

            var rect          = this.GetRoot(param, root);
            var startPosition = rect.anchoredPosition;
            var endPosition   = result;

            if (TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.removeTweens(tag);
                TweenerGlobal.instance.addTween <RectTransform>(rect, duration, 0f, 1f).onUpdate((obj, value) => {
                    if (obj != null)
                    {
                        obj.anchoredPosition = Vector2.Lerp(startPosition, endPosition, value);
                    }
                }).onComplete((obj) => { if (callback != null)
                                         {
                                             callback();
                                         }
                              }).onCancel((obj) => { if (callback != null)
                                                     {
                                                         callback();
                                                     }
                                          }).tag(tag);
            }
            else
            {
                rect.anchoredPosition = endPosition;
                if (callback != null)
                {
                    callback();
                }
            }
        }
        public override void OnPlay(WindowBase window, ME.Tweener.MultiTag tag, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null || root == null)
            {
                if (callback != null)
                {
                    callback();
                }
                return;
            }

            var canvasGroup = this.GetCanvasGroup(parameters);

            var duration = this.GetDuration(parameters, forward);
            var result   = param.GetResult(forward);

            if (TweenerGlobal.instance != null)
            {
                //TweenerGlobal.instance.removeTweens(tag);
                TweenerGlobal.instance.addTweenAlpha(canvasGroup, duration, result)
                .ease(ME.Ease.GetByType(forward == true ? param.inEase : param.outEase))
                .onComplete((obj) => { if (callback != null)
                                       {
                                           callback();
                                       }
                            })
                .onCancel((obj) => { if (callback != null)
                                     {
                                         callback();
                                     }
                          })
                .tag(tag);
            }
            else
            {
                if (canvasGroup != null)
                {
                    canvasGroup.alpha = result;
                }
                if (callback != null)
                {
                    callback();
                }
            }
        }
        public override void SetResetState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root)
        {
            base.SetResetState(parameters, window, root);

            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                return;
            }

            var canvasGroup = this.GetCanvasGroup(parameters);

            if (canvasGroup != null)
            {
                canvasGroup.alpha = param.GetReset();
            }
        }
        public override void Set(WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, float value)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null)
            {
                return;
            }

            //var duration = this.GetDuration(parameters, forward);
            var rect = this.GetRoot(param, window);

            var state       = new Parameters.State(rect);
            var resultState = param.GetResult(forward);

            var material = param.GetMaterialInstance();

            param.Apply(material, rect, state, resultState, ME.Ease.GetByType(forward == true ? param.inEase : param.outEase).interpolate(0f, 1f, value, 1f));
        }
        public override void OnPlay(WindowBase window, object tag, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
        {
            var param = this.GetParams <Parameters>(parameters);

            if (param == null || root == null)
            {
                if (callback != null)
                {
                    callback();
                }
                return;
            }

            var duration = this.GetDuration(parameters, forward);
            var result   = param.GetResult(forward);

            if (TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.removeTweens(tag);
                TweenerGlobal.instance.addTweenAlpha(root.canvas, duration, result).onComplete((obj) => { if (callback != null)
                                                                                                          {
                                                                                                              callback();
                                                                                                          }
                                                                                               }).onCancel((obj) => { if (callback != null)
                                                                                                                      {
                                                                                                                          callback();
                                                                                                                      }
                                                                                                           }).tag(tag);
            }
            else
            {
                if (root.canvas != null)
                {
                    root.canvas.alpha = result;
                }
                if (callback != null)
                {
                    callback();
                }
            }
        }
Exemple #22
0
 public void Play(WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
 {
     this.transition.Play(window, parameters, root, forward, callback);
 }
 public void SetInState(TransitionInputParameters parameters, WindowComponentBase root)
 {
     this.transition.SetInState(parameters, root);
 }
Exemple #24
0
        public void Play(ME.Tweener.MultiTag tag, WindowAnimationBase transitionBase, WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
        {
            var delay = this.GetDelay(parameters, forward);

            if (delay > 0f && TweenerGlobal.instance != null)
            {
                TweenerGlobal.instance.addTween(this, delay, 0f, 0f).tag(tag).onComplete(() => {
                    this.OnPlay(window, tag, parameters, root, forward, callback);
                }).onCancel((obj) => {
                    if (callback != null)
                    {
                        callback.Invoke();
                    }
                });
            }
            else
            {
                this.OnPlay(window, tag, parameters, root, forward, callback);
            }
        }
Exemple #25
0
 public float GetDuration(TransitionInputParameters parameters, bool forward)
 {
     return(this.transition.GetDuration(parameters, forward));
 }
 public virtual void OnPlay(WindowBase window, object tag, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
 {
 }
 public virtual void Set(WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, float value)
 {
 }
Exemple #28
0
 public void SetResetState(TransitionInputParameters parameters, WindowBase window, WindowComponentBase root)
 {
     this.transition.SetResetState(parameters, window, root);
 }
 public void Play(ME.Tweener.MultiTag tag, WindowAnimationBase transitionBase, WindowBase window, TransitionInputParameters parameters, WindowComponentBase root, bool forward, System.Action callback)
 {
     this.transition.Play(tag, transitionBase, window, parameters, root, forward, callback);
 }