示例#1
0
        /// <summary>
        /// Updates additional UI used to highlight objects, such
        /// as a solid rectangle for highlighted containers or overlaying
        /// an additive Sprite over the highlighted Sprite
        /// </summary>
        public void UpdateHighlightObjects()
        {
            if (HighlightedSprite != null)
            {
                mOverlaySprite.Visible = true;
                mOverlaySprite.X       = HighlightedSprite.GetAbsoluteX();
                mOverlaySprite.Y       = HighlightedSprite.GetAbsoluteY();

                mOverlaySprite.Width   = HighlightedSprite.Width;
                mOverlaySprite.Height  = HighlightedSprite.Height;
                mOverlaySprite.Texture = HighlightedSprite.Texture;


                mOverlaySprite.Wrap = HighlightedSprite.Wrap;

                mOverlaySprite.SourceRectangle = HighlightedSprite.SourceRectangle;

                mOverlaySprite.FlipHorizontal = HighlightedSprite.FlipHorizontal;
                mOverlaySprite.FlipVertical   = HighlightedSprite.FlipVertical;

                mOverlaySprite.Rotation = HighlightedSprite.Rotation;
            }
            else if (HighlightedNineSlice != null)
            {
                SetNineSliceOverlay();
            }
            else if (HighlightedLineRectangle != null)
            {
                SolidRectangle overlay = mOverlaySolidRectangle;

                overlay.Visible = true;
                overlay.X       = HighlightedLineRectangle.GetAbsoluteX();
                overlay.Y       = HighlightedLineRectangle.GetAbsoluteY();

                overlay.Width  = HighlightedLineRectangle.Width;
                overlay.Height = HighlightedLineRectangle.Height;

                overlay.Rotation = HighlightedLineRectangle.Rotation;
            }
            else if (HighlightedLinePolygon != null)
            {
                // todo - finish here
                var overlay = mOverlayLinePolygon;
                overlay.Visible = true;
                overlay.X       = HighlightedLinePolygon.GetAbsoluteX();
                overlay.Y       = HighlightedLinePolygon.GetAbsoluteY();

                List <Vector2> points = new List <Vector2>();
                // todo - set points here:
                for (int i = 0; i < HighlightedLinePolygon.PointCount; i++)
                {
                    points.Add(HighlightedLinePolygon.PointAt(i));
                }

                overlay.SetPoints(points);

                overlay.Rotation = HighlightedLinePolygon.Rotation;
            }
        }
示例#2
0
        /// <summary>
        /// Updates additional UI used to highlight objects, such
        /// as a solid rectangle for highlighted containers or overlaying
        /// an additive Sprite over the highlighted Sprite
        /// </summary>
        private void UpdateHighlightObjects()
        {
            if (HighlightedSprite != null)
            {
                mOverlaySprite.Visible = true;
                mOverlaySprite.X       = HighlightedSprite.GetAbsoluteX();
                mOverlaySprite.Y       = HighlightedSprite.GetAbsoluteY();

                mOverlaySprite.Width   = HighlightedSprite.Width;
                mOverlaySprite.Height  = HighlightedSprite.Height;
                mOverlaySprite.Texture = HighlightedSprite.Texture;


                mOverlaySprite.Wrap = HighlightedSprite.Wrap;

                mOverlaySprite.SourceRectangle = HighlightedSprite.SourceRectangle;

                mOverlaySprite.FlipHorizontal = HighlightedSprite.FlipHorizontal;
                mOverlaySprite.FlipVertical   = HighlightedSprite.FlipVertical;
            }
            else if (HighlightedNineSlice != null)
            {
                mOverlayNineSlice.Visible = true;
                mOverlayNineSlice.X       = HighlightedNineSlice.GetAbsoluteX();
                mOverlayNineSlice.Y       = HighlightedNineSlice.GetAbsoluteY();

                mOverlayNineSlice.Width           = HighlightedNineSlice.Width;
                mOverlayNineSlice.Height          = HighlightedNineSlice.Height;
                mOverlayNineSlice.TopLeftTexture  = HighlightedNineSlice.TopLeftTexture;
                mOverlayNineSlice.TopTexture      = HighlightedNineSlice.TopTexture;
                mOverlayNineSlice.TopRightTexture = HighlightedNineSlice.TopRightTexture;

                mOverlayNineSlice.LeftTexture   = HighlightedNineSlice.LeftTexture;
                mOverlayNineSlice.CenterTexture = HighlightedNineSlice.CenterTexture;
                mOverlayNineSlice.RightTexture  = HighlightedNineSlice.RightTexture;

                mOverlayNineSlice.BottomLeftTexture  = HighlightedNineSlice.BottomLeftTexture;
                mOverlayNineSlice.BottomTexture      = HighlightedNineSlice.BottomTexture;
                mOverlayNineSlice.BottomRightTexture = HighlightedNineSlice.BottomRightTexture;

                mOverlayNineSlice.Red   = HighlightedNineSlice.Red;
                mOverlayNineSlice.Green = HighlightedNineSlice.Green;
                mOverlayNineSlice.Blue  = HighlightedNineSlice.Blue;
            }
            else if (HighlightedLineRectangle != null)
            {
                SolidRectangle overlay = mOverlaySolidRectangle;

                overlay.Visible = true;
                overlay.X       = HighlightedLineRectangle.GetAbsoluteX();
                overlay.Y       = HighlightedLineRectangle.GetAbsoluteY();

                overlay.Width  = HighlightedLineRectangle.Width;
                overlay.Height = HighlightedLineRectangle.Height;
            }
        }