Beispiel #1
0
        int Calc_Innates(Spirit spirit, Graphics graphics, Rectangle bounds, int margin)
        {
            int   columnCount          = spirit.InnatePowers.Length <= 4 ? 2 : 3;
            float textHeightMultiplier = spirit.InnatePowers.Length <= 4 ? 0.033f : 0.042f;             // if we go to 3 columns, text needs to be larger.

            // Calc: Layout
            int maxBottom    = bounds.Top;
            var innateBounds = bounds.SplitHorizontallyIntoColumns(margin, columnCount);

            for (int i = 0; i < spirit.InnatePowers.Length; ++i)
            {
                var       power        = spirit.InnatePowers[i];
                Rectangle singleBounds = innateBounds[i % columnCount];

                var innateLayout = new InnateLayout(power, singleBounds.X, singleBounds.Y, singleBounds.Width, textHeightMultiplier, graphics);
                innateLayouts[power] = innateLayout;

                // Scooch this box down so we can put next one there
                int shift = innateLayout.Bounds.Height + 5;
                innateBounds[i % columnCount].Height -= shift;
                innateBounds[i % columnCount].Y      += shift;

                // Track bottom of both columns
                maxBottom = Math.Max(maxBottom, innateLayout.Bounds.Bottom);
            }

            return(maxBottom - bounds.Top);
        }
Beispiel #2
0
 public InnatePainter(InnatePower power, InnateLayout layout)
 {
     this.power  = power;
     this.layout = layout;
 }