Esempio n. 1
0
        protected override void OnStart()
        {
            if (base.Widget != null)
            {
                switch (this.Interpolator)
                {
                case FadeOutEffectInterpolator.Linear:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                    break;

                case FadeOutEffectInterpolator.EaseOutQuad:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.EaseOutQuadInterpolator);
                    break;

                case FadeOutEffectInterpolator.Custom:
                    if (this.CustomInterpolator != null)
                    {
                        this.interpolatorCallback = this.CustomInterpolator;
                    }
                    else
                    {
                        this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                    }
                    break;

                default:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                    break;
                }
                base.Widget.Visible = true;
            }
        }
Esempio n. 2
0
 public FadeOutEffect(Widget widget, float time, FadeOutEffectInterpolator interpolator)
 {
     base.Widget             = widget;
     this.Time               = time;
     this.Interpolator       = FadeOutEffectInterpolator.EaseOutQuad;
     this.CustomInterpolator = null;
 }
Esempio n. 3
0
 public FadeOutEffect()
 {
     base.Widget             = null;
     this.Time               = 1000f;
     this.Interpolator       = FadeOutEffectInterpolator.EaseOutQuad;
     this.CustomInterpolator = null;
 }
Esempio n. 4
0
 public SlideInEffect(Widget widget, float time, FourWayDirection direction, SlideInEffectInterpolator interpolator)
 {
     base.Widget             = widget;
     this.Time               = time;
     this.Interpolator       = interpolator;
     this.CustomInterpolator = null;
     this.MoveDirection      = direction;
 }
Esempio n. 5
0
 public SlideInEffect()
 {
     base.Widget             = null;
     this.Time               = 1000f;
     this.Interpolator       = SlideInEffectInterpolator.EaseOutQuad;
     this.CustomInterpolator = null;
     this.MoveDirection      = FourWayDirection.Left;
 }
Esempio n. 6
0
 public MoveEffect(Widget widget, float time, float x, float y, MoveEffectInterpolator interpolator)
 {
     base.Widget             = widget;
     this.Time               = time;
     this.X                  = x;
     this.Y                  = y;
     this.Interpolator       = interpolator;
     this.CustomInterpolator = null;
 }
Esempio n. 7
0
 public MoveEffect()
 {
     base.Widget             = null;
     this.Time               = 1000f;
     this.X                  = 0f;
     this.Y                  = 0f;
     this.Interpolator       = MoveEffectInterpolator.Linear;
     this.CustomInterpolator = null;
 }
Esempio n. 8
0
        internal static AnimationInterpolator GetRandomSquareWaveInterpolator(int strength)
        {
            AnimationInterpolator square = AnimationUtility.GetSquareWaveInterpolator(strength);
            Random random      = new Random();
            float  prevVal     = 0f;
            float  randomFacor = 0f;

            return(delegate(float from, float to, float ratio)
            {
                float num = square(from, to, ratio);
                if (prevVal != num && prevVal <= 0f)
                {
                    randomFacor = (float)random.NextDouble();
                }
                return prevVal = randomFacor * square(from, to, ratio);
            });
        }
Esempio n. 9
0
        protected override void OnStart()
        {
            if (base.Widget != null)
            {
                switch (this.Interpolator)
                {
                case ZoomEffectInterpolator.Linear:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                    break;

                case ZoomEffectInterpolator.EaseOutQuad:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.EaseOutQuadInterpolator);
                    break;

                case ZoomEffectInterpolator.Overshoot:
                    this.interpolatorCallback = new AnimationInterpolator(ZoomEffect.ZoomOvershootInterpolator);
                    break;

                case ZoomEffectInterpolator.Elastic:
                    this.interpolatorCallback = new AnimationInterpolator(ZoomEffect.ZoomElasticInterpolator);
                    break;

                case ZoomEffectInterpolator.Custom:
                    if (this.CustomInterpolator != null)
                    {
                        this.interpolatorCallback = this.CustomInterpolator;
                    }
                    else
                    {
                        this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                    }
                    break;

                default:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                    break;
                }
                this.baseTransformMat         = base.Widget.Transform3D;
                this.startScaleX              = this.baseTransformMat.ColumnX.Length();
                this.startScaleY              = this.baseTransformMat.ColumnY.Length();
                this.startScaleZ              = this.baseTransformMat.ColumnZ.Length();
                this.baseTransformMat.ColumnX = (this.baseTransformMat.ColumnX / this.startScaleX);
                this.baseTransformMat.ColumnY = (this.baseTransformMat.ColumnY / this.startScaleY);
                this.baseTransformMat.ColumnZ = (this.baseTransformMat.ColumnZ / this.startScaleZ);
            }
        }
