예제 #1
0
        public PagePanel()
        {
            this.panelContainer      = new ContainerWidget();
            this.panelContainer.Clip = false;
            base.AddChildLast(this.panelContainer);
            this.sprtContainer      = new ContainerWidget();
            this.sprtContainer.Clip = false;
            base.AddChildLast(this.sprtContainer);
            this.panelList           = new List <Panel>();
            this.sprtList            = new List <UISprite>();
            this.pageCount           = 0;
            this.pageIndex           = -1;
            base.Clip                = true;
            base.HookChildTouchEvent = true;
            this.state               = PagePanel.AnimationState.None;
            this.activeImage         = new ImageAsset(SystemImageAsset.PagePanelActive);
            this.normalImage         = new ImageAsset(SystemImageAsset.PagePanelNormal);
            DragGestureDetector dragGestureDetector = new DragGestureDetector();

            dragGestureDetector.DragDetected += new EventHandler <DragEventArgs>(this.DragEventHandler);
            base.AddGestureDetector(dragGestureDetector);
            FlickGestureDetector flickGestureDetector = new FlickGestureDetector();

            flickGestureDetector.Direction      = FlickDirection.Horizontal;
            flickGestureDetector.FlickDetected += new EventHandler <FlickEventArgs>(this.FlickEventHandler);
            base.AddGestureDetector(flickGestureDetector);
        }
예제 #2
0
        protected override void OnStart()
        {
            ImageAsset currentSceneRenderedImage = base.GetCurrentSceneRenderedImage();

            this.currentSprt            = new UISprite(1);
            this.currentSprt.Image      = currentSceneRenderedImage;
            this.currentSprt.ShaderType = ShaderType.OffscreenTexture;
            this.currentSprt.BlendMode  = BlendMode.Premultiplied;
            base.TransitionUIElement.AddChildLast(this.currentSprt);
            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);
            this.nextSprt.Image      = nextSceneRenderedImage;
            this.nextSprt.ShaderType = ShaderType.OffscreenTexture;
            this.nextSprt.BlendMode  = BlendMode.Premultiplied;
            base.TransitionUIElement.AddChildLast(this.nextSprt);
            unit        = this.nextSprt.GetUnit(0);
            unit.Width  = (float)UISystem.FramebufferWidth;
            unit.Height = (float)UISystem.FramebufferHeight;
            this.currentSprt.Visible = true;
            this.nextSprt.Visible    = false;
            this.time       = ((this.Speed == JumpFlipTransitionSpeed.Fast) ? 500f : 1000f);
            this.fromDegree = 0f;
            this.toDegree   = ((this.RotateDirection == JumpFlipTransitionRotateDirection.ClockWise) ? 180f : -180f);
        }
예제 #3
0
 public InternalSpinBox()
 {
     base.Width                    = 80f;
     base.Height                   = 204f;
     this.backgraundImage          = new ImageAsset(SystemImageAsset.SpinBoxBase);
     this.centerImage              = new ImageAsset(SystemImageAsset.SpinBoxCenter);
     this.backgroundImageNinePatch = AssetManager.GetNinePatchMargin(SystemImageAsset.SpinBoxBase);
     this.centerImageNinePatch     = AssetManager.GetNinePatchMargin(SystemImageAsset.SpinBoxCenter);
     this.backPrim                 = new UIPrimitive((DrawMode)4, 16, 28);
     this.backPrim.Image           = this.backgraundImage;
     this.backPrim.ShaderType      = ShaderType.Texture;
     UIPrimitiveUtility.SetupNinePatch(this.backPrim, 80f, 204f, 0f, 0f, this.backgroundImageNinePatch);
     this.backPrim.SetPosition(0f, 0f);
     base.RootUIElement.AddChildLast(this.backPrim);
     this.centerPrim            = new UIPrimitive((DrawMode)4, 16, 28);
     this.centerPrim.Image      = this.centerImage;
     this.centerPrim.ShaderType = ShaderType.Texture;
     UIPrimitiveUtility.SetupNinePatch(this.centerPrim, 80f, 54f, 0f, 0f, this.centerImageNinePatch);
     this.centerPrim.SetPosition(0f, 75f);
     base.RootUIElement.AddChildLast(this.centerPrim);
     this.spinList                   = new InternalSpinBox.SpinList();
     this.spinList.Width             = 80f;
     this.spinList.Height            = 40f * (float)InternalSpinBox.visibleCount;
     this.spinList.X                 = 0f;
     this.spinList.Y                 = 2f;
     this.spinList.ItemGapLine       = 40f;
     this.spinList.ScrollAreaLineNum = InternalSpinBox.visibleCount;
     base.AddChildLast(this.spinList);
     this.PriorityHit = true;
 }
