Exemplo n.º 1
0
        private void Draw2Numbers(SKCanvas thisCanvas, SKRect rect_Card)
        {
            var tempRect = GetStartingRect(rect_Card);

            thisCanvas.DrawRect(tempRect, GetColorUsed());
            tempRect = MainGraphics !.GetActualRectangle(11, 5, 30, 30);
            float width;
            float diffs = 0;

            if (tempRect.Height > tempRect.Width)
            {
                width = tempRect.Width;
                diffs = tempRect.Height - tempRect.Width;
            }
            else if (tempRect.Width > tempRect.Height)
            {
                width = tempRect.Height;
            }
            else
            {
                width = tempRect.Width;
            }
            var firstRect = SKRect.Create(MainGraphics.Location.X + tempRect.Location.X, MainGraphics.Location.Y + tempRect.Location.Y + (diffs / 2), width, width);

            tempRect = MainGraphics.GetActualRectangle(11, 37, 30, 30);
            var secondRect = SKRect.Create(MainGraphics.Location.X + tempRect.Location.X, MainGraphics.Location.Y + tempRect.Location.Y, width, width);

            PrivateDrawDiceImage(thisCanvas, FirstValue, firstRect);
            PrivateDrawDiceImage(thisCanvas, SecondValue, secondRect);
        }
 public void Init()
 {
     MainGraphics !.OriginalSize = new SKSize(107, 135); //change to what the original size is.
     _pDrewPaint  = MainGraphics.GetStandardDrewPaint();
     _selectPaint = BaseDeckGraphicsCP.GetStandardSelectPaint();
     _blackBorder = MiscHelpers.GetStrokePaint(SKColors.Black, 1);
     _greenPaint  = MiscHelpers.GetSolidPaint(SKColors.Green);
 }
        private void DrawJoker(SKCanvas canvas)
        {
            var firstRect = MainGraphics !.GetActualRectangle(2, 2, 55, 20);
            var fontSize  = firstRect.Height * 0.8f; // can be adjusted as needed
            var textPaint = MiscHelpers.GetTextPaint(SKColors.Black, fontSize);

            canvas.DrawCustomText("Joker", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, firstRect, out _);
            var secondRect = MainGraphics.GetActualRectangle(8, 25, 40, 40); // i think this makes more sense

            canvas.DrawSmiley(secondRect, null !, _thickBorder !, _blackPaint !);
        }
        public void DrawImage(SKCanvas canvas, SKRect rect_Card)
        {
            if (CardValue == EnumCardValueList.Joker)
            {
                DrawJoker(canvas);
                return;
            }
            var SuitRect = MainGraphics !.GetActualRectangle(7, 5, 40, 40);

            DrawSuit(canvas, SuitRect);
            var TextRect = MainGraphics.GetActualRectangle(0, 42, 55, 28);

            DrawValue(canvas, TextRect);
        }