Beispiel #1
0
        void DefaultSettings()
        {
            drawingSettings = new MazeDrawingSettings()
            {
                CellHeight      = 10,
                CellWidth       = 10,
                BorderColor     = Color.Black,
                BackgroundColor = Color.Azure,
                SideColor       = Color.DarkGreen
            };

            drawingAlgo = MazeDrawersEnum.StandardMazeDrawer;

            clustererAlgo = MazeClusterersEnum.MazeClustererCyclic;

            mazeRotation = MazeRotateEnum.Rotate0;
        }
        public IMazeClusterer Create(MazeClusterersEnum clusterer)
        {
            IMazeClusterer mazeClusterer;

            switch (clusterer)
            {
            case MazeClusterersEnum.MazeClustererRecursion:
                mazeClusterer = new MazeClustererRecursion();
                break;

            case MazeClusterersEnum.MazeClustererCyclic:
                mazeClusterer = new MazeClustererCyclic();
                break;

            default:
                throw new MazeException(
                          "Не предусмотрено создание объекта поиска " +
                          "областей в лабиринте этого типа");
            }

            return(mazeClusterer);
        }
Beispiel #3
0
        private void StartConfigurationForm(object sender, EventArgs e)
        {
            ConfigurationForm dialog = new ConfigurationForm()
            {
                Drawer          = drawingAlgo,
                DrawingSettings = drawingSettings,
                Clusterer       = clustererAlgo,
                DebugLogging    = IsDebugConsoleEnabled(),
                Rotation        = mazeRotation
            };

            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                drawingAlgo   = dialog.Drawer;
                clustererAlgo = dialog.Clusterer;
                mazeRotation  = dialog.Rotation;
                SetDebugConsoleState(dialog.DebugLogging);

                ClearClusters();
                ShowMaze();
            }
        }
        private void OKButtonClick(Object sender, EventArgs e)
        {
            int drawerIndex = drawingAlgoCombobox.SelectedIndex;

            if (drawerIndex >= 0)
            {
                drawer = drawersComboboxValues.ValueByIndex(drawerIndex);
            }

            int clustererIndex = clustererCombobox.SelectedIndex;

            if (clustererIndex >= 0)
            {
                clusterer = clustererComboboxValues.ValueByIndex(clustererIndex);
            }

            int rotationIndex = rotationCombobox.SelectedIndex;

            if (rotationIndex >= 0)
            {
                rotation = rotationComboboxValues.ValueByIndex(rotationIndex);
            }

            drawingSettings.CellHeight = (int)cellHeightNumericUpDown.Value;
            drawingSettings.CellWidth  = (int)cellWidthNumericUpDown.Value;

            drawingSettings.BackgroundColor = backgroundColor;
            drawingSettings.BorderColor     = borderColor;
            drawingSettings.SideColor       = sideColor;

            debugLogging = debugLoggingCheckbox.Checked;

            DialogResult = DialogResult.OK;

            Close();
        }