Esempio n. 10
0
        protected override void OnStart()
        {
            if (base.Widget != null)
            {
                switch (this.Interpolator)
                {
                case MoveEffectInterpolator.Linear:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                    break;

                case MoveEffectInterpolator.EaseOutQuad:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.EaseOutQuadInterpolator);
                    break;

                case MoveEffectInterpolator.Overshoot:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.OvershootInterpolator);
                    break;

                case MoveEffectInterpolator.Elastic:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.ElasticInterpolator);
                    break;

                case MoveEffectInterpolator.Custom:
                    if (this.CustomInterpolator != null)
                    {
                        this.interpolatorCallback = this.CustomInterpolator;
                    }
                    else
                    {
                        this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                    }
                    break;

                default:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                    break;
                }
                this.fromX          = base.Widget.X;
                this.fromY          = base.Widget.Y;
                this.toX            = this.X;
                this.toY            = this.Y;
                base.Widget.Visible = true;
            }
        }
Esempio n. 11
0
        protected override void OnStart()
        {
            ImageAsset currentSceneRenderedImage = base.GetCurrentSceneRenderedImage();

            this.currentSprt = new UISprite(1);
            base.TransitionUIElement.AddChildLast(this.currentSprt);
            this.currentSprt.ShaderType = ShaderType.OffscreenTexture;
            this.currentSprt.BlendMode  = BlendMode.Premultiplied;
            this.currentSprt.Image      = currentSceneRenderedImage;
            UISpriteUnit unit = this.currentSprt.GetUnit(0);

            unit.Width  = (float)UISystem.FramebufferWidth;
            unit.Height = (float)UISystem.FramebufferHeight;
            ImageAsset nextSceneRenderedImage = base.GetNextSceneRenderedImage();

            this.nextSprt = new UISprite(1);
            base.TransitionUIElement.AddChildLast(this.nextSprt);
            this.nextSprt.ShaderType = ShaderType.OffscreenTexture;
            this.nextSprt.BlendMode  = BlendMode.Premultiplied;
            this.nextSprt.Image      = nextSceneRenderedImage;
            unit        = this.nextSprt.GetUnit(0);
            unit.Width  = (float)UISystem.FramebufferWidth;
            unit.Height = (float)UISystem.FramebufferHeight;
            this.from   = 0f;
            switch (this.MoveDirection)
            {
            case FourWayDirection.Up:
                this.nextSprt.X = 0f;
                this.nextSprt.Y = (this.to = (float)(-(float)UISystem.FramebufferHeight));
                break;

            case FourWayDirection.Down:
                this.nextSprt.X = 0f;
                this.nextSprt.Y = (this.to = (float)UISystem.FramebufferHeight);
                break;

            case FourWayDirection.Left:
                this.nextSprt.X = (this.to = (float)(-(float)UISystem.FramebufferWidth));
                this.nextSprt.Y = 0f;
                break;

            case FourWayDirection.Right:
                this.nextSprt.X = (this.to = (float)UISystem.FramebufferWidth);
                this.nextSprt.Y = 0f;
                break;
            }
            switch (this.Interpolator)
            {
            case PushTransitionInterpolator.Linear:
                this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                return;

            case PushTransitionInterpolator.EaseOutQuad:
                this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.EaseOutQuadInterpolator);
                return;

            case PushTransitionInterpolator.Overshoot:
                this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.OvershootInterpolator);
                return;

            case PushTransitionInterpolator.Elastic:
                this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.ElasticInterpolator);
                return;

            case PushTransitionInterpolator.Custom:
                if (this.CustomInterpolator != null)
                {
                    this.interpolatorCallback = this.CustomInterpolator;
                    return;
                }
                this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                return;

            default:
                this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                return;
            }
        }
