示例#1
0
 //hopefully this simple here too.
 internal int WhoHadCareerName(EnumCareerType thisCareer)
 {
     foreach (var thisPlayer in PlayerList !)
     {
         var tempList = thisPlayer.GetCareerList();
         if (tempList.Any(items => items.Career == thisCareer))
         {
             return(thisPlayer.Id);
         }
     }
     return(0);
 }
        private void DrawCareerSymbol(SKCanvas canvas, SKRect rect_Career, EnumCareerType whatCareer)
        {
            _symbolHeightWidth = rect_Career.Height;
            SKPath  gp_Career;
            SKPaint pn_Career;

            SKPoint[] pts_Curve  = new SKPoint[3];
            SKMatrix  tmp_Matrix = new SKMatrix();

            canvas.DrawOval(rect_Career, _steelBluePaint);
            switch (whatCareer)
            {
            case EnumCareerType.Artist:
            {
                tmp_Matrix.RotateAt(45, new SKPoint(rect_Career.Left + (rect_Career.Width / 2), rect_Career.Top + (rect_Career.Height / 2)));
                gp_Career = new SKPath();
                gp_Career.AddRect(SKRect.Create(rect_Career.Left + ActualSize(9), rect_Career.Top + ActualSize(7), ActualSize(2), ActualSize(11)));
                pts_Curve    = new SKPoint[6];
                pts_Curve[0] = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(7));
                pts_Curve[1] = new SKPoint(rect_Career.Left + ActualSize(9), rect_Career.Top + ActualSize(4));
                pts_Curve[2] = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(1));
                pts_Curve[3] = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(1));
                pts_Curve[4] = new SKPoint(rect_Career.Left + ActualSize(11), rect_Career.Top + ActualSize(4));
                pts_Curve[5] = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(7));
                gp_Career.AddPoly(pts_Curve);
                gp_Career.Transform(tmp_Matrix);
                canvas.DrawPath(gp_Career, _whitePaint);
                break;
            }

            case EnumCareerType.Athlete:
            {
                gp_Career = new SKPath();
                gp_Career.AddLine(rect_Career.Left + ActualSize(14), rect_Career.Top + ActualSize(3), rect_Career.Left + ActualSize(6), rect_Career.Top + ActualSize(3), true);
                gp_Career.ArcTo(SKRect.Create(rect_Career.Left + ActualSize(6), rect_Career.Top + ActualSize(3), ActualSize(5), ActualSize(8)), 180, -90, false);
                gp_Career.AddLine(rect_Career.Left + ActualSize(9), rect_Career.Top + ActualSize(15), rect_Career.Left + ActualSize(9), rect_Career.Top + ActualSize(16));
                gp_Career.AddLine(rect_Career.Left + ActualSize(9), rect_Career.Top + ActualSize(16), rect_Career.Left + ActualSize(7), rect_Career.Top + ActualSize(16));
                gp_Career.AddLine(rect_Career.Left + ActualSize(7), rect_Career.Top + ActualSize(16), rect_Career.Left + ActualSize(7), rect_Career.Top + ActualSize(18));
                gp_Career.AddLine(rect_Career.Left + ActualSize(7), rect_Career.Top + ActualSize(18), rect_Career.Left + ActualSize(13), rect_Career.Top + ActualSize(18));
                gp_Career.AddLine(rect_Career.Left + ActualSize(13), rect_Career.Top + ActualSize(18), rect_Career.Left + ActualSize(13), rect_Career.Top + ActualSize(16));
                gp_Career.AddLine(rect_Career.Left + ActualSize(13), rect_Career.Top + ActualSize(16), rect_Career.Left + ActualSize(11), rect_Career.Top + ActualSize(16));
                gp_Career.AddLine(rect_Career.Left + ActualSize(11), rect_Career.Top + ActualSize(16), rect_Career.Left + ActualSize(11), rect_Career.Top + ActualSize(15));
                gp_Career.ArcTo(SKRect.Create(rect_Career.Left + ActualSize(9), rect_Career.Top + ActualSize(3), ActualSize(5), ActualSize(8)), 90, -90, false);
                gp_Career.Close();
                canvas.DrawPath(gp_Career, _whitePaint);
                pts_Curve[0] = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(3));
                pts_Curve[1] = new SKPoint(rect_Career.Left + ActualSize(4), rect_Career.Top + ActualSize(7));
                pts_Curve[2] = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(12));
                canvas.DrawLines(pts_Curve, _whiteBorder !);
                pts_Curve[0] = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(3));
                pts_Curve[1] = new SKPoint(rect_Career.Left + ActualSize(16), rect_Career.Top + ActualSize(7));
                pts_Curve[2] = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(12));
                canvas.DrawLines(pts_Curve, _whiteBorder !);
                break;
            }

            case EnumCareerType.Entertainer:
            {
                gp_Career = new SKPath();
                gp_Career.AddLine(rect_Career.Left + ActualSize(10), rect_Career.Top, rect_Career.Left + ActualSize(8), rect_Career.Top + ActualSize(7), true);
                gp_Career.AddLine(rect_Career.Left + ActualSize(2), rect_Career.Top + ActualSize(7), rect_Career.Left + ActualSize(7), rect_Career.Top + ActualSize(12));
                gp_Career.AddLine(rect_Career.Left + ActualSize(5), rect_Career.Top + ActualSize(18), rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(14));
                gp_Career.AddLine(rect_Career.Left + ActualSize(15), rect_Career.Top + ActualSize(18), rect_Career.Left + ActualSize(14), rect_Career.Top + ActualSize(12));
                gp_Career.AddLine(rect_Career.Left + ActualSize(18), rect_Career.Top + ActualSize(7), rect_Career.Left + ActualSize(12), rect_Career.Top + ActualSize(7));
                gp_Career.Close();
                canvas.DrawPath(gp_Career, _whitePaint);
                break;
            }

            case EnumCareerType.Doctor:
            {
                pn_Career = MiscHelpers.GetStrokePaint(SKColors.White, ActualSize(6));
                canvas.DrawLine(System.Convert.ToInt32((rect_Career.Left + (rect_Career.Width / 2))), rect_Career.Top + ActualSize(2), System.Convert.ToInt32((rect_Career.Left + (rect_Career.Width / 2))), (rect_Career.Top + rect_Career.Height) - ActualSize(2), pn_Career);
                canvas.DrawLine(rect_Career.Left + ActualSize(2), System.Convert.ToInt32((rect_Career.Top + (rect_Career.Height / 2))), (rect_Career.Left + rect_Career.Width) - ActualSize(2), System.Convert.ToInt32((rect_Career.Top + (rect_Career.Height / 2))), pn_Career);
                break;
            }

            case EnumCareerType.Teacher:
            {
                canvas.DrawOval(SKRect.Create(rect_Career.Left + ActualSize(3), rect_Career.Top + ActualSize(6), ActualSize(14), ActualSize(12)), _whitePaint);
                gp_Career    = new SKPath();
                pts_Curve    = new SKPoint[9];
                pts_Curve[0] = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(6));
                pts_Curve[1] = new SKPoint(rect_Career.Left + ActualSize(8), rect_Career.Top + ActualSize(4));
                pts_Curve[2] = new SKPoint(rect_Career.Left + ActualSize(4), rect_Career.Top + ActualSize(2));
                pts_Curve[3] = new SKPoint(rect_Career.Left + ActualSize(4), rect_Career.Top + ActualSize(2));
                pts_Curve[4] = new SKPoint(rect_Career.Left + ActualSize(5), rect_Career.Top + ActualSize(5));
                pts_Curve[5] = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(6));
                pts_Curve[6] = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(6));
                pts_Curve[7] = new SKPoint(rect_Career.Left + ActualSize(12), rect_Career.Top + ActualSize(4));
                pts_Curve[8] = new SKPoint(rect_Career.Left + ActualSize(13), rect_Career.Top + ActualSize(2));
                gp_Career.AddPoly(pts_Curve);
                canvas.DrawPath(gp_Career, _whitePaint);
                break;
            }

            case EnumCareerType.Accountant:
            {
                var TextPaint = MiscHelpers.GetTextPaint(SKColors.White, ActualSize(16), "Times New Roman");
                canvas.DrawCustomText("$", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, TextPaint, rect_Career, out _);
                break;
            }

            case EnumCareerType.PoliceOfficer:
            {
                gp_Career     = new SKPath();
                pts_Curve     = new SKPoint[18];
                pts_Curve[0]  = new SKPoint(rect_Career.Left + ActualSize(4), rect_Career.Top + ActualSize(4));
                pts_Curve[1]  = new SKPoint(rect_Career.Left + ActualSize(7), rect_Career.Top + ActualSize(6));
                pts_Curve[2]  = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(4));
                pts_Curve[3]  = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(4));
                pts_Curve[4]  = new SKPoint(rect_Career.Left + ActualSize(13), rect_Career.Top + ActualSize(6));
                pts_Curve[5]  = new SKPoint(rect_Career.Left + ActualSize(16), rect_Career.Top + ActualSize(4));
                pts_Curve[6]  = new SKPoint(rect_Career.Left + ActualSize(17), rect_Career.Top + ActualSize(5));
                pts_Curve[7]  = new SKPoint(rect_Career.Left + ActualSize(16), rect_Career.Top + ActualSize(6));
                pts_Curve[8]  = new SKPoint(rect_Career.Left + ActualSize(16), rect_Career.Top + ActualSize(7));
                pts_Curve[9]  = new SKPoint(rect_Career.Left + ActualSize(16), rect_Career.Top + ActualSize(7));
                pts_Curve[10] = new SKPoint(rect_Career.Left + ActualSize(15), rect_Career.Top + ActualSize(14));
                pts_Curve[11] = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(18));
                pts_Curve[12] = new SKPoint(rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(18));
                pts_Curve[13] = new SKPoint(rect_Career.Left + ActualSize(5), rect_Career.Top + ActualSize(14));
                pts_Curve[14] = new SKPoint(rect_Career.Left + ActualSize(4), rect_Career.Top + ActualSize(7));
                pts_Curve[15] = new SKPoint(rect_Career.Left + ActualSize(4), rect_Career.Top + ActualSize(7));
                pts_Curve[16] = new SKPoint(rect_Career.Left + ActualSize(4), rect_Career.Top + ActualSize(6));
                pts_Curve[17] = new SKPoint(rect_Career.Left + ActualSize(3), rect_Career.Top + ActualSize(5));
                gp_Career.AddPoly(pts_Curve);
                canvas.DrawPath(gp_Career, _whitePaint);
                break;
            }

            case EnumCareerType.SalesPerson:
            {
                gp_Career = new SKPath();
                gp_Career.AddLine(rect_Career.Left + ActualSize(2), rect_Career.Top + ActualSize(10), rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(18));
                gp_Career.AddLine(rect_Career.Left + ActualSize(18), rect_Career.Top + ActualSize(10), rect_Career.Left + ActualSize(10), rect_Career.Top + ActualSize(2));
                gp_Career.AddLine(rect_Career.Left + ActualSize(6), rect_Career.Top + ActualSize(2), rect_Career.Left + ActualSize(2), rect_Career.Top + ActualSize(6));
                gp_Career.Close();
                gp_Career.AddOval(SKRect.Create(rect_Career.Left + ActualSize(4), rect_Career.Top + ActualSize(4), ActualSize(2), ActualSize(2)));
                canvas.DrawPath(gp_Career, _whitePaint);
                break;
            }

            case EnumCareerType.ComputerConsultant:
            {
                canvas.DrawRect(SKRect.Create(rect_Career.Left + ActualSize(5), rect_Career.Top + ActualSize(2), ActualSize(10), ActualSize(8)), _whitePaint);
                canvas.DrawRect(SKRect.Create(rect_Career.Left + ActualSize(3), rect_Career.Top + ActualSize(12), ActualSize(14), ActualSize(4)), _whitePaint);
                break;
            }
            }
            canvas.DrawRect(rect_Career, _whiteBorder);
        }