private void PrivateDrawDiceImage(SKCanvas thisCanvas, int value, SKRect thisRect) { StandardDiceGraphicsCP thisDice = new StandardDiceGraphicsCP(); thisDice.NeedsToClear = false; // for this for sure thisDice.Location = thisRect.Location; thisDice.UseSmallerBorders(); thisDice.ActualWidthHeight = thisRect.Height; thisDice.Value = value; thisDice.DrawDice(thisCanvas); }
private void DrawNoDice(SKCanvas canvas) { var textRect = MainGraphics !.GetActualRectangle(0, 10, 107, 44); var thisPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, MainGraphics.GetFontSize(27)); canvas.DrawBorderText("No Dice", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Start, thisPaint, _borderTextPaint !, textRect); var lastRect = MainGraphics.GetActualRectangle(23, 59, 60, 60); var thisPen = MiscHelpers.GetStrokePaint(SKColors.Red, 7); // i think 7 no matter what (?) canvas.DrawOval(lastRect, thisPen); StandardDiceGraphicsCP thisDice = new StandardDiceGraphicsCP(); thisDice.Location = new SKPoint(lastRect.Left + (lastRect.Size.Width / 4), lastRect.Top + (lastRect.Size.Height / 4)); thisDice.NeedsToClear = false; // its this instead. var thisSize = MainGraphics.GetActualSize(new SKSize(34, 34)); thisDice.ActualWidthHeight = thisSize.Height; thisDice.UseSmallerBorders(); thisDice.Value = 6; thisDice.DrawDice(canvas); canvas.DrawLine(lastRect.Left + 10, lastRect.Top + 10, lastRect.Right - 10, lastRect.Bottom - 10, thisPen); }
public override void DrawImage(SKCanvas dc) { if (ActualHeight == 1) { return; } // anything that needs to be drawn for each space will be here. if nothing is done, then will do nothing. if (Number == 0) { return;// because no number associated with it. must have a number } if (Number == 10 || Number == 11) { throw new BasicBlankException("Can't have 10 or 11 for number"); } if (Number < 1 || Number > 12) { throw new BasicBlankException("Number has to be between 2 and 12 but no 10 or 11"); } // can be transparent and previous one (if removing space) if (ActualHeight != ActualWidth) { throw new BasicBlankException("Must be perfect squares for this game"); } if (ActualWidth == 0 || ActualHeight == 0) { throw new BasicBlankException("Can't be 0 for the actual width or height"); } var thisRect = GetMainRect(); var newRect = SKRect.Create(3, 3, thisRect.Width - 6, thisRect.Height - 6); if (Number != 2 && Number != 12) { if (WasPrevious == true) { dc.DrawRect(thisRect, _yellowPaint); } else { dc.DrawRect(thisRect, _whitePaint); } SKPaint otherTextPaint; if (MainColor.Equals(cs.Transparent) == false) { // this means do a circle dc.DrawOval(newRect, _borderPaint); dc.DrawOval(newRect, MainPaint); // i think otherTextPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, newRect.Height * 1.2f); } else { otherTextPaint = MiscHelpers.GetTextPaint(SKColors.Red, newRect.Height * 1.2f); } dc.DrawBorderText(Number.ToString(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, otherTextPaint, _text1Paint, newRect); dc.DrawRect(thisRect, _borderPaint); return; } dc.DrawRect(thisRect, _grayPaint); StandardDiceGraphicsCP firstDice = new StandardDiceGraphicsCP(); { var withBlock = firstDice; withBlock.Location = new SKPoint(newRect.Location.X, newRect.Location.Y); withBlock.NeedsToClear = false; withBlock.ActualWidthHeight = newRect.Height / 2.1f; withBlock.Value = Number / 2; withBlock.UseSmallerBorders(); if (WasPrevious == true) { withBlock.FillColor = cs.Yellow; } } StandardDiceGraphicsCP secondDice = new StandardDiceGraphicsCP(); { var withBlock1 = secondDice; withBlock1.Location = new SKPoint(firstDice.Location.X + 3 + firstDice.ActualWidthHeight, firstDice.Location.Y + 3 + firstDice.ActualWidthHeight); withBlock1.NeedsToClear = false; withBlock1.ActualWidthHeight = newRect.Height / 2.1f; withBlock1.Value = Number / 2; withBlock1.UseSmallerBorders(); if (WasPrevious == true) { withBlock1.FillColor = cs.Yellow; } } firstDice.DrawDice(dc); secondDice.DrawDice(dc); if (MainColor.Equals(cs.Transparent) == false) { // this means do a circle dc.DrawOval(newRect, _borderPaint); dc.DrawOval(newRect, MainPaint); // i think SKPaint otherTextPaint; if (Number == 2) { otherTextPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, newRect.Height * 1.2f); } else { otherTextPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, newRect.Height * 0.7f); } dc.DrawBorderText(Number.ToString(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, otherTextPaint, _text1Paint, newRect); dc.DrawRect(thisRect, _borderPaint); return; } dc.DrawRect(thisRect, _borderPaint); }