Esempio n. 12
0
        protected override void OnStart()
        {
            if (this.Interpolator == FlipBoardEffectInterpolator.Custom && this.CustomInterpolator != null)
            {
                this.interpolatorCallback = this.CustomInterpolator;
            }
            else
            {
                this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.FlipBounceInterpolator);
            }
            int num;
            int num2;
            int num3;
            int num4;

            if (UISystem.Scaled)
            {
                num  = (int)(base.Widget.Width * UISystem.Scale);
                num2 = (int)(base.Widget.Height * UISystem.Scale);
                num3 = (int)(this.NextWidget.Width * UISystem.Scale);
                num4 = (int)(this.NextWidget.Height * UISystem.Scale);
            }
            else
            {
                num  = (int)base.Widget.Width;
                num2 = (int)base.Widget.Height;
                num3 = (int)this.NextWidget.Width;
                num4 = (int)this.NextWidget.Height;
            }
            if (!UISystem.CheckTextureSizeCapacity(num, num2) || !UISystem.CheckTextureSizeCapacity(num3, num4))
            {
                throw new ArgumentOutOfRangeException();
            }
            Texture2D texture2D = new Texture2D(num, num2, false, (PixelFormat)1, (PixelBufferOption)1);

            base.Widget.RenderToTexture(texture2D);
            ImageAsset imageAsset = new ImageAsset(texture2D);

            imageAsset.AdjustScaledSize = true;
            texture2D.Dispose();
            Texture2D texture2D2 = new Texture2D(num3, num4, false, (PixelFormat)1, (PixelBufferOption)1);

            this.NextWidget.RenderToTexture(texture2D2);
            ImageAsset imageAsset2 = new ImageAsset(texture2D2);

            imageAsset2.AdjustScaledSize = true;
            texture2D2.Dispose();
            float     width     = base.Widget.Width;
            float     num5      = base.Widget.Height / 2f;
            float     width2    = this.NextWidget.Width;
            float     num6      = this.NextWidget.Height / 2f;
            PivotType pivotType = base.Widget.PivotType;

            base.Widget.PivotType            = PivotType.MiddleCenter;
            this.centerPosition              = new Vector2(base.Widget.X, base.Widget.Y);
            base.Widget.PivotType            = pivotType;
            pivotType                        = this.NextWidget.PivotType;
            this.NextWidget.PivotType        = PivotType.MiddleCenter;
            this.NextWidget.Transform3D      = Matrix4.Translation(this.centerPosition.X, this.centerPosition.Y, 0f);
            this.NextWidget.PivotType        = pivotType;
            this.currentUpperSprt            = new UISprite(1);
            this.currentUpperSprt.X          = this.centerPosition.X;
            this.currentUpperSprt.Y          = this.centerPosition.Y - num5 * 0.5f;
            this.currentUpperSprt.Image      = imageAsset;
            this.currentUpperSprt.ShaderType = ShaderType.OffscreenTexture;
            this.currentUpperSprt.BlendMode  = BlendMode.Premultiplied;
            UISpriteUnit unit = this.currentUpperSprt.GetUnit(0);

            unit.X                           = -width * 0.5f;
            unit.Y                           = -num5 * 0.5f;
            unit.Width                       = width;
            unit.Height                      = num5;
            unit.V2                          = 0.5f;
            this.currentLowerSprt            = new UISprite(1);
            this.currentLowerSprt.X          = this.centerPosition.X;
            this.currentLowerSprt.Y          = this.centerPosition.Y + num5 * 0.5f;
            this.currentLowerSprt.Image      = imageAsset;
            this.currentLowerSprt.ShaderType = ShaderType.OffscreenTexture;
            this.currentLowerSprt.BlendMode  = BlendMode.Premultiplied;
            UISpriteUnit unit2 = this.currentLowerSprt.GetUnit(0);

            unit2.X                       = -width * 0.5f;
            unit2.Y                       = -num5 * 0.5f;
            unit2.Width                   = width;
            unit2.Height                  = num5;
            unit2.V1                      = 0.5f;
            this.nextUpperSprt            = new UISprite(1);
            this.nextUpperSprt.X          = this.centerPosition.X;
            this.nextUpperSprt.Y          = this.centerPosition.Y - num6 * 0.5f;
            this.nextUpperSprt.Image      = imageAsset2;
            this.nextUpperSprt.ShaderType = ShaderType.OffscreenTexture;
            this.nextUpperSprt.BlendMode  = BlendMode.Premultiplied;
            UISpriteUnit unit3 = this.nextUpperSprt.GetUnit(0);

            unit3.X                       = -width2 * 0.5f;
            unit3.Y                       = -num6 * 0.5f;
            unit3.Width                   = width2;
            unit3.Height                  = num6;
            unit3.V2                      = 0.5f;
            this.nextLowerSprt            = new UISprite(1);
            this.nextLowerSprt.X          = this.centerPosition.X;
            this.nextLowerSprt.Y          = this.centerPosition.Y + num6 * 0.5f;
            this.nextLowerSprt.Image      = imageAsset2;
            this.nextLowerSprt.ShaderType = ShaderType.OffscreenTexture;
            this.nextLowerSprt.BlendMode  = BlendMode.Premultiplied;
            UISpriteUnit unit4 = this.nextLowerSprt.GetUnit(0);

            unit4.X      = -width2 * 0.5f;
            unit4.Y      = -num6 * 0.5f;
            unit4.Width  = width2;
            unit4.Height = num6;
            unit4.V1     = 0.5f;
            base.Widget.Parent.RootUIElement.AddChildLast(this.currentLowerSprt);
            this.NextWidget.Parent.RootUIElement.AddChildLast(this.nextUpperSprt);
            base.Widget.Parent.RootUIElement.AddChildLast(this.currentUpperSprt);
            this.NextWidget.Parent.RootUIElement.AddChildLast(this.nextLowerSprt);
            this.degree                       = 0f;
            this.turnupTime                   = this.Time;
            this.secondZOffset                = num5 / 4f;
            base.Widget.Visible               = false;
            this.NextWidget.Visible           = false;
            this.currentUpperSprt.Culling     = true;
            this.nextLowerSprt.Culling        = true;
            this.currentUpperSprt.ZSort       = true;
            this.currentLowerSprt.ZSort       = true;
            this.nextUpperSprt.ZSort          = true;
            this.nextLowerSprt.ZSort          = true;
            this.currentUpperSprt.ZSortOffset = -this.secondZOffset - this.firstZOffset;
            this.currentLowerSprt.ZSortOffset = 0f;
            this.nextUpperSprt.ZSortOffset    = -this.firstZOffset;
            this.nextLowerSprt.ZSortOffset    = -this.secondZOffset - this.firstZOffset;
            this.RotateNextLowerSprite();
        }