예제 #4
0
파일: Slider.cs 프로젝트: weimingtom/Sakura
        protected override void DisposeSelf()
        {
            ImageAsset[] array = this.baseImageAssets;
            for (int i = 0; i < array.Length; i++)
            {
                ImageAsset imageAsset = array[i];
                imageAsset.Dispose();
            }
            ImageAsset[] array2 = this.barImageAssets;
            for (int j = 0; j < array2.Length; j++)
            {
                ImageAsset imageAsset2 = array2[j];
                imageAsset2.Dispose();
            }
            ImageAsset[,] array3 = this.handleImageAssets;
            int upperBound  = array3.GetUpperBound(0);
            int upperBound2 = array3.GetUpperBound(1);

            for (int k = array3.GetLowerBound(0); k <= upperBound; k++)
            {
                for (int l = array3.GetLowerBound(1); l <= upperBound2; l++)
                {
                    ImageAsset imageAsset3 = array3[k, l];
                    imageAsset3.Dispose();
                }
            }
            base.DisposeSelf();
        }
예제 #5
0
 public PopupList()
 {
     this.backgroundImages                = new ImageAsset[3];
     this.backgroundImages[0]             = new ImageAsset(SystemImageAsset.PopupListBackgroundNormal);
     this.backgroundImages[1]             = new ImageAsset(SystemImageAsset.PopupListBackgroundPressed);
     this.backgroundImages[2]             = new ImageAsset(SystemImageAsset.PopupListBackgroundDisabled);
     this.backgroundNinePatch             = AssetManager.GetNinePatchMargin(SystemImageAsset.PopupListBackgroundNormal);
     this.itemSelectedImageAsset          = new ImageAsset(SystemImageAsset.PopupListItemFocus);
     this.itemSelectedImageColor          = new UIColor(0.9f, 0.9f, 0.9f, 1f);
     this.itemSelectedImageNinePatch      = AssetManager.GetNinePatchMargin(SystemImageAsset.PopupListItemFocus);
     this.backGroundImage                 = new ImageBox();
     this.backGroundImage.Image           = this.backgroundImages[0];
     this.backGroundImage.NinePatchMargin = this.backgroundNinePatch;
     this.backGroundImage.ImageScaleType  = ImageScaleType.NinePatch;
     this.backGroundImage.TouchResponse   = false;
     base.AddChildLast(this.backGroundImage);
     this.selectedLabel   = new Label();
     this.selectedLabel.X = 10f;
     this.selectedLabel.HorizontalAlignment = HorizontalAlignment.Left;
     this.selectedLabel.TextTrimming        = TextTrimming.EllipsisCharacter;
     this.selectedLabel.LineBreak           = LineBreak.AtCode;
     this.selectedLabel.Text          = "";
     this.selectedLabel.TouchResponse = false;
     base.AddChildLast(this.selectedLabel);
     this.ListTitle              = "";
     this.listItems              = new PopupListItemCollection();
     this.listItems.ItemChanged += new EventHandler(this.HandleListItemsItemChanged);
     this.PriorityHit            = true;
     this.dialogMinWidth         = (float)UISystem.FramebufferWidth * 0.5f;
     this.dialogMaxWidth         = (float)UISystem.FramebufferWidth * 0.9f;
     this.dialogMinHeight        = 110f;
     this.dialogMaxHeight        = (float)UISystem.FramebufferHeight * 0.9f;
     this.Width  = 360f;
     this.Height = 56f;
 }
예제 #6
0
        protected override void OnStart()
        {
            ImageAsset currentSceneRenderedImage = base.GetCurrentSceneRenderedImage();

            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;
            unit.X             = (float)(-(float)UISystem.FramebufferWidth) / 2f;
            unit.Y             = (float)(-(float)UISystem.FramebufferHeight) / 2f;
            this.currentSprt.X = (float)UISystem.FramebufferWidth / 2f;
            this.currentSprt.Y = (float)UISystem.FramebufferHeight / 2f;
            base.TransitionUIElement.AddChildLast(this.currentSprt);
            this.pivotOffsetX       = (float)UISystem.FramebufferWidth / 2f;
            this.pivotOffsetY       = (float)UISystem.FramebufferHeight / 2f;
            this.fromX              = 0f;
            this.fromY              = 0f;
            this.outsideMargin      = (float)Math.Sqrt((double)(this.pivotOffsetX * this.pivotOffsetX + this.pivotOffsetY * this.pivotOffsetY));
            this.targetRadianSpeed  = 0f;
            this.targetRadian       = 0f;
            this.targetOffsetXSpeed = 0f;
            this.targetOffsetX      = 0f;
            this.targetOffsetYSpeed = 0f;
            this.targetOffsetY      = 0f;
            this.T        = 40f;
            this.leftTime = this.T / (14f + 4f * (float)this.rand.NextDouble());
            this.setupLeftPos();
        }
