Exemplo n.º 1
0
        private void BtnMoveHistory_Click(object sender, EventArgs e)
        {
            MoveHistory MH = new MoveHistory();

            MH.ManagerRef = ManagerRef;
            MH.Show();
        }
Exemplo n.º 2
0
        private void DrawCube()
        {
            int SquareUnit = PanelBack.Width / 5;

            for (int i = 0; i < 6; i++)
            {
                Graphics g = null;
                switch (i)
                {
                case 0: g = PanelFront.CreateGraphics();
                    break;

                case 1: g = PanelLeft.CreateGraphics();
                    break;

                case 2: g = PanelBack.CreateGraphics();
                    break;

                case 3: g = PanelRight.CreateGraphics();
                    break;

                case 4: g = PanelUp.CreateGraphics();
                    break;

                case 5: g = PanelDown.CreateGraphics();
                    break;
                }
                g.Clear(Color.Black);
                for (int j = 0; j < 9; j++)
                {
                    try
                    {
                        Dictionary <Direction, Color> .Enumerator ColorsEnum = ManagerRef.Faces[i, j].Colors.GetEnumerator();
                        while (ColorsEnum.MoveNext())
                        {
                            switch (ColorsEnum.Current.Key)
                            {
                            case Direction.Front:
                                g.FillRectangle(new Pen(ColorsEnum.Current.Value).Brush, ManagerRef.Faces[i, j].X * SquareUnit + SquareUnit, ManagerRef.Faces[i, j].Y * SquareUnit + SquareUnit, SquareUnit - 1, SquareUnit - 1);
                                break;

                            case Direction.Up:
                                g.FillRectangle(new Pen(ColorsEnum.Current.Value).Brush, ManagerRef.Faces[i, j].X * SquareUnit + SquareUnit, ManagerRef.Faces[i, j].Y * SquareUnit, SquareUnit - 1, SquareUnit - 1);
                                break;

                            case Direction.Left:
                                g.FillRectangle(new Pen(ColorsEnum.Current.Value).Brush, ManagerRef.Faces[i, j].X * SquareUnit, ManagerRef.Faces[i, j].Y * SquareUnit + SquareUnit, SquareUnit - 1, SquareUnit - 1);
                                break;

                            case Direction.Right:
                                g.FillRectangle(new Pen(ColorsEnum.Current.Value).Brush, ManagerRef.Faces[i, j].X * SquareUnit + 2 * SquareUnit, ManagerRef.Faces[i, j].Y * SquareUnit + SquareUnit, SquareUnit - 1, SquareUnit - 1);
                                break;

                            case Direction.Down:
                                g.FillRectangle(new Pen(ColorsEnum.Current.Value).Brush, ManagerRef.Faces[i, j].X * SquareUnit + SquareUnit, ManagerRef.Faces[i, j].Y * SquareUnit + 2 * SquareUnit, SquareUnit - 1, SquareUnit - 1);
                                break;
                            }
                        }
                    }
                    catch (Exception ex)
                    { }
                }
                LblBack.Text  = "Back (" + ManagerRef.Faces[2, 4].Colors[Direction.Front].Name + ")";
                LblDown.Text  = "Down (" + ManagerRef.Faces[5, 4].Colors[Direction.Front].Name + ")";
                LbLeft.Text   = "Left (" + ManagerRef.Faces[1, 4].Colors[Direction.Front].Name + ")";
                LblFront.Text = "Front (" + ManagerRef.Faces[0, 4].Colors[Direction.Front].Name + ")";
                LblRight.Text = "Right (" + ManagerRef.Faces[3, 4].Colors[Direction.Front].Name + ")";
                LblUp.Text    = "Up (" + ManagerRef.Faces[4, 4].Colors[Direction.Front].Name + ")";
            }
            if (ManagerRef.IsCubeSolved && !ManagerRef.IsHistoryActive)
            {
                MoveHistory MH = new MoveHistory();
                MH.ManagerRef = ManagerRef;
                MH.Show();
                ManagerRef.IsCubeSolved = false;
            }
        }