Esempio n. 13
0
        private void SetMotionData(UIMotionData data)
        {
            float timeScale          = data.header.timeScale;
            Func <float, float> func = (float timeValue) => timeValue / timeScale * 1000f;

            this.duration = func.Invoke(data.header.duration);
            using (List <UIMotionData.Property> .Enumerator enumerator = data.properties.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    UIMotionData.Property current = enumerator.Current;
                    AnimationInterpolator easingCurve;
                    if (current.header.useTimeMap)
                    {
                        int strength = data.timeMaps[(int)current.header.timeMapIndex].header.strength;
                        switch (data.timeMaps[(int)current.header.timeMapIndex].header.easeType)
                        {
                        case EaseType.Quadratic:
                            easingCurve = AnimationUtility.GetQuadInterpolator(strength);
                            break;

                        case EaseType.Cubic:
                            easingCurve = AnimationUtility.GetCubicInterpolator(strength);
                            break;

                        case EaseType.Quartic:
                            easingCurve = AnimationUtility.GetQuarticInterpolator(strength);
                            break;

                        case EaseType.Quintic:
                            easingCurve = AnimationUtility.GetQuinticInterpolator(strength);
                            break;

                        case EaseType.DualQuadratic:
                            easingCurve = AnimationUtility.GetDualQuadInterpolator(strength);
                            break;

                        case EaseType.DualCubic:
                            easingCurve = AnimationUtility.GetDualCubicInterpolator(strength);
                            break;

                        case EaseType.DualQuartic:
                            easingCurve = AnimationUtility.GetDualQuarticInterpolator(strength);
                            break;

                        case EaseType.DualQuintic:
                            easingCurve = AnimationUtility.GetDualQuinticInterpolator(strength);
                            break;

                        case EaseType.Bounce:
                            easingCurve = AnimationUtility.GetBounceInterpolator(strength);
                            break;

                        case EaseType.BounceIn:
                            easingCurve = AnimationUtility.GetBounceInInterpolator(strength);
                            break;

                        case EaseType.Spring:
                            easingCurve = AnimationUtility.GetSpringInterpolator(strength);
                            break;

                        case EaseType.SineWave:
                            easingCurve = AnimationUtility.GetSineWaveInterpolator(strength);
                            break;

                        case EaseType.SawtoothWave:
                            easingCurve = AnimationUtility.GetSawtoothWaveInterpolator(strength);
                            break;

                        case EaseType.SquareWave:
                            easingCurve = AnimationUtility.GetSquareWaveInterpolator(strength);
                            break;

                        case EaseType.RandomSquareWave:
                            easingCurve = AnimationUtility.GetRandomSquareWaveInterpolator(strength);
                            break;

                        case EaseType.DampedWave:
                            easingCurve = AnimationUtility.GetDampedWaveInterpolator(strength);
                            break;

                        default:
                            easingCurve = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                            break;
                        }
                    }
                    else
                    {
                        easingCurve = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                    }
                    if (current.keyframes.Count > 0)
                    {
                        UIMotionData.Property.Keyframe            keyframe = current.keyframes[0];
                        AnimationUtility.CubicBezierCurveSequence cubicBezierCurveSequence = new AnimationUtility.CubicBezierCurveSequence(func.Invoke(keyframe.time), keyframe.anchorY);
                        cubicBezierCurveSequence.EasingCurve = easingCurve;
                        for (int i = 0; i < current.keyframes.Count - 1; i++)
                        {
                            int num  = i;
                            int num2 = i + 1;
                            UIMotionData.Property.Keyframe keyframe2 = current.keyframes[num];
                            UIMotionData.Property.Keyframe keyframe3 = current.keyframes[num2];
                            float num3        = keyframe2.time;
                            float num4        = keyframe3.time;
                            float control1X   = func.Invoke(keyframe2.nextX + num3);
                            float control1Y   = keyframe2.nextY;
                            float control2X   = func.Invoke(keyframe3.previousX + num4);
                            float control2Y   = keyframe3.previousY;
                            float nextAnchorX = func.Invoke(keyframe3.time);
                            float nextAnchorY = keyframe3.anchorY;
                            cubicBezierCurveSequence.AppendSegment(control1X, control1Y, control2X, control2Y, nextAnchorX, nextAnchorY);
                        }
                        this.timelines.Add(current.header.propertyType, cubicBezierCurveSequence);
                    }
                }
            }
        }
