Пример #1
0
        private static Bitmap CreateBitmap(ImageOrientation orientation)
        {
            switch (orientation)
            {
            case ImageOrientation.Landscape:
                return(GraphicsUtilities.CreateBitmap(cardLongSideInPixelsWithBleed, cardShortSideInPixelsWithBleed));

            case ImageOrientation.Portrait:
                return(GraphicsUtilities.CreateBitmap(cardShortSideInPixelsWithBleed, cardLongSideInPixelsWithBleed));
            }
            return(null);
        }
Пример #2
0
        public static void PrintCardBackString(CardImage cardImage, string text, int textSize)
        {
            var graphics = cardImage.Graphics;
            var usableRectangleWithPadding = cardImage.UsableRectangWithPadding;

            GraphicsUtilities.DrawString(
                graphics,
                text,
                new Font(cardBackFontFamily, textSize, FontStyle.Bold, GraphicsUnit.Pixel),
                new SolidBrush(Color.Black),
                usableRectangleWithPadding,
                GraphicsUtilities.FullCenterAlignment);
        }
Пример #3
0
        private void PrintImageMapping(Graphics graphics, Image image1, string label1, Image image2, string label2, int x, int y, int imageSize)
        {
            var imageMappingFont = new Font(bodyFontFamily, bodyFontSize, GraphicsUnit.Pixel);
            var mappingTextWidth = imageSize + 2 * (arrowImageSize + 2 * ArrowPadding);
            var label1Rectangle  = new RectangleF(x - (arrowImageSize + 2 * ArrowPadding), y + imageSize, mappingTextWidth, imageMappingFont.Height);
            var label2Rectangle  = new RectangleF(x + imageSize + 2 * ArrowPadding + arrowImageSize - (arrowImageSize + 2 * ArrowPadding), y + imageSize, mappingTextWidth, imageMappingFont.Height);

            GraphicsUtilities.PrintScaledImage(graphics, image1, x, y, imageSize, imageSize);
            GraphicsUtilities.DrawString(graphics, label1, imageMappingFont, GraphicsUtilities.BlackBrush, label1Rectangle, GraphicsUtilities.HorizontalCenterAlignment);
            GraphicsUtilities.PrintScaledPng(graphics, "arrow", x + imageSize + ArrowPadding, y + (imageSize / 2), arrowImageSize, arrowImageSize);
            GraphicsUtilities.PrintScaledImage(graphics, image2, x + imageSize + ArrowPadding + arrowImageSize + ArrowPadding, y, imageSize, imageSize);
            GraphicsUtilities.DrawString(graphics, label2, imageMappingFont, GraphicsUtilities.BlackBrush, label2Rectangle, GraphicsUtilities.HorizontalCenterAlignment);
        }
Пример #4
0
        private void PrintToolImage(NewToolCard newCard, CardImage cardImage)
        {
            var graphics = cardImage.Graphics;
            var usableRectangWithPadding = cardImage.UsableRectangWithPadding;
            var cardFrontLargeImageSize  = usableRectangWithPadding.Width - (2 * cardFrontSmallImageSize);

            GraphicsUtilities.PrintScaledPng(
                graphics,
                newCard.Tool,
                usableRectangWithPadding.X + usableRectangWithPadding.Width / 2 - cardFrontLargeImageSize / 2,
                usableRectangWithPadding.Y + usableRectangWithPadding.Height / 2 - (cardFrontLargeImageSize / 2),
                cardFrontLargeImageSize,
                cardFrontLargeImageSize);
        }
Пример #5
0
        private void PrintCardName(NewToolCard newCard, CardImage cardImage)
        {
            var graphics = cardImage.Graphics;
            var usableRectangWithPadding = cardImage.UsableRectangWithPadding;

            var cardNameFont    = new Font(headerFontFamily, toolHeaderFontSize, GraphicsUnit.Pixel);
            var topRectangle    = new RectangleF(usableRectangWithPadding.X, usableRectangWithPadding.Y + cardFrontSmallImageSize, usableRectangWithPadding.Width, cardNameFont.Height);
            var bottomRectangle = new RectangleF(usableRectangWithPadding.X, usableRectangWithPadding.Y + cardFrontSmallImageSize + cardNameFont.Height, usableRectangWithPadding.Width, cardNameFont.Height);
            var nameParts       = newCard.Name.Split(' ');
            var firstNamePart   = nameParts.Take(nameParts.Length - 2).ToList();
            var lastNamePart    = nameParts.Skip(firstNamePart.Count).ToList();

            GraphicsUtilities.DrawString(graphics, string.Join(" ", firstNamePart), cardNameFont, GraphicsUtilities.BlackBrush, topRectangle, GraphicsUtilities.FullCenterAlignment);
            GraphicsUtilities.DrawString(graphics, string.Join(" ", lastNamePart), cardNameFont, GraphicsUtilities.BlackBrush, bottomRectangle, GraphicsUtilities.FullCenterAlignment);
        }
Пример #6
0
        private void PrintResourceProduced(NewToolCard newCard, Graphics graphics, int x, int y)
        {
            var font = new Font(bodyFontFamily, imageLabelFontSize);

            GraphicsUtilities.PrintImageWithText(
                graphics,
                newCard.ResourceProduced,
                x,
                y,
                cardFrontSmallImageSize,
                cardFrontSmallImageSize,
                "+",
                0,
                (int)(cardFrontSmallImageSize * (2.0 / 5)),
                font);
        }
