示例#1
0
        public void CanvasView_PaintSurface(object sender, SKPaintSurfaceEventArgs pse)
        {
            SKSurface   surf = pse.Surface;
            SKCanvas    cv   = surf.Canvas;
            SKImageInfo ii   = pse.Info;
            float       w    = ii.Width;
            float       h    = ii.Height;

            cv.Scale(h / 400.0f);
            cv.Translate(50.0f, 50.0f);
            Rendering.DrawCard(cv, sets.First());
        }
示例#2
0
        public void CanvasView_PaintSurface(object sender, SKPaintSurfaceEventArgs pse)
        {
            SKSurface   surf = pse.Surface;
            SKCanvas    cv   = surf.Canvas;
            SKImageInfo ii   = pse.Info;

            cv.Clear(SKColors.White);
            float w  = ii.Width;
            float h  = ii.Height;
            float sc = Math.Min(w, h) / 440.0f;

            if (cg.Phase == GamePhase.Choosing)
            {
                // draw hand
                int   midcard = (int)Math.Round(HandSlide);
                float midscr  = w / 2;
                del   fn      = (i) => {
                    cv.ResetMatrix();
                    float relidx = i - HandSlide;
                    relidx /= cg.Me.Hand.Count;
                    relidx *= 2; // [-1; 1] range
                    float csc = h / 400.0f * 1.3f * (1.0f - Math.Abs(relidx));
                    csc = Math.Max(csc, 0.01f);
                    cv.Translate(midscr + sc * ((w < h)?(midscr / 1.2f):(midscr * 0.75f)) * (float)Math.Pow(Math.Abs(relidx) * 0.8f, 0.5) * Math.Sign(relidx), h - sc * 150.0f);
                    cv.Scale(csc);
                    cv.Translate(-51.5f, -51.5f);
                    Rendering.DrawCard(cv, cg.Me.Hand[i]);
                };
                for (int i = 0; i < midcard; i++)
                {
                    fn(i);
                }
                for (int i = cg.Me.Hand.Count - 1; i > midcard; i--)
                {
                    fn(i);
                }
                fn(midcard);
                // Question card
                cv.ResetMatrix();
                sc *= 1.5f;
                cv.Scale(sc);
                cv.Translate(midscr / sc - 51.5f, 20.0f / sc);
                Rendering.DrawCard(cv, cg.AllBlackCards[0]);
            }
        }