Beispiel #1
0
        public void UpdateRects(int rowHeight, int columnWidth)
        {
            List <Rectangle> boundingRects = new List <Rectangle>();

            foreach (SpellButton button in SpellButtons)
            {
                button.ImageButton.LocalBounds = new Rectangle((button.Y - 1) * columnWidth, (button.X + 1) * rowHeight, button.ImageButton.LocalBounds.Width, button.ImageButton.LocalBounds.Height);
                boundingRects.Add(button.ImageButton.LocalBounds);
            }
            MainPanel.LocalBounds = MathFunctions.GetBoundingRectangle(boundingRects);
        }
Beispiel #2
0
        public Rectangle GetGlobalRectOfRow(int row)
        {
            List <Rectangle> rects = new List <Rectangle>();
            int w     = LocalBounds.Width - EdgePadding;
            int h     = LocalBounds.Height - EdgePadding;
            int cellX = w / Cols;
            int cellY = h / Rows;

            foreach (KeyValuePair <Rectangle, GUIComponent> comp in ComponentPositions)
            {
                if (comp.Value == null)
                {
                    continue;
                }

                if (comp.Key.Y != row)
                {
                    continue;
                }

                if (HasOffset(comp.Value))
                {
                    Point offset = GetOffset(comp.Value);
                    rects.Add(new Rectangle(
                                  comp.Key.X * cellX + offset.X,
                                  comp.Key.Y * cellY + offset.Y,
                                  comp.Key.Width * cellX,
                                  comp.Key.Height * cellY));
                }
                else
                {
                    int lw = comp.Key.Width * cellX - 10;
                    int lh = comp.Key.Height * cellY - 10;
                    int lx = comp.Key.X * cellX + EdgePadding;
                    int ly = comp.Key.Y * cellY + EdgePadding;
                    if (lx + lw > w)
                    {
                        lw = (w - lx);
                    }

                    if (ly + lh > h)
                    {
                        lh = (h - ly);
                    }
                    rects.Add(new Rectangle(lx, ly, lw, lh));
                }
            }

            Rectangle bound = MathFunctions.GetBoundingRectangle(rects);

            bound.X += GlobalBounds.X;
            bound.Y += GlobalBounds.Y;
            return(bound);
        }
        void UpdateLayout()
        {
            List <Rectangle> rects = new List <Rectangle>();
            int i = 0;

            foreach (AnnouncementView view in AnnouncementViews)
            {
                view.LocalBounds = new Rectangle(0, -(LocalBounds.Height / 2) * i, LocalBounds.Width, LocalBounds.Height / 2 - 7);
                rects.Add(view.LocalBounds);
                i++;
            }
            if (AnnouncementViews.Count > 0)
            {
                SpeechBubble.LocalBounds = MathFunctions.GetBoundingRectangle(rects);
            }
        }