Esempio n. 14
0
        protected override void OnStart()
        {
            if (this.texturize)
            {
                base.DrawOrder = TransitionDrawOrder.TransitionUIElement;
            }
            else if (this.nextSceneForward)
            {
                base.DrawOrder = TransitionDrawOrder.CS_NS;
            }
            else
            {
                base.DrawOrder = TransitionDrawOrder.NS_CS;
            }
            switch (this.Interpolator)
            {
            case CrossFadeTransitionInterpolator.EaseOutQuad:
                if (this.nextSceneForward)
                {
                    this.nextInterpolatorCallback    = new AnimationInterpolator(AnimationUtility.EaseOutQuadInterpolator);
                    this.currentInterpolatorCallback = new AnimationInterpolator(this.constInterpolator);
                    goto IL_145;
                }
                this.nextInterpolatorCallback    = new AnimationInterpolator(this.constInterpolator);
                this.currentInterpolatorCallback = new AnimationInterpolator(AnimationUtility.EaseOutQuadInterpolator);
                goto IL_145;

            case CrossFadeTransitionInterpolator.Custom:
                if (this.customNextSceneInterpolator != null)
                {
                    this.nextInterpolatorCallback = this.customNextSceneInterpolator;
                }
                else
                {
                    this.nextInterpolatorCallback = new AnimationInterpolator(this.constInterpolator);
                }
                if (this.customCurrentSceneInterpolator != null)
                {
                    this.currentInterpolatorCallback = this.customCurrentSceneInterpolator;
                    goto IL_145;
                }
                this.currentInterpolatorCallback = new AnimationInterpolator(this.constInterpolator);
                goto IL_145;
            }
            if (this.nextSceneForward)
            {
                this.nextInterpolatorCallback    = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                this.currentInterpolatorCallback = new AnimationInterpolator(this.constInterpolator);
            }
            else
            {
                this.nextInterpolatorCallback    = new AnimationInterpolator(this.constInterpolator);
                this.currentInterpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
            }
IL_145:
            if (this.texturize)
            {
                ImageAsset currentSceneRenderedImage = base.GetCurrentSceneRenderedImage();
                if (this.currentSprt == null)
                {
                    this.currentSprt            = new UISprite(1);
                    this.currentSprt.ShaderType = ShaderType.OffscreenTexture;
                    this.currentSprt.BlendMode  = BlendMode.Premultiplied;
                }
                this.currentSprt.Image = currentSceneRenderedImage;
                UISpriteUnit unit = this.currentSprt.GetUnit(0);
                unit.Width  = (float)UISystem.FramebufferWidth;
                unit.Height = (float)UISystem.FramebufferHeight;
                ImageAsset nextSceneRenderedImage = base.GetNextSceneRenderedImage();
                if (this.nextSprt == null)
                {
                    this.nextSprt            = new UISprite(1);
                    this.nextSprt.ShaderType = ShaderType.OffscreenTexture;
                    this.nextSprt.BlendMode  = BlendMode.Premultiplied;
                }
                this.nextSprt.Image = nextSceneRenderedImage;
                unit        = this.nextSprt.GetUnit(0);
                unit.Width  = (float)UISystem.FramebufferWidth;
                unit.Height = (float)UISystem.FramebufferHeight;
                if (this.nextSceneForward)
                {
                    base.TransitionUIElement.AddChildLast(this.currentSprt);
                    base.TransitionUIElement.AddChildLast(this.nextSprt);
                }
                else
                {
                    base.TransitionUIElement.AddChildLast(this.nextSprt);
                    base.TransitionUIElement.AddChildLast(this.currentSprt);
                }
                this.nextSprt.Alpha = 0f;
            }
            base.NextScene.RootWidget.Alpha = 0f;
        }
