コード例 #1
0
    void updateGrid()
    {
        // Remove old children from grid
        for (int y = 0; y < ShadowGrid.h; ++y)
        {
            for (int x = 0; x < ShadowGrid.w; ++x)
            {
                if (ShadowGrid.shadowGrid[x, y] != null)
                {
                    if (ShadowGrid.shadowGrid[x, y].parent == transform)
                    {
                        ShadowGrid.shadowGrid[x, y] = null;
                    }
                }
            }
        }


        Vector2 shadowGridPos = ShadowGrid.ShadowGridStart.transform.position - GameObject.Find("RemoteGame").transform.position;

        // Add new children to grid
        foreach (Transform child in transform)
        {
            Vector2 v = ShadowGrid.roundVec2(child.position) - shadowGridPos;
            ShadowGrid.shadowGrid[(int)v.x, (int)v.y] = child;
        }
    }
コード例 #2
0
ファイル: PlotArea.cs プロジェクト: tmpkus/openvss
        /// <summary>
        /// Apply shadow for PlotArea
        /// </summary>
        internal void ApplyShadow(Size plotAreaViewPortSize, Double plankOffset, Double plankDepth, Double plankThickness)
        {
            Chart._plotAreaShadowCanvas.Children.Clear();
            Chart._drawingCanvas.Children.Remove(InnerShadowGrid);
            Chart chart = Chart as Chart;
            Size clipSize;

            if (chart.PlotArea.ShadowEnabled)
            {
                if (chart.PlotDetails.ChartOrientation == ChartOrientationType.NoAxis)
                {
                    ShadowGrid = ExtendedGraphics.Get2DRectangleShadow(this, BorderElement.Width + Visifire.Charts.Chart.SHADOW_DEPTH
                    , BorderElement.Height + Visifire.Charts.Chart.SHADOW_DEPTH
                    , CornerRadius
                    , CornerRadius, 6);

                    clipSize = new Size(ShadowGrid.Width, ShadowGrid.Height);
                }
                else
                {
                    if (chart.View3D)
                    {
                        if (chart.PlotDetails.ChartOrientation == ChartOrientationType.Horizontal)
                        {
                            ShadowGrid = ExtendedGraphics.Get2DRectangleShadow(this, plotAreaViewPortSize.Width + Visifire.Charts.Chart.SHADOW_DEPTH - plankThickness - plankDepth - ChartArea.SCROLLVIEWER_OFFSET4HORIZONTAL_CHART
                            , plotAreaViewPortSize.Height - plankDepth + Visifire.Charts.Chart.SHADOW_DEPTH
                            , CornerRadius
                            , CornerRadius, 6);
                            clipSize = new Size(ShadowGrid.Width, ShadowGrid.Height + Visifire.Charts.Chart.SHADOW_DEPTH);

                            ShadowGrid.SetValue(Canvas.LeftProperty, plankOffset);

                            InnerShadowGrid = ExtendedGraphics.Get2DRectangleShadow(this, plotAreaViewPortSize.Width + Visifire.Charts.Chart.SHADOW_DEPTH - plankThickness - plankDepth - ChartArea.SCROLLVIEWER_OFFSET4HORIZONTAL_CHART
                           , BorderElement.Height + Visifire.Charts.Chart.SHADOW_DEPTH
                           , CornerRadius
                           , CornerRadius, 6);
                            InnerShadowGrid.Clip = GetShadowClip(new Size(InnerShadowGrid.Width + Visifire.Charts.Chart.SHADOW_DEPTH, InnerShadowGrid.Height));
                            InnerShadowGrid.SetValue(Canvas.LeftProperty, plankOffset);
                            Chart._drawingCanvas.Children.Add(InnerShadowGrid);
                        }
                        else
                        {
                            ShadowGrid = ExtendedGraphics.Get2DRectangleShadow(this, plotAreaViewPortSize.Width + Visifire.Charts.Chart.SHADOW_DEPTH - plankThickness - plankDepth
                                                   , plotAreaViewPortSize.Height + Visifire.Charts.Chart.SHADOW_DEPTH - plankOffset
                                                   , CornerRadius
                                                   , CornerRadius, 6);
                            clipSize = new Size(ShadowGrid.Width, ShadowGrid.Height);
                            ShadowGrid.SetValue(Canvas.LeftProperty, plankOffset);
                        }
                    }
                    else
                    {
                        ShadowGrid = ExtendedGraphics.Get2DRectangleShadow(this, plotAreaViewPortSize.Width + Charts.Chart.SHADOW_DEPTH
                            , plotAreaViewPortSize.Height - plankOffset + Visifire.Charts.Chart.SHADOW_DEPTH, CornerRadius
                            , CornerRadius
                            , 6);

                        clipSize = new Size(ShadowGrid.Width, ShadowGrid.Height);
                    }
                }

                ShadowGrid.Clip = GetShadowClip(clipSize);

                ShadowGrid.IsHitTestVisible = false;
                Chart._plotAreaShadowCanvas.Children.Add(ShadowGrid);
                ShadowGrid.UpdateLayout();
            }
        }