Exemplo n.º 1
0
        void DrawKingdomCards(int x, int y)
        {
            g.DrawString("Kingdom cards", drawFont, blackBrush, 5, 4);

            Image  splitImage = Bitmap.FromFile(splitType);
            double splitRatio = (double)splitImage.Width / (double)splitImage.Height;

            g.DrawImage(splitImage, new Rectangle(163, 4, (int)(25.0 * splitRatio), 25), new Rectangle(0, 0, splitImage.Width, splitImage.Height), GraphicsUnit.Pixel);
            splitImage.Dispose();

            if (prosperity)
            {
                Image  prosperityImage = Bitmap.FromFile("data/ProsperityLogo.png");
                double ratio           = (double)prosperityImage.Width / (double)prosperityImage.Height;
                g.DrawImage(prosperityImage, new Rectangle(363, 4, (int)(25.0 * ratio), 25), new Rectangle(0, 0, prosperityImage.Width, prosperityImage.Height), GraphicsUnit.Pixel);
                prosperityImage.Dispose();
            }

            //if (parts.Contains("34Split")) splitType = "bin/34SplitSmall.png";
            //if (parts.Contains("25Split")) splitType = "bin/25SplitSmall.png";
            //prosperity = parts.Contains("Prosperity");

            const double cardRatio = 473.0 / 296.0;

            for (int cardIndex = 0; cardIndex < cards.Count; cardIndex++)
            {
                Card c = cards[cardIndex];
                if (c.fullImage == null)
                {
                    c.LoadBitmaps();
                }
                g.DrawImage(c.fullImage, new Rectangle(5 + cardIndex * 80, 35, (int)75.0, (int)(75.0 * cardRatio)), new Rectangle(0, 0, c.fullImage.Width, c.fullImage.Height), GraphicsUnit.Pixel);
            }
        }
Exemplo n.º 2
0
        void DrawStrategy(CardDatabase database, String s, string leaderName, bool displayRating, int x, int y)
        {
            //Leader 0:	4.18262	e1-d3-p4-gold@99|laboratory@3|militia@1|silver@99
            String[] parts = s.Split('\t');
            g.DrawString(leaderName, bigFont, blackBrush, x, y);

            x += 55;

            double d = Convert.ToDouble(parts[1]);

            g.DrawString(FormatPercentage(d), drawFont, PercentageBrush(d), x, y + 20);

            x += 90;

            int estateThreshold   = Convert.ToInt32(parts[2].Split('-')[0].Replace("e", ""));
            int duchyThreshold    = Convert.ToInt32(parts[2].Split('-')[1].Replace("d", ""));
            int provinceThreshold = Convert.ToInt32(parts[2].Split('-')[2].Replace("p", ""));

            if (prosperity)
            {
                Image  template = Bitmap.FromFile("data/prosperityBuyTemplate.png");
                double ratio    = (double)template.Height / (double)template.Width;
                g.DrawImage(template, new Rectangle(x, y, 120, (int)(120.0 * ratio)), new Rectangle(0, 0, template.Width, template.Height), GraphicsUnit.Pixel);
                template.Dispose();

                int yOffset  = -3;
                int ySpacing = 21;
                g.DrawString(estateThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset);
                g.DrawString(duchyThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset + ySpacing);
                g.DrawString(provinceThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset + ySpacing * 2);
            }
            else
            {
                Image  template = Bitmap.FromFile("data/coreBuyTemplate.png");
                double ratio    = (double)template.Height / (double)template.Width;
                g.DrawImage(template, new Rectangle(x, y, 120, (int)(120.0 * ratio)), new Rectangle(0, 0, template.Width, template.Height), GraphicsUnit.Pixel);
                template.Dispose();

                int yOffset  = 1;
                int ySpacing = 31;
                g.DrawString(estateThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset);
                g.DrawString(duchyThreshold.ToString(), drawFont, blackBrush, x + 60, y + yOffset + ySpacing);
            }

            x += 145;

            String[] cardParts = parts[2].Split('-')[3].Split('|');
            for (int cardIndex = 0; cardIndex < cardParts.Length; cardIndex++)
            {
                Card c     = database.GetCard(cardParts[cardIndex].Split('@')[0]);
                int  count = Convert.ToInt32(cardParts[cardIndex].Split('@')[1]);
                if (c.fullImage == null)
                {
                    c.LoadBitmaps();
                }
                double croppedCardRatio = 252.0 / 296.0;

                int yOffset = 0;
                if (c.set == "core")
                {
                    yOffset = 116;
                }
                g.DrawImage(c.fullImage, new Rectangle(x + cardIndex * 80, y, (int)75.0, (int)(75.0 * croppedCardRatio)), new Rectangle(0, yOffset, c.fullImage.Width, 252), GraphicsUnit.Pixel);

                //if (count > 1 && count < 99)
                if (count > 1)
                {
                    int xOffset = 25;
                    if (count >= 10)
                    {
                        xOffset = 17;
                    }
                    g.DrawString("x" + count.ToString(), smallFont, blackBrush, x + cardIndex * 80 + xOffset, y + 59);
                }
            }
        }