Example #1
0
        public void Paint(Graphics graphics, IList <GrowthOption> clickableGrowthOptions, IList <GrowthActionFactory> clickableGrowthActions)
        {
            this.graphics   = graphics;
            this.iconDrawer = new IconDrawer(graphics, new CachedImageDrawer());

            using var optionPen    = new Pen(Color.Blue, 6f);
            using var highlightPen = new Pen(Color.Red, 4f);

            if (cachedImageLayer == null)
            {
                cachedImageLayer = new Bitmap(layout.Bounds.Width, layout.Bounds.Height);
                using var g      = Graphics.FromImage(cachedImageLayer);
                g.TranslateTransform(-layout.Bounds.X, -layout.Bounds.Y);
                g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

                // Growth - Dividers
                bool first = true;
                foreach (var(opt, rect) in layout.EachGrowth())
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        g.DrawLine(optionPen, rect.Left, rect.Top, rect.Left, rect.Bottom);
                    }
                }

                this.graphics = g;

                // Growth Actions
                foreach (var(action, rect) in layout.EachAction())
                {
                    DrawAction(action, rect);
                }
            }
            graphics.DrawImage(cachedImageLayer, layout.Bounds);


            DrawHotspots(graphics, clickableGrowthOptions, clickableGrowthActions, highlightPen);
        }
Example #2
0
        void CalculateBackgroundImage()
        {
            cachedBackgroundImage = new Bitmap(this.metrics.OutterBounds.Width, this.metrics.OutterBounds.Height);

            using Graphics g = Graphics.FromImage(cachedBackgroundImage);
            g.TranslateTransform(-metrics.OutterBounds.X, -metrics.OutterBounds.Y);

            PaintLabels(g);
            var iconDrawer = new IconDrawer(g, imageDrawer);

            iconDrawer.DrawTheIcon(new IconDescriptor {
                BackgroundImg = Img.Coin
            }, metrics.BigCoin);

            foreach (var track in EnergyTrack)
            {
                iconDrawer.DrawTheIcon(track.Icon, metrics.SlotLookup[track].TrackRect);
            }

            foreach (var track in this.CardTrack)
            {
                iconDrawer.DrawTheIcon(track.Icon, metrics.SlotLookup[track].TrackRect);
            }
        }