예제 #7
0
        protected override void OnStart()
        {
            ImageAsset currentSceneRenderedImage = base.GetCurrentSceneRenderedImage();

            this.sprtCurrent            = new UISprite(1);
            this.sprtCurrent.Image      = currentSceneRenderedImage;
            this.sprtCurrent.ShaderType = ShaderType.OffscreenTexture;
            this.sprtCurrent.BlendMode  = BlendMode.Premultiplied;
            this.sprtCurrent.Alpha      = DefaultNavigationTransition.maxAlpha;
            this.sprtCurrent.Visible    = true;
            base.TransitionUIElement.AddChildLast(this.sprtCurrent);
            UISpriteUnit unit = this.sprtCurrent.GetUnit(0);

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

            this.sprtNext            = new UISprite(1);
            this.sprtNext.Image      = nextSceneRenderedImage;
            this.sprtNext.ShaderType = ShaderType.OffscreenTexture;
            this.sprtNext.BlendMode  = BlendMode.Premultiplied;
            this.sprtNext.Alpha      = DefaultNavigationTransition.minAlpha;
            this.sprtNext.Visible    = true;
            base.TransitionUIElement.AddChildLast(this.sprtNext);
            unit        = this.sprtNext.GetUnit(0);
            unit.Width  = (float)UISystem.FramebufferWidth;
            unit.Height = (float)UISystem.FramebufferHeight;
        }
예제 #8
0
 public CustomButtonImageSettings()
 {
     this.backgroundNormalImage     = null;
     this.backgroundPressedImage    = null;
     this.backgroundDisabledImage   = null;
     this.backgroundNinePatchMargin = NinePatchMargin.Zero;
     this.ValueChanged = null;
 }
 public CustomCheckBoxImageSettings()
 {
     this.NormalUncheckedImage   = null;
     this.NormalCheckedImage     = null;
     this.PressedUncheckedImage  = null;
     this.PressedCheckedImage    = null;
     this.DisabledUncheckedImage = null;
     this.DisabledCheckedImage   = null;
     this.ValueChanged           = null;
 }
예제 #10
0
            private ImageBox CreateBitmap(UIAnimationPlayer.UIAnimationData.Bitmap bitmapData)
            {
                Texture2D texture2D = new Texture2D((int)bitmapData.header.width, (int)bitmapData.header.height, false, (PixelFormat)1);

                texture2D.SetPixels(0, bitmapData.rawData);
                ImageAsset imageAsset = new ImageAsset(texture2D);

                return(new ImageBox
                {
                    Image = imageAsset,
                    Width = (float)imageAsset.Width,
                    Height = (float)imageAsset.Height
                });
            }
예제 #11
0
 protected override void DisposeSelf()
 {
     ImageAsset[] array = this.backgroundImages;
     for (int i = 0; i < array.Length; i++)
     {
         ImageAsset imageAsset = array[i];
         imageAsset.Dispose();
     }
     if (this.itemSelectedImageAsset != null)
     {
         this.itemSelectedImageAsset.Dispose();
     }
     base.DisposeSelf();
 }
예제 #12
0
 protected override void DisposeSelf()
 {
     if (this.activeImage != null)
     {
         this.activeImage.Dispose();
         this.activeImage = null;
     }
     if (this.normalImage != null)
     {
         this.normalImage.Dispose();
         this.normalImage = null;
     }
     base.DisposeSelf();
 }
예제 #13
0
        private void unsetTexture()
        {
            this.animationSprt.Visible = false;
            this.frontPanel.Visible    = true;
            this.texImage = null;
            Dictionary <string, float[]> arg_37_0 = this.animationSprt.ShaderUniforms;
            string arg_37_1 = "u_touchCoord";

            float[] array = new float[2];
            arg_37_0[arg_37_1] = array;
            Dictionary <string, float[]> arg_54_0 = this.animationSprt.ShaderUniforms;
            string arg_54_1 = "u_tension";

            float[] array2 = new float[2];
            arg_54_0[arg_54_1] = array2;
        }
