コード例 #1
0
        private void PanelSizeChanged(object sender, Windows.UI.Xaml.SizeChangedEventArgs e)
        {
            UIElement element = sender as UIElement;

            element.Clip = new RectangleGeometry()
            {
                Rect = new Rect(0, 0, e.NewSize.Width, e.NewSize.Height)
            };

            ShadowSide side = this.ShadowSide;

            float width  = (float)this.ActualWidth;
            float height = (float)this.ActualHeight;

            if (side == ShadowSide.Left)
            {
                _dropShadow.Offset = new Vector3(2.5f - width, 0, 0);
            }
            else if (side == ShadowSide.Right)
            {
                _dropShadow.Offset = new Vector3(width - 2.5f, 0, 0); // 2.5f
            }
            else if (side == ShadowSide.Top)
            {
                _dropShadow.Offset = new Vector3(0, 2.5f - height, 0);
            }
            else if (side == ShadowSide.Bottom)
            {
                _dropShadow.Offset = new Vector3(0, height - 2.5f, 0);
            }

            _shadowVisual.Size = new Vector2((float)this.ActualWidth, (float)this.ActualHeight);
        }
コード例 #2
0
ファイル: EditorShadow.cs プロジェクト: theboot999/Bushfire
 public EditorShadow(int shadowId, int tileX, int tileY, int shadowOffsetX, int shadowOffsetY, ShadowSide shadowSide)
 {
     this.shadowId      = shadowId;
     this.tileX         = tileX;
     this.tileY         = tileY;
     this.shadowOffsetX = shadowOffsetX;
     this.shadowOffsetY = shadowOffsetY;
     this.shadowSide    = shadowSide;
 }
コード例 #3
0
ファイル: Shadow.cs プロジェクト: theboot999/Bushfire
 public Shadow(Sprite sprite, int tileX, int tileY, ShadowSide shadowSide, int shadowId, Point shadowOffset)
 {
     this.sprite       = sprite;
     this.tileX        = tileX;
     this.tileY        = tileY;
     this.shadowId     = shadowId;
     this.shadowSide   = shadowSide;
     this.shadowOffset = shadowOffset;
 }
コード例 #4
0
 public void RemoveShadowPiece(Spot spot, ShadowSide shadowSide)
 {
     if (spot != null)
     {
         for (int i = shadowList.Count - 1; i >= 0; i--)
         {
             if (shadowList[i].tileX == spot.x && shadowList[i].tileY == spot.y && shadowList[i].shadowSide == shadowSide)
             {
                 shadowList.RemoveAt(i);
             }
         }
     }
 }
コード例 #5
0
        public static Point GetShadowTileSize(MapObjectShadowType mapObjectShadowType, ShadowSide shadowSide, int index)
        {
            Sprite sprite = spriteMapobjectList[mapObjectShadowType][shadowSide][index];

            return(new Point(sprite.location.Width, sprite.location.Height));
        }
コード例 #6
0
 public static Sprite GetShadowSprite(MapObjectShadowType mapObjectShadowType, ShadowSide shadowSide, int index)
 {
     return(spriteMapobjectList[mapObjectShadowType][shadowSide][index]);
 }
コード例 #7
0
ファイル: DrawingUtils.cs プロジェクト: sabrogden/logjoint
        public void Draw(Graphics g, Rectangle r, ShadowSide sides)
        {
            if (!IsValidRectToDrawShadow(r))
            {
                throw new ArgumentException("Rect is too small", "r");
            }

            r.Inflate(-2, -2);

            if ((sides & ShadowSide.Middle) != 0)
            {
                g.FillRectangle(inner, r);
            }

            if ((sides & ShadowSide.Top) != 0)
            {
                g.FillRectangle(border1, r.Left, r.Top - 1, r.Width, 1);
                g.FillRectangle(border2, r.Left, r.Top - 2, r.Width, 1);
            }
            if ((sides & ShadowSide.Right) != 0)
            {
                g.FillRectangle(border1, r.Right, r.Top, 1, r.Height);
                g.FillRectangle(border2, r.Right + 1, r.Top, 1, r.Height);
            }
            if ((sides & ShadowSide.Bottom) != 0)
            {
                g.FillRectangle(border1, r.Left, r.Bottom, r.Width, 1);
                g.FillRectangle(border2, r.Left, r.Bottom + 1, r.Width, 1);
            }
            if ((sides & ShadowSide.Left) != 0)
            {
                g.FillRectangle(border1, r.Left - 1, r.Top, 1, r.Height);
                g.FillRectangle(border2, r.Left - 2, r.Top, 1, r.Height);
            }

            if ((sides & ShadowSide.Left) != 0 && (sides & ShadowSide.Top) != 0)
            {
                g.FillRectangle(edge1, r.Left - 1, r.Top - 1, 1, 1);
                g.FillRectangle(edge2, r.Left - 2, r.Top - 1, 1, 1);
                g.FillRectangle(edge2, r.Left - 1, r.Top - 2, 1, 1);
                g.FillRectangle(edge3, r.Left - 2, r.Top - 2, 1, 1);
            }

            if ((sides & ShadowSide.Top) != 0 && (sides & ShadowSide.Right) != 0)
            {
                g.FillRectangle(edge1, r.Right, r.Top - 1, 1, 1);
                g.FillRectangle(edge2, r.Right, r.Top - 2, 1, 1);
                g.FillRectangle(edge2, r.Right + 1, r.Top - 1, 1, 1);
                g.FillRectangle(edge3, r.Right + 1, r.Top - 2, 1, 1);
            }

            if ((sides & ShadowSide.Right) != 0 && (sides & ShadowSide.Bottom) != 0)
            {
                g.FillRectangle(edge1, r.Right, r.Bottom, 1, 1);
                g.FillRectangle(edge2, r.Right + 1, r.Bottom, 1, 1);
                g.FillRectangle(edge2, r.Right, r.Bottom + 1, 1, 1);
                g.FillRectangle(edge3, r.Right + 1, r.Bottom + 1, 1, 1);
            }

            if ((sides & ShadowSide.Bottom) != 0 && (sides & ShadowSide.Left) != 0)
            {
                g.FillRectangle(edge1, r.Left - 1, r.Bottom, 1, 1);
                g.FillRectangle(edge2, r.Left - 1, r.Bottom + 1, 1, 1);
                g.FillRectangle(edge2, r.Left - 2, r.Bottom, 1, 1);
                g.FillRectangle(edge3, r.Left - 2, r.Bottom + 1, 1, 1);
            }
        }