예제 #1
0
        public void Draw(IPainter <TVertex, TBox> painter, ISelector <TVertex, TBox> selector)
        {
            // Set reference to external painter object (only for cell Update)
            lastPainter = painter;
            // Basic cell visual data
            painter.FillPolygon(vertices, GetBackFillType());
            if (UseEffect3D && Closed && !IsSelected)
            {
                painter.DrawBorder3D(verticesEffect3D);
            }            //else
            painter.DrawPolygon(vertices);
            // Adding this cell to selector if needed
            if (selector != null)
            {
                selector.AddCell(this, vertices);
            }
            // Other common cell visual data
            TVertex center      = Center;
            TBox    internalBox = GetInternalBox(InternalBoxCoefficient);

            if (!Closed)
            {
                if (HasMine)
                {
                    if (!IsLabelState)
                    {
                        painter.DrawMine(center, internalBox, true);
                    }
                }
                else
                {
                    switch (State)
                    {
                    case CellState.Label:
                        painter.DrawMine(center, internalBox, false);
                        break;

                    case CellState.Normal:
                        if (MinesNumber != 0)
                        {
                            painter.DrawInteger(center, internalBox, MinesNumber);
                        }
                        break;
                    }
                }
            }
            else                // closed
            {
                switch (State)
                {
                case CellState.Undefined:
                    painter.DrawUndefined(center, internalBox);
                    break;

                case CellState.Label:
                    painter.DrawLabel(center, internalBox);
                    break;
                }
            }
        }