Пример #7
0
        private void PrintLimitsReminder(CardImage cardImage)
        {
            var graphics = cardImage.Graphics;
            var usableRectangleWithPadding = cardImage.UsableRectangWithPadding;
            var handLimitString            = "Hand limit - 3";
            var resourceLimitString        = "Resource limit - 10";
            var limitsReminderFont         = new Font(bodyFontFamily, limitsFontSize, GraphicsUnit.Pixel);
            var textRectangle = new RectangleF(
                usableRectangleWithPadding.X,
                usableRectangleWithPadding.Bottom - limitsReminderFont.Height,
                usableRectangleWithPadding.Width,
                limitsReminderFont.Height);

            GraphicsUtilities.DrawString(graphics, handLimitString, limitsReminderFont, GraphicsUtilities.BlackBrush, textRectangle, GraphicsUtilities.HorizontalNearAlignment);
            GraphicsUtilities.DrawString(graphics, resourceLimitString, limitsReminderFont, GraphicsUtilities.BlackBrush, textRectangle, GraphicsUtilities.HorizontalFarAlignment);
        }
Пример #8
0
        private void PrintCostsForQuest(Graphics graphics, Quest quest, int initialX, int initialY)
        {
            var font = new Font(bodyFontFamily, imageLabelFontSize);

            for (var toolIndex = 0; toolIndex < quest.ToolRequirements.Count; toolIndex++)
            {
                GraphicsUtilities.PrintImageWithText(
                    graphics,
                    $"{quest.ToolRequirements[toolIndex]} BW",
                    initialX + (questCostImageSize / 4) + toolIndex * (questCostImageSize + (questCostImageSize / 8) + questCostImageSize / 4),
                    initialY,
                    questCostImageSize,
                    questCostImageSize,
                    quest.ToolCountRequired.ToString(),
                    (int)-(questCostImageSize / 2.6f),
                    0,
                    font);
            }
        }
Пример #9
0
        private void PrintGameTitle(CardImage cardImage)
        {
            var graphics = cardImage.Graphics;
            var usableRectangleWithPadding = cardImage.UsableRectangWithPadding;
            var titleFont = new Font(cardBackFontFamily, gameTitleFontSize, GraphicsUnit.Pixel);

            GraphicsUtilities.DrawString(
                graphics,
                "Splendor",
                titleFont,
                GraphicsUtilities.BlackBrush,
                new RectangleF(usableRectangleWithPadding.X, usableRectangleWithPadding.Y, usableRectangleWithPadding.Width, titleFont.Height),
                GraphicsUtilities.HorizontalCenterAlignment);
            GraphicsUtilities.DrawString(
                graphics,
                "Forge",
                titleFont,
                GraphicsUtilities.BlackBrush,
                new RectangleF(usableRectangleWithPadding.X, usableRectangleWithPadding.Bottom - titleFont.Height, usableRectangleWithPadding.Width, titleFont.Height),
                GraphicsUtilities.HorizontalCenterAlignment);
        }
Пример #10
0
        private void PrintCostsForTool(NewToolCard newCard, CardImage cardImage)
        {
            var font     = new Font(bodyFontFamily, imageLabelFontSize);
            var graphics = cardImage.Graphics;
            var usableRectangWithPadding = cardImage.UsableRectangWithPadding;
            var costList = newCard.Costs.ToList();

            for (var costIndex = 0; costIndex < costList.Count; costIndex++)
            {
                GraphicsUtilities.PrintImageWithText(
                    graphics,
                    costList[costIndex].Key,
                    usableRectangWithPadding.X,
                    usableRectangWithPadding.Bottom - ((costIndex + 1) * cardFrontSmallImageSize),
                    cardFrontSmallImageSize,
                    cardFrontSmallImageSize,
                    costList[costIndex].Value.ToString(),
                    0,
                    (int)(cardFrontSmallImageSize * (2.0 / 5)),
                    font);
            }
        }
Пример #11
0
        public CardImage CreatePlayerAidFront()
        {
            var cardImage = new CardImage("Player Aid Front", ImageOrientation.Landscape);
            var graphics  = cardImage.Graphics;

            cardImage.PrintCardBorderAndBackground(null, standardCardBackgroundColor);
            var playerAidString = "Each day, you may take one of the following actions:" +
                                  "\r\n\u2022  Scavenge for Resources: gather 3 different resources" +
                                  "\r\n\u2022  Hunt for Resources: gather 2 of the same resource [as long as there is an abundance (4+)]" +
                                  "\r\n\u2022  Find Blueprint: Reserve a Tool from the display into your hand and take 1 gold [if available]" +
                                  "\r\n\u2022  Craft: Take a Tool from the display, place in front of you and return the depicted resources to the supply" +
                                  "\r\n\r\nAfter your action, check if you have the tools to complete any quests.";

            GraphicsUtilities.DrawString(
                graphics,
                playerAidString,
                new Font(bodyFontFamily, bodyFontSize, GraphicsUnit.Pixel),
                GraphicsUtilities.BlackBrush,
                cardImage.UsableRectangWithPadding);
            PrintLimitsReminder(cardImage);
            return(cardImage);
        }
Пример #12
0
        private void PrintPoints(Graphics graphics, int points, int x, int y)
        {
            var font = new Font(bodyFontFamily, imageLabelFontSize);

            GraphicsUtilities.PrintImageWithTextCentered(graphics, "Wreath", x, y, wreathImageWidth, cardFrontSmallImageSize, points.ToString(), font);
        }
Пример #13
0
 private void PrintToolIcon(NewToolCard newCard, Graphics graphics, int x, int y)
 {
     GraphicsUtilities.PrintScaledPng(graphics, $"{newCard.Tool} BW", x, y, cardFrontSmallImageSize, cardFrontSmallImageSize);
 }