Exemple #1
0
 public void Recreate()
 {
     Center = LayouterSettings.StartPoint;
     NeedingShiftToCenter = LayouterSettings.NeedingShiftToCenter;
     Spiral = new ArchimedeanSpiral(LayouterSettings);
     Rectangles.Clear();
 }
Exemple #2
0
        private void LoadCardsToBorder()
        {
            Rectangles.Clear();
            Pictures.Clear();
            int widht  = 8;
            int height = 8;

            PexesoService.StartPexeso(height, widht);
            int x   = 2;
            int y   = 2;
            int row = 0;

            foreach (var a in PexesoService.GameCards)
            {
                Canvas.SetLeft(a.Img, x);
                Canvas.SetTop(a.Img, y);
                // Rectangle
                SolidColorBrush pomCo = new SolidColorBrush()
                {
                    Color   = Colors.Black,
                    Opacity = 1
                };
                SolidColorBrush pomCoB = new SolidColorBrush()
                {
                    Color = Colors.BlueViolet
                };
                Rectangle pomR = new Rectangle()
                {
                    Width  = PexesoService.PictureWidth,
                    Height = PexesoService.PictureHeight,
                    Fill   = pomCo,
                    Stroke = pomCoB,
                };
                Canvas.SetLeft(pomR, x);
                Canvas.SetTop(pomR, y);
                Rectangles.Add(pomR);
                Pictures.Add(a.Img);

                a.PositionX = x;
                a.PositionY = y;
                a.Status    = StatusCardEnum.Covered;
                x          += PexesoService.PictureWidth + 5;
                if (Pictures.Count % widht == 0)
                {
                    row++;
                    x  = 2;
                    y += PexesoService.PictureHeight + 5;
                }
                if (row == height)
                {
                    break;
                }
            }
        }
        public void Clear()
        {
            Circles.Clear();
            Rectangles.Clear();
            Triangles.Clear();

            WarningSigns.Clear();
            ProhibitingSigns.Clear();
            RegulatorySigns.Clear();
            InformationSigns.Clear();
            TemporarySigns.Clear();
        }
