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(numberOfPatternsTextbox.Text);
                }

                int    spacing  = (int)spacingSlider.Value;
                double rotation = rotationSlider.Value / 180.0 * Math.PI;
                int    shift    = (int)shiftSlider.Value;

                bool randomize = randomizeNoteOrderCheckbox.IsChecked ?? true;

                DoubleJumpType type = parseJumpType();

                pattern = new ConfiguredDoubleJumps(type, number, spacing, rotation, shift, randomize, end);

                DialogResult = true;
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        public static ConfiguredDoubleJumps randomPattern(int level)
        {
            var    type      = (DoubleJumpType)Utils.rng.Next(2);
            int    number    = Utils.rng.Next(5, 10) * level;
            int    spacing   = (level - 1) * 60 + Utils.rng.Next(10, 60);
            double rotation  = Utils.rng.Next(-60, 60);
            int    shift     = (level - 1) * 50 + Utils.rng.Next(10, 50);
            bool   randomize = Utils.rng.Next(1, 5) <= level;

            ConfiguredDoubleJumps p = new ConfiguredDoubleJumps(type, number, spacing, rotation, shift, randomize, false);

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