예제 #14
0
파일: Dialog.cs 프로젝트: weimingtom/Sakura
 private void updateSprite()
 {
     if (this.bgImageSprt != null && this.bgColorSprt != null)
     {
         this.needUpdateSprite = false;
         if (this.backgroundStyle == DialogBackgroundStyle.Default)
         {
             this.bgColorSprt.Visible = false;
             this.bgImageSprt.Visible = true;
             if (this.defaultImageAsset == null)
             {
                 this.defaultImageAsset = new ImageAsset(SystemImageAsset.DialogBackground);
             }
             this.bgImageSprt.Image = this.defaultImageAsset;
             UISpriteUtility.SetupNinePatch(this.bgImageSprt, this.Width, this.Height, 0f, 0f, AssetManager.GetNinePatchMargin(SystemImageAsset.DialogBackground));
         }
         else
         {
             UISpriteUnit unit = this.bgColorSprt.GetUnit(0);
             unit.Color = this.customBackgroundColor;
             unit.SetSize(this.Width, this.Height);
             this.bgColorSprt.Visible = true;
             if (this.customBackgroundImage == null)
             {
                 this.bgImageSprt.Image   = null;
                 this.bgImageSprt.Visible = false;
             }
             else if (this.customBackgroundImage.Ready)
             {
                 this.bgImageSprt.Image   = this.customBackgroundImage;
                 this.bgImageSprt.Visible = true;
                 UISpriteUtility.SetupNinePatch(this.bgImageSprt, this.Width, this.Height, 0f, 0f, this.customBackgroundNinePatchMargin);
             }
             else
             {
                 this.bgImageSprt.Visible = false;
                 this.needUpdateSprite    = true;
             }
         }
         for (int i = 0; i < this.bgImageSprt.UnitCount; i++)
         {
             UISpriteUnit unit2 = this.bgImageSprt.GetUnit(i);
             unit2.Color = this.backgroundFilterColor;
         }
     }
 }
예제 #15
0
 static SpinBox()
 {
     SpinBox.visibleCount = 5;
     SpinBox.noonText     = new string[]
     {
         "AM",
         "PM"
     };
     SpinBox.separatorCharactor = new string[]
     {
         "/",
         ":"
     };
     SpinBox.backgraundImage          = new ImageAsset(SystemImageAsset.SpinBoxBase);
     SpinBox.centerImage              = new ImageAsset(SystemImageAsset.SpinBoxCenter);
     SpinBox.backgroundImageNinePatch = AssetManager.GetNinePatchMargin(SystemImageAsset.SpinBoxBase);
     SpinBox.centerImageNinePatch     = AssetManager.GetNinePatchMargin(SystemImageAsset.SpinBoxCenter);
 }
예제 #16
0
        private void setTexture()
        {
            float num;
            float num2;

            if (this.needPartialTexture)
            {
                num  = FMath.Min(this.frontPanel.Width, this.MaxTextureWidth) * UISystem.Scale;
                num2 = FMath.Min(this.frontPanel.Height, this.MaxTextureHeight) * UISystem.Scale;
            }
            else
            {
                num  = this.frontPanel.Width * UISystem.Scale;
                num2 = this.frontPanel.Height * UISystem.Scale;
            }
            if (this.cacheTexture == null || this.cacheTexture.Width != (int)num || this.cacheTexture.Height != (int)num2)
            {
                if (this.cacheTexture != null)
                {
                    this.cacheTexture.Dispose();
                }
                this.cacheTexture = new Texture2D((int)num, (int)num2, false, (PixelFormat)1, (PixelBufferOption)1);
            }
            Matrix4     matrix      = new Matrix4(1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f, 0f, -this.textureOffsetX, -this.textureOffsetY, 0f, 1f);
            FrameBuffer frameBuffer = new FrameBuffer();

            frameBuffer.SetColorTarget(this.cacheTexture, 0);
            this.frontPanel.RenderToFrameBuffer(frameBuffer, ref matrix, true);
            frameBuffer.Dispose();
            if (this.animationSprt.Image != null)
            {
                this.animationSprt.Image.Dispose();
            }
            this.animationSprt.Image = new ImageAsset(this.cacheTexture);
            this.animationSprt.Image.AdjustScaledSize = true;
            this.texImage = this.animationSprt.Image;
            this.animationSprt.Visible = true;
            this.frontPanel.Visible    = false;
        }