Exemple #4
0
        private void ShowBox(MouseEventArgs e, Mathe.RawRectangleF recF, int i)
        {
            if (e.Button == MouseButtons.Right)
            {
                if (true)
                {
                    switch (i)
                    {
                    case 24:
                        Boards[1].IsActive[0, 2] = !Boards[1].IsActive[0, 2];
                        break;

                    case 25:
                        Boards[1].IsActive[1, 1] = !Boards[1].IsActive[1, 1];
                        break;

                    case 26:
                        Boards[1].IsActive[1, 2] = !Boards[1].IsActive[1, 2];
                        break;

                    case 27:
                        Boards[1].IsActive[1, 3] = !Boards[1].IsActive[1, 3];
                        break;

                    case 28:
                        Boards[1].IsActive[2, 0] = !Boards[1].IsActive[2, 0];
                        break;

                    case 29:
                        Boards[1].IsActive[2, 1] = !Boards[1].IsActive[2, 1];
                        break;

                    case 30:
                        if (!Boards[1].IsActive[2, 2])
                        {
                            Boards[1].IsActive[2, 2] = true;
                        }
                        else
                        {
                            switch (_sevenLv)
                            {
                            case 0:
                                Boards[1].SetActiveImage(2, 2,
                                                         DxHelper.LoadFromFile(Path.Combine(_resPath, "7B.png")));
                                _sevenLv = 1;
                                break;

                            case 1:
                                Boards[1].SetActiveImage(2, 2,
                                                         DxHelper.LoadFromFile(Path.Combine(_resPath, "7C.png")));
                                _sevenLv = 2;
                                break;

                            default:
                                Boards[1].IsActive[2, 2] = false;
                                Boards[1].SetActiveImage(2, 2,
                                                         DxHelper.LoadFromFile(Path.Combine(_resPath, "7A.png")));
                                _sevenLv = 0;
                                break;
                            }
                        }
                        break;

                    case 31:
                        Boards[1].IsActive[2, 3] = !Boards[1].IsActive[2, 3];
                        break;

                    case 32:
                        Boards[1].IsActive[2, 4] = !Boards[1].IsActive[2, 4];
                        break;

                    case 33:
                        Boards[1].IsActive[3, 1] = !Boards[1].IsActive[3, 1];
                        break;

                    case 34:
                        Boards[1].IsActive[3, 2] = !Boards[1].IsActive[3, 2];
                        break;

                    case 35:
                        Boards[1].IsActive[3, 3] = !Boards[1].IsActive[3, 3];
                        break;

                    case 36:
                        Boards[1].IsActive[4, 2] = !Boards[1].IsActive[4, 2];
                        break;
                    }
                }
                switch (i)
                {
                case 0:
                case 16:
                    if (Boards[0].IsActive[0, 2] && Boards[0].IsActive[4, 6])
                    {
                        Boards[1].IsActive[0, 2] = false;
                        Boards[1].IsActive[1, 3] = false;
                        Boards[1].IsActive[2, 4] = false;
                        Boards[0].IsActive[0, 2] = false;
                        Boards[0].IsActive[4, 6] = false;
                        HasActive = false;
                    }
                    break;

                case 1:
                case 22:
                    if (Boards[0].IsActive[0, 3] && Boards[0].IsActive[6, 3])
                    {
                        Boards[1].IsActive[0, 2] = false;
                        Boards[1].IsActive[1, 2] = false;
                        Boards[1].IsActive[2, 2] = false;
                        Boards[1].IsActive[3, 2] = false;
                        Boards[1].IsActive[4, 2] = false;
                        Boards[0].IsActive[0, 3] = false;
                        Boards[0].IsActive[6, 3] = false;
                        HasActive = false;
                    }
                    break;

                case 2:
                case 13:
                    if (Boards[0].IsActive[0, 4] && Boards[0].IsActive[4, 0])
                    {
                        Boards[1].IsActive[0, 2] = false;
                        Boards[1].IsActive[1, 1] = false;
                        Boards[1].IsActive[2, 0] = false;
                        Boards[0].IsActive[0, 4] = false;
                        Boards[0].IsActive[4, 0] = false;
                        HasActive = false;
                    }
                    break;

                case 3:
                case 20:
                    if (Boards[0].IsActive[1, 1] && Boards[0].IsActive[5, 5])
                    {
                        Boards[1].IsActive[1, 1] = false;
                        Boards[1].IsActive[2, 2] = false;
                        Boards[1].IsActive[3, 3] = false;
                        Boards[0].IsActive[1, 1] = false;
                        Boards[0].IsActive[5, 5] = false;
                        HasActive = false;
                    }
                    break;

                case 4:
                case 18:
                    if (Boards[0].IsActive[1, 2] && Boards[0].IsActive[5, 2])
                    {
                        Boards[1].IsActive[1, 1] = false;
                        Boards[1].IsActive[2, 1] = false;
                        Boards[1].IsActive[3, 1] = false;
                        Boards[0].IsActive[1, 2] = false;
                        Boards[0].IsActive[5, 2] = false;
                        HasActive = false;
                    }
                    break;

                case 5:
                case 19:
                    if (Boards[0].IsActive[1, 4] && Boards[0].IsActive[5, 4])
                    {
                        Boards[1].IsActive[1, 3] = false;
                        Boards[1].IsActive[2, 3] = false;
                        Boards[1].IsActive[3, 3] = false;
                        Boards[0].IsActive[1, 4] = false;
                        Boards[0].IsActive[5, 4] = false;
                        HasActive = false;
                    }
                    break;

                case 6:
                case 17:
                    if (Boards[0].IsActive[1, 5] && Boards[0].IsActive[5, 1])
                    {
                        Boards[1].IsActive[1, 3] = false;
                        Boards[1].IsActive[2, 2] = false;
                        Boards[1].IsActive[3, 1] = false;
                        Boards[0].IsActive[1, 5] = false;
                        Boards[0].IsActive[5, 1] = false;
                        HasActive = false;
                    }
                    break;

                case 7:
                case 23:
                    if (Boards[0].IsActive[2, 0] && Boards[0].IsActive[6, 4])
                    {
                        Boards[1].IsActive[2, 0] = false;
                        Boards[1].IsActive[3, 1] = false;
                        Boards[1].IsActive[4, 2] = false;
                        Boards[0].IsActive[2, 0] = false;
                        Boards[0].IsActive[6, 4] = false;
                        HasActive = false;
                    }
                    break;

                case 8:
                case 9:
                    if (Boards[0].IsActive[2, 1] && Boards[0].IsActive[2, 5])
                    {
                        Boards[1].IsActive[1, 1] = false;
                        Boards[1].IsActive[1, 2] = false;
                        Boards[1].IsActive[1, 3] = false;
                        Boards[0].IsActive[2, 1] = false;
                        Boards[0].IsActive[2, 5] = false;
                        HasActive = false;
                    }
                    break;

                case 10:
                case 21:
                    if (Boards[0].IsActive[2, 6] && Boards[0].IsActive[6, 2])
                    {
                        Boards[1].IsActive[2, 4] = false;
                        Boards[1].IsActive[3, 3] = false;
                        Boards[1].IsActive[4, 2] = false;
                        Boards[0].IsActive[2, 6] = false;
                        Boards[0].IsActive[6, 2] = false;
                        HasActive = false;
                    }
                    break;

                case 11:
                case 12:
                    if (Boards[0].IsActive[3, 0] && Boards[0].IsActive[3, 6])
                    {
                        Boards[1].IsActive[2, 0] = false;
                        Boards[1].IsActive[2, 1] = false;
                        Boards[1].IsActive[2, 2] = false;
                        Boards[1].IsActive[2, 3] = false;
                        Boards[1].IsActive[2, 4] = false;
                        Boards[0].IsActive[3, 0] = false;
                        Boards[0].IsActive[3, 6] = false;
                        HasActive = false;
                    }
                    break;

                case 14:
                case 15:
                    if (Boards[0].IsActive[4, 1] && Boards[0].IsActive[4, 5])
                    {
                        Boards[1].IsActive[3, 1] = false;
                        Boards[1].IsActive[3, 2] = false;
                        Boards[1].IsActive[3, 3] = false;
                        Boards[0].IsActive[4, 1] = false;
                        Boards[0].IsActive[4, 5] = false;
                        HasActive = false;
                    }
                    break;

                default:
                    return;
                }
                return;
            }
            string fileName;

            switch (i)
            {
            case 0:
            case 16:
                fileName = "des_7.png";
                break;

            case 1:
            case 22:
                fileName = "des_5.png";
                break;

            case 2:
            case 13:
                fileName = "des_10.png";
                break;

            case 3:
            case 20:
                fileName = "des_11.png";
                break;

            case 4:
            case 18:
                fileName = "des_3.png";
                break;

            case 5:
            case 19:
                fileName = "des_2.png";
                break;

            case 6:
            case 17:
                fileName = "des_4.png";
                break;

            case 7:
            case 23:
                fileName = "des_12.png";
                break;

            case 8:
            case 9:
                fileName = "des_9.png";
                break;

            case 10:
            case 21:
                fileName = "des_0.png";
                break;

            case 11:
            case 12:
                fileName = "des_6.png";
                break;

            case 14:
            case 15:
                fileName = "des_8.png";
                break;

            case 30:
                fileName = "des_1.png";
                break;

            default:
                return;
            }

            PointF loc = new PointF(recF.Left, recF.Top);

            _boxBitmap = DxHelper.LoadFromFile(Path.Combine(_resPath, fileName));

            const float scaled  = 2f;
            float       scaledW = _boxBitmap.Size.Width / scaled,
                        scaledH = _boxBitmap.Size.Height / scaled;
            float left          = loc.X - 35,
                  top           = loc.Y - scaledH + 30,
                  right         = left + scaledW,
                  bottom        = top + scaledH;

            _boxRec        = new Mathe.RawRectangleF(left, top, right, bottom);
            _tmpRectangles = Rectangles.ToArray().ToList();
            Rectangles.Clear();
            Rectangles.AddRange(new[]
            {
                new Mathe.RawRectangleF(0, 0, RenderForm.Width, top),
                new Mathe.RawRectangleF(0, top, left, bottom),
                new Mathe.RawRectangleF(right, top, RenderForm.Width, bottom),
                new Mathe.RawRectangleF(0, bottom, RenderForm.Width, RenderForm.Height),
            });
            _isBoxing = true;
        }