private void OKbutton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int  number = 0;
                bool end    = false;
                if (tillEndCheckbox.IsChecked ?? true)
                {
                    end = true;
                }
                else
                {
                    number = int.Parse(numberOfNotesTextbox.Text);
                }

                int spacing = (int)spacingSlider.Value;

                int  maxStack = int.Parse(maxStacksComboBox.Text);
                bool onlySuch = onlySuchCheckBox.IsChecked ?? true;

                pattern = new ConfiguredRandomJumps(number, spacing, end, maxStack, onlySuch);

                DialogResult = true;
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 2
0
        public static ConfiguredRandomJumps randomPattern(int level)
        {
            int  number   = Utils.rng.Next(10, 20);
            int  spacing  = (level - 1) * 100 + Utils.rng.Next(10, 100);
            int  maxStack = (level - 1) * 2 + Utils.rng.Next(2);
            bool useOnly  = Utils.rng.Next(1, 5) > level;

            ConfiguredRandomJumps p = new ConfiguredRandomJumps(number, spacing, false, maxStack, useOnly);

            return(p);
        }
Esempio 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);
                }
            }
        }