Beispiel #1
0
        private void osuSelectButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog osuFileDialog = new OpenFileDialog();

            osuFileDialog.Filter = "osu! beatmap file|*.osu";

            if (osuFileDialog.ShowDialog() ?? true)
            {
                initialSettingsDialogue = new InitialSettingsWindow();
                if (initialSettingsDialogue.ShowDialog() ?? true)
                {
                    mapPath                    = osuFileDialog.FileName;
                    baseBeatmap                = new Beatmap(mapPath);
                    songArtist.Content         = baseBeatmap.Artist;
                    songTitle.Content          = baseBeatmap.Title;
                    difficultyNameTextbox.Text = "generated " + baseBeatmap.Version;
                    applyBeatmapStats(baseBeatmap);
                }
            }
        }
Beispiel #2
0
        private void extractMapContextFromWindow(InitialSettingsWindow window)
        {
            TimingPoint current = baseBeatmap.TimingPoints[0];
            //double generator_bpm = current.BpmDelay / 2;

            string tickDivisor = window.tickDivisorComboBox.Text;

            double bpm_multiplier;

            switch (tickDivisor)
            {
            case "1/1": bpm_multiplier = 2; break;

            case "1/2": bpm_multiplier = 1; break;

            case "1/3": bpm_multiplier = 2.0 / 3; break;

            case "1/4": bpm_multiplier = 0.5; break;

            default: throw new Exception("Unknown tick divisor");
            }

            double generator_beginOffset;

            if (window.firstTimingCheckbox.IsChecked.Value)
            {
                generator_beginOffset = current.Time;
            }
            else
            {
                double tmp;
                if (double.TryParse(window.beginOffsetTextbox.Text, out tmp))
                {
                    generator_beginOffset = tmp;
                }
                else
                {
                    MessageBox.Show("Unable to parse the begin offset. Please input a valid number or check the First timing point checkbox");
                    return;
                }
            }

            double generator_endOffset;

            if (window.lastObjectCheckbox.IsChecked.Value)
            {
                generator_endOffset = findLastObjectTimingInMap(baseBeatmap);
            }
            else
            {
                double tmp;
                if (double.TryParse(window.endOffsetTextbox.Text, out tmp))
                {
                    generator_endOffset = tmp;
                }
                else
                {
                    MessageBox.Show("Unable to parse the begin offset. Please input a valid number or check the Last object checkbox");
                    return;
                }
            }

            int generator_X;
            int generator_Y;

            if (window.overrideStartPointCheckBox.IsChecked ?? true)
            {
                double tmp;
                if (double.TryParse(window.XtextBox.Text, out tmp))
                {
                    generator_X = (int)tmp;
                }
                else
                {
                    MessageBox.Show("Unable to parse the X coordinate. Please input a valid number or uncheck the override starting position checkbox");
                    return;
                }

                if (double.TryParse(window.YtextBox.Text, out tmp))
                {
                    generator_Y = (int)tmp;
                }
                else
                {
                    MessageBox.Show("Unable to parse the Y coordinate. Please input a valid number or uncheck the override starting position checkbox");
                    return;
                }
            }
            else
            {
                generator_X = 200;
                generator_Y = 200;
            }

            generator.mapContext = new MapContextAwareness(bpm_multiplier, generator_beginOffset, generator_endOffset, generator_X, generator_Y, baseBeatmap.TimingPoints);

            if (window.keepOriginalPartCheckbox.IsChecked.Value)
            {
                PatternGenerator.copyMap(baseBeatmap, generator.generatedMap, generator.mapContext.Offset, generator.mapContext.endOffset);
            }
        }