public CardImage CreateSiteFront(CardSuit suit) { var name = $"{suit.ResourceName()}_Site"; var cardImage = new CardImage(name, ImageOrientation.Portrait); var graphics = cardImage.Graphics; var fullRectangle = cardImage.FullRectangle; var usableRectangle = cardImage.UsableRectangle; cardImage.PrintCardBorderAndBackground(Color.White, Color.White); DrawSiteCost(cardImage, suit); var costRegionHeight = (int)(fullRectangle.Height * SiteCostRegionHeightPercentage); var costImagePaddingHeight = (int)(fullRectangle.Height * SiteResourceSectionPaddingPercentage); var costImageTopPaddingHeight = costImagePaddingHeight / 2; var costImageBottomPaddingHeight = costImagePaddingHeight / 2; var costImageSectionHeight = (int)(fullRectangle.Height * SiteResourceHeightPercentage); var costImageHeight = costImageSectionHeight - costImagePaddingHeight; var costImageRectangle = new Rectangle( usableRectangle.X, fullRectangle.Y + (fullRectangle.Bottom - (costRegionHeight + costImageBottomPaddingHeight + costImageHeight)), usableRectangle.Width, costImageHeight); //graphics.FillRectangle(new SolidBrush(Color.Blue), costImageRectangle); GraphicsUtilities.PrintScaledAndCenteredPng( graphics, $@"Resources\{suit.ResourceName()}", costImageRectangle.X, costImageRectangle.Y, costImageRectangle.Width, costImageRectangle.Height); var cardNameFont = new Font(headerFontFamily, orderCardHeaderFontSize, FontStyle.Bold, GraphicsUnit.Pixel); var text = AddHairSpaces(suit.ResourceName().ToUpper()); var maxTextBoxWidth = usableRectangle.Width; var initialRectangle = new Rectangle(usableRectangle.X, usableRectangle.Y, maxTextBoxWidth, usableRectangle.Height); var textMeasurement = graphics.MeasureString(text, cardNameFont, new SizeF(initialRectangle.Width, initialRectangle.Height), GraphicsUtilities.HorizontalCenterAlignment); var textHeight = (int)Math.Ceiling(textMeasurement.Height); var yOffset = fullRectangle.Bottom - (costRegionHeight + costImageSectionHeight + textHeight); var textRectangle = new Rectangle(usableRectangle.X, usableRectangle.Y + yOffset, maxTextBoxWidth, textHeight); graphics.FillRectangle(new SolidBrush(Color.FromArgb(100, Color.White)), textRectangle); //graphics.FillRectangle(new SolidBrush(Color.Blue), textRectangle); GraphicsUtilities.DrawString(graphics, text, cardNameFont, GraphicsUtilities.BlackBrush, textRectangle, GraphicsUtilities.HorizontalCenterAlignment); var centerPoint = usableRectangle.X + usableRectangle.Width / 2; var coinOffsetCount = 0f; switch (suit.Cost()) { case 1: coinOffsetCount = -.5f; break; case 2: coinOffsetCount = -1; break; case 3: coinOffsetCount = -1.5f; break; } var siteCoinPadding = SiteCoinPadding(cardImage); var siteCoinWidth = SiteCoinWidth(cardImage); var xOffset = (int)(coinOffsetCount * siteCoinWidth + (coinOffsetCount + .5f) * siteCoinPadding); for (var i = 0; i < suit.Cost(); i++) { GraphicsUtilities.PrintScaledPng( graphics, $@"Misc\Coin", centerPoint + xOffset + (i * (siteCoinWidth + siteCoinPadding)), usableRectangle.Y, siteCoinWidth, siteCoinWidth); } return(cardImage); }
internal CardImage CreateMerchantBonusImage(CardSuit suit) { var cardImage = new CardImage($"MerchantBonus_{suit.ResourceName()}", ImageOrientation.Portrait); var graphics = cardImage.Graphics; cardImage.PrintCardBorderAndBackground(Color.White, Color.White); var fullRectangle = cardImage.FullRectangle; var usableRectangle = cardImage.UsableRectangle; var xOffset = usableRectangle.Width / 5; var yOffset = (int)(usableRectangle.Width * .05f); PrintCardName("Merchant Bonus", cardImage, GraphicsUtilities.BlackBrush, false, xOffset, 3 * usableRectangle.Width / 5, yOffset); var costImagePaddingHeight = (int)(fullRectangle.Height * SiteResourceSectionPaddingPercentage); var costImageTopPaddingHeight = costImagePaddingHeight / 2; var costImageBottomPaddingHeight = costImagePaddingHeight / 2; var costImageSectionHeight = (int)(fullRectangle.Height * SiteResourceHeightPercentage); var costImageHeight = costImageSectionHeight - costImagePaddingHeight; var costImageRectangle = new Rectangle( usableRectangle.X, fullRectangle.Y + (fullRectangle.Bottom - ((int)(fullRectangle.Height * .30f) + costImageBottomPaddingHeight + costImageHeight)), usableRectangle.Width, costImageHeight); //graphics.FillRectangle(new SolidBrush(Color.Blue), costImageRectangle); GraphicsUtilities.PrintScaledAndCenteredPng( graphics, $@"Resources\{suit.ResourceName()}", costImageRectangle.X, costImageRectangle.Y, costImageRectangle.Width, costImageRectangle.Height); PrintCardText( $"+3 victory points for |the player with the most |{suit.ResourceName().ToUpper()} in his vault at |the end of the game.", cardImage, fullRectangle.Bottom - ((int)(fullRectangle.Height * .35f)), usableRectangle.Width, (int)(fullRectangle.Height * .25f), 0, false, GraphicsUtilities.BlackBrush); var centerPoint = usableRectangle.X + usableRectangle.Width / 2; var coinOffsetCount = -1.5f; var siteCoinPadding = SiteCoinPadding(cardImage); var siteCoinWidth = SiteCoinWidth(cardImage); var coinXOffset = (int)(coinOffsetCount * siteCoinWidth + (coinOffsetCount + .5f) * siteCoinPadding); for (var i = 0; i < 3; i++) { GraphicsUtilities.PrintScaledPng( graphics, $@"Misc\Coin", centerPoint + coinXOffset + (i * (siteCoinWidth + siteCoinPadding)), usableRectangle.Y + (int)(usableRectangle.Width * .26f), siteCoinWidth, siteCoinWidth); } return(cardImage); }