예제 #17
0
파일: Button.cs 프로젝트: weimingtom/Sakura
 private void UpdateBackgroundSprite()
 {
     if ((this.updateFlags & Button.UpdateFlags.Background) == Button.UpdateFlags.Background)
     {
         this.updateFlags &= ~Button.UpdateFlags.Background;
         ImageAsset imageAsset = this.backgroundImages[(int)this.Style, (int)this.State];
         if (imageAsset == null)
         {
             this.backgroundPrim.Image   = null;
             this.backgroundPrim.Visible = true;
             return;
         }
         if (imageAsset.Ready)
         {
             this.backgroundPrim.Image       = imageAsset;
             this.backgroundPrim.VertexCount = 9;
             this.backgroundPrim.Visible     = true;
             UIPrimitiveUtility.SetupNinePatch(this.backgroundPrim, this.Width, this.Height, 0f, 0f, this.backgroundNinePatchs[(int)this.Style]);
             return;
         }
         this.backgroundPrim.Visible = false;
         this.updateFlags           |= Button.UpdateFlags.Background;
     }
 }
예제 #18
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;
            }
        }
예제 #19
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();
        }
예제 #20
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;
        }
예제 #21
0
        public ImageAsset DrawText(ref string text, int width, int height)
        {
            //FIXME:这里写入内存位图
            ImageColor imageColor  = new ImageColor((int)(TextRenderHelper.DefaultBackgroundColor.R * 255f), (int)(TextRenderHelper.DefaultBackgroundColor.G * 255f), (int)(TextRenderHelper.DefaultBackgroundColor.B * 255f), (int)(TextRenderHelper.DefaultBackgroundColor.A * 255f));
            ImageColor imageColor2 = new ImageColor((int)(TextRenderHelper.DefaultTextColor.R * 255f), (int)(TextRenderHelper.DefaultTextColor.G * 255f), (int)(TextRenderHelper.DefaultTextColor.B * 255f), (int)(TextRenderHelper.DefaultTextColor.A * 255f));
            bool       flag        = string.IsNullOrEmpty(text);

            if (UISystem.Scaled)
            {
                width  = (int)((float)width * UISystem.Scale);
                height = (int)((float)height * UISystem.Scale);
            }
            if (width <= 0)
            {
                width = 1;
                flag  = true;
            }
            if (height <= 0)
            {
                height = 1;
                flag   = true;
            }
            int maxTextureSize = UISystem.GraphicsContext.Caps.MaxTextureSize;

            if (width > maxTextureSize)
            {
                width = maxTextureSize;
            }
            if (height > maxTextureSize)
            {
                height = maxTextureSize;
            }
            Image      image = new Image(ImageMode.A /*(ImageMode)1*/, new ImageSize(width, height), imageColor);
            ImageAsset imageAsset;

            if (flag)
            {
                imageAsset = new ImageAsset(image, (PixelFormat)10);
                image.Dispose();
                imageAsset.AdjustScaledSize = true;
                return(imageAsset);
            }
            List <string> list = this.SplitText(new StringBuilder(text), (float)width, (float)height);
            float         num  = this.GetMultiLineHeight(list.Count) - this.verticalOffset;
            float         num2 = 0f;

            switch (this.VerticalAlignment)
            {
            case VerticalAlignment.Top:
                num2 = 0f;
                break;

            case VerticalAlignment.Middle:
                num2 = ((float)height - num + (float)this.Font.Metrics.Descent) / 2f - 0.001f;
                break;

            case VerticalAlignment.Bottom:
                num2 = (float)height - num;
                break;
            }
            using (List <string> .Enumerator enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    string current = enumerator.Current;
                    float  num3    = this.GetLineWidth(current) - this.horizontalOffset;
                    float  num4    = 0f;
                    switch (this.HorizontalAlignment)
                    {
                    case HorizontalAlignment.Left:
                        num4 = 0f;
                        break;

                    case HorizontalAlignment.Center:
                        num4 = ((float)width - num3) / 2f;
                        break;

                    case HorizontalAlignment.Right:
                        num4 = (float)width - num3;
                        break;
                    }
                    image.DrawText(current, imageColor2, this.Font, new ImagePosition((int)(num4 + this.horizontalOffset), (int)(num2 + this.verticalOffset)));
                    num2 += this.LineHeight + this.lineGap;
                }
            }
            //image.__saveToFile("a.png"); //FIXME:调试看是否正确
            imageAsset = new ImageAsset(image, PixelFormat.Alpha);            //(PixelFormat)10);
            imageAsset.AdjustScaledSize = true;
            image.Dispose();
            return(imageAsset);
        }
예제 #22
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;
        }