Esempio n. 15
0
        protected override void OnStart()
        {
            if (base.Widget != null)
            {
                switch (this.Interpolator)
                {
                case SlideInEffectInterpolator.Linear:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                    break;

                case SlideInEffectInterpolator.EaseOutQuad:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.EaseOutQuadInterpolator);
                    break;

                case SlideInEffectInterpolator.Overshoot:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.OvershootInterpolator);
                    break;

                case SlideInEffectInterpolator.Elastic:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.ElasticInterpolator);
                    break;

                case SlideInEffectInterpolator.Custom:
                    if (this.CustomInterpolator != null)
                    {
                        this.interpolatorCallback = this.CustomInterpolator;
                    }
                    else
                    {
                        this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                    }
                    break;

                default:
                    this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.LinearInterpolator);
                    break;
                }
                switch (this.MoveDirection)
                {
                case FourWayDirection.Up:
                    this.from           = base.Widget.Y + (float)UISystem.FramebufferHeight;
                    this.to             = base.Widget.Y;
                    base.Widget.Y       = base.Widget.Y + (float)UISystem.FramebufferHeight;
                    base.Widget.Visible = true;
                    break;

                case FourWayDirection.Down:
                    this.from           = base.Widget.Y - (float)UISystem.FramebufferHeight;
                    this.to             = base.Widget.Y;
                    base.Widget.Y       = base.Widget.Y - (float)UISystem.FramebufferHeight;
                    base.Widget.Visible = true;
                    return;

                case FourWayDirection.Left:
                    this.from           = base.Widget.X + (float)UISystem.FramebufferWidth;
                    this.to             = base.Widget.X;
                    base.Widget.X       = base.Widget.X + (float)UISystem.FramebufferWidth;
                    base.Widget.Visible = true;
                    return;

                case FourWayDirection.Right:
                    this.from           = base.Widget.X - (float)UISystem.FramebufferWidth;
                    this.to             = base.Widget.X;
                    base.Widget.X       = base.Widget.X - (float)UISystem.FramebufferWidth;
                    base.Widget.Visible = true;
                    return;

                default:
                    return;
                }
            }
        }
