Exemplo n.º 1
0
        private void OKbutton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int points = int.Parse(numberOfPointsTextbox.Text);

                int  number = 0;
                bool end    = false;
                if (tillEndCheckbox.IsChecked ?? true)
                {
                    end = true;
                }
                else
                {
                    number = int.Parse(numberOfPatternsTextbox.Text);
                }

                int spacing   = (int)spacingSlider.Value;
                int shift     = (int)shiftSlider.Value;
                int curviness = (int)curvinessSlider.Value;

                pattern = new ConfiguredStreams(points, number, spacing, curviness, shift, end);

                DialogResult = true;
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        public static ConfiguredStreams randomPattern(int level)
        {
            int points    = Utils.rng.Next(4, 8);
            int number    = Utils.rng.Next(5, 10) * level;
            int spacing   = (level - 1) * 30 + Utils.rng.Next(10, 20);
            int curviness = (level - 1) * 30 + Utils.rng.Next(20);
            int shift     = (level - 1) * 40 + Utils.rng.Next(10, 20);

            ConfiguredStreams p = new ConfiguredStreams(points, number, spacing, curviness, shift, false);

            return(p);
        }
Exemplo n.º 3
0
        private void randomConfigButton_Click(object sender, RoutedEventArgs e)
        {
            ChooseLevelDialogue chooseLevelDialogue = new ChooseLevelDialogue();

            if (chooseLevelDialogue.ShowDialog() ?? true)
            {
                int  level = chooseLevelDialogue.level;
                int  count = chooseLevelDialogue.count;
                int  phase = chooseLevelDialogue.phase;
                bool toEnd = chooseLevelDialogue.toEndCheckBox.IsChecked ?? true;

                for (int i = 0; i < count; ++i)
                {
                    for (int j = 0; j < phase; ++j)
                    {
                        int patternType           = Utils.rng.Next(4);
                        ConfiguredPattern pattern = null;
                        switch (patternType)
                        {
                        case 0: pattern = ConfiguredDoubleJumps.randomPattern(level); break;

                        case 1: pattern = ConfiguredPolygons.randomPattern(level); break;

                        case 2: pattern = ConfiguredRandomJumps.randomPattern(level); break;

                        case 3: pattern = ConfiguredStreams.randomPattern(level); break;

                        default: pattern = ConfiguredPolygons.randomPattern(level); break;
                        }
                        Patterns.Add(pattern);

                        if (i == count - 1 && j == phase - 1 && toEnd)
                        {
                            pattern.end = true;
                        }
                    }

                    ConfiguredBreak breakP = ConfiguredBreak.randomPattern(level);
                    Patterns.Add(breakP);
                }
            }
        }