Beispiel #1
0
        public void RefreshUISize(bool refreshRectangle = true)
        {
            int     fX    = 0;
            int     fY    = 0;
            float   currX = 0;
            float   currY = 0;
            Vector2 vUIISize;

            switch (uIAlignment)
            {
            case Toolbox.UIAlignment.Vertical:
                foreach (var UII in uiItems)
                {
                    if (UII.Visible)
                    {
                        vUIISize = UII.GetSize();
                        UII.UpdateSpecs(Position, new Vector2(currX, currY), vUIISize);
                        if (fX < vUIISize.X)
                        {
                            fX = (int)vUIISize.X;
                        }
                        fY    += (int)vUIISize.Y;
                        currY += vUIISize.Y;
                    }
                }

                break;

            case Toolbox.UIAlignment.Horizontal:
                foreach (var UII in uiItems)
                {
                    if (UII.Visible)
                    {
                        vUIISize = UII.GetSize();
                        UII.UpdateSpecs(Position, new Vector2(currX, currY), vUIISize);
                        fX += (int)vUIISize.X;
                        if (fY < (int)vUIISize.Y)
                        {
                            fY = (int)vUIISize.Y;
                        }
                        currX += vUIISize.Y;
                    }
                }
                break;
            }
            Size = new Vector2(fX, fY);
            if (refreshRectangle)
            {
                RefreshRectangle();
            }
        }