Esempio n. 16
0
        protected override void OnStart()
        {
            if (this.Interpolator == FlipBoardEffectInterpolator.Custom && this.CustomInterpolator != null)
            {
                this.interpolatorCallback = this.CustomInterpolator;
            }
            else
            {
                this.interpolatorCallback = new AnimationInterpolator(AnimationUtility.FlipBounceInterpolator);
            }
            ImageAsset currentSceneRenderedImage = base.GetCurrentSceneRenderedImage();
            ImageAsset nextSceneRenderedImage    = base.GetNextSceneRenderedImage();
            float      width  = (float)UISystem.FramebufferWidth;
            float      num    = (float)UISystem.FramebufferHeight / 2f;
            float      width2 = (float)UISystem.FramebufferWidth;
            float      height = (float)UISystem.FramebufferHeight / 2f;

            this.currentUpperSprt            = new UISprite(1);
            this.currentUpperSprt.X          = 0f;
            this.currentUpperSprt.Y          = 0f;
            this.currentUpperSprt.Image      = currentSceneRenderedImage;
            this.currentUpperSprt.ShaderType = ShaderType.OffscreenTexture;
            this.currentUpperSprt.BlendMode  = BlendMode.Premultiplied;
            UISpriteUnit unit = this.currentUpperSprt.GetUnit(0);

            unit.Width                       = width;
            unit.Height                      = num;
            unit.U1                          = 0f;
            unit.V1                          = 0f;
            unit.U2                          = 1f;
            unit.V2                          = 0.5f;
            this.currentLowerSprt            = new UISprite(1);
            this.currentLowerSprt.X          = 0f;
            this.currentLowerSprt.Y          = num;
            this.currentLowerSprt.Image      = currentSceneRenderedImage;
            this.currentLowerSprt.ShaderType = ShaderType.OffscreenTexture;
            this.currentLowerSprt.BlendMode  = BlendMode.Premultiplied;
            UISpriteUnit unit2 = this.currentLowerSprt.GetUnit(0);

            unit2.Width                   = width;
            unit2.Height                  = num;
            unit2.U1                      = 0f;
            unit2.V1                      = 0.5f;
            unit2.U2                      = 1f;
            unit2.V2                      = 1f;
            this.nextUpperSprt            = new UISprite(1);
            this.nextUpperSprt.X          = 0f;
            this.nextUpperSprt.Y          = 0f;
            this.nextUpperSprt.Image      = nextSceneRenderedImage;
            this.nextUpperSprt.ShaderType = ShaderType.OffscreenTexture;
            this.nextUpperSprt.BlendMode  = BlendMode.Premultiplied;
            UISpriteUnit unit3 = this.nextUpperSprt.GetUnit(0);

            unit3.Width                   = width2;
            unit3.Height                  = height;
            unit3.U1                      = 0f;
            unit3.V1                      = 0f;
            unit3.U2                      = 1f;
            unit3.V2                      = 0.5f;
            this.nextLowerSprt            = new UISprite(1);
            this.nextLowerSprt.X          = 0f;
            this.nextLowerSprt.Y          = (float)UISystem.FramebufferHeight / 2f;
            this.nextLowerSprt.ShaderType = ShaderType.OffscreenTexture;
            this.nextLowerSprt.BlendMode  = BlendMode.Premultiplied;
            this.nextLowerSprt.Image      = nextSceneRenderedImage;
            UISpriteUnit unit4 = this.nextLowerSprt.GetUnit(0);

            unit4.Width  = width2;
            unit4.Height = height;
            unit4.U1     = 0f;
            unit4.V1     = 0.5f;
            unit4.U2     = 1f;
            unit4.V2     = 1f;
            base.TransitionUIElement.AddChildLast(this.currentLowerSprt);
            base.TransitionUIElement.AddChildLast(this.nextUpperSprt);
            base.TransitionUIElement.AddChildLast(this.currentUpperSprt);
            base.TransitionUIElement.AddChildLast(this.nextLowerSprt);
            this.currentUpperSprt.Visible = true;
            this.currentLowerSprt.Visible = true;
            this.nextUpperSprt.Visible    = false;
            this.nextLowerSprt.Visible    = false;
            this.degree = 0f;
        }