Ejemplo n.º 1
0
        private void FBuildBeatmap_Load(object sender, EventArgs e)
        {
            // Initialize difficulty texts.
            var difficultyComboBoxes = new[] { cboDurationDifficulty, cboCsvDifficulty, cboDiffculty1, cboDiffculty2, cboDiffculty3, cboDiffculty4, cboDiffculty5 };

            foreach (var comboBox in difficultyComboBoxes)
            {
                comboBox.Items.Clear();
                for (var d = Difficulty.Debut; d <= Difficulty.MasterPlus; ++d)
                {
                    comboBox.Items.Add(DescribedEnumConverter.GetEnumDescription(d));
                }
            }

            cboDiffculty1.SelectedIndex = 0;
            cboDiffculty2.SelectedIndex = 1;
            cboDiffculty3.SelectedIndex = 2;
            cboDiffculty4.SelectedIndex = 3;
            cboDiffculty5.SelectedIndex = 4;

            radEndTimeAuto.Checked   = true;
            radEndTimeCustom.Checked = !radEndTimeAuto.Checked;
            radBuildCsv.Checked      = _difficulty != Difficulty.Invalid;
            radBuildBdb.Checked      = !radBuildCsv.Checked;

            cboCsvDifficulty.SelectedIndex      = _difficulty == Difficulty.Invalid ? 0 : (int)_difficulty - 1;
            cboDurationDifficulty.SelectedIndex = _difficulty == Difficulty.Invalid ? 0 : (int)_difficulty - 1;

            RadEndTimeType_CheckedChanged(sender, EventArgs.Empty);
            RadBuildType_CheckedChanged(sender, EventArgs.Empty);

            CboCsvDifficulty_SelectedIndexChanged(sender, EventArgs.Empty);
            CboDurationDifficulty_SelectedIndexChanged(sender, EventArgs.Empty);
        }
Ejemplo n.º 2
0
        private void CmdScoreNoteStartPositionSetAt_Executed(object sender, ExecutedEventArgs e)
        {
            Debug.Assert(e.Parameter != null, "e.Parameter != null");

            var startPosition = (NotePosition)e.Parameter;

            visualizer.Editor.NoteStartPosition = startPosition;

            var atMenuItems = new[] {
                mnuScoreNoteStartPositionAt0, mnuScoreNoteStartPositionAt1, mnuScoreNoteStartPositionAt2,
                mnuScoreNoteStartPositionAt3, mnuScoreNoteStartPositionAt4, mnuScoreNoteStartPositionAt5
            };

            foreach (var it in atMenuItems)
            {
                var commandSource = CommandHelper.FindCommandSource(it);

                Debug.Assert(commandSource != null, nameof(commandSource) + " != null");
                Debug.Assert(commandSource.CommandParameter != null, "commandSource.CommandParameter != null");

                var pos = (NotePosition)commandSource.CommandParameter;

                it.Checked = pos == startPosition;
            }

            tsbScoreNoteStartPosition.Text = DescribedEnumConverter.GetEnumDescription(startPosition);
        }
Ejemplo n.º 3
0
        private void FBeatmapInfo_Load(object sender, EventArgs e)
        {
            var listView = lv;
            var project  = _project;

            listView.View             = View.Details;
            listView.HeaderStyle      = ColumnHeaderStyle.Nonclickable;
            listView.ShowItemToolTips = false;
            listView.ShowGroups       = true;
            listView.FullRowSelect    = true;
            listView.MultiSelect      = false;

            listView.Items.Clear();
            listView.Groups.Clear();
            listView.Columns.Clear();

            listView.Columns.Add(LanguageManager.TryGetString("ui.fbeatmapstats.listview.column.name.text") ?? "Name");
            listView.Columns.Add(LanguageManager.TryGetString("ui.fbeatmapstats.listview.column.value.text") ?? "Value");

            var groupGeneral = listView.Groups.Add("General", LanguageManager.TryGetString("ui.fbeatmapstats.listview.header.general.text") ?? "General");
            var it           = listView.Items.Add(LanguageManager.TryGetString("ui.fbeatmapstats.listview.item.project_file_name.text") ?? "Project file name");

            it.SubItems.Add(project.SaveFilePath ?? string.Empty);
            it.Group = groupGeneral;
            it       = listView.Items.Add(LanguageManager.TryGetString("ui.fbeatmapstats.listview.item.music_file_name.text") ?? "Music file name");
            it.SubItems.Add(project.Project.MusicFileName ?? string.Empty);
            it.Group = groupGeneral;

            var difficulties = new[] { Difficulty.Debut, Difficulty.Regular, Difficulty.Pro, Difficulty.Master, Difficulty.MasterPlus };

            foreach (var difficulty in difficulties)
            {
                var score                 = project.Project.GetScore(difficulty);
                var numberOfNotes         = score.GetAllNotes().Count;
                var numberOfBars          = score.Bars.Count;
                var duration              = score.CalculateDuration();
                var difficultyDescription = DescribedEnumConverter.GetEnumDescription(difficulty);
                var headerTextFormat      = LanguageManager.TryGetString("ui.fbeatmapstats.listview.header.items.text_template") ?? "Difficulty: {0}";
                var text  = string.Format(headerTextFormat, difficultyDescription);
                var group = listView.Groups.Add(text, text);
                var it1   = listView.Items.Add(LanguageManager.TryGetString("ui.fbeatmapstats.listview.item.measures.text") ?? "Measures");
                it1.SubItems.Add(numberOfBars.ToString());
                var it2 = listView.Items.Add(LanguageManager.TryGetString("ui.fbeatmapstats.listview.item.notes.text") ?? "Notes");
                it2.SubItems.Add(numberOfNotes.ToString());
                var it3 = listView.Items.Add(LanguageManager.TryGetString("ui.fbeatmapstats.listview.item.duration.text") ?? "Duration");
                it3.SubItems.Add(duration.ToString("g"));
                it1.Group = group;
                it2.Group = group;
                it3.Group = group;
            }

            listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
        }
Ejemplo n.º 4
0
        private void FSelectMusicID_Load(object sender, EventArgs e)
        {
            var initialMusicID = _musicID;
            var initialLiveID  = _liveID;

            cboDatabaseItems.Items.Clear();
            if (!File.Exists(MasterDatabasePath))
            {
                var fileInfo             = new FileInfo(MasterDatabasePath);
                var errorMessageTemplate = LanguageManager.TryGetString("messages.fselectmusicid.master_database_file_missing") ?? "The database file '{0}' is missing. Using the default music ID.";
                var errorMessage         = string.Format(errorMessageTemplate, fileInfo.FullName);
                MessageBox.Show(this, errorMessage, AssemblyHelper.GetTitle(), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                _musicID = 1001;
                _liveID  = 1;
                Close();
            }
            else
            {
                try {
                    var csb = new SQLiteConnectionStringBuilder {
                        DataSource = MasterDatabasePath
                    };
                    var musicList = new List <LiveMusicRecord>();
                    using (var connection = new SQLiteConnection(csb.ToString())) {
                        connection.Open();
                        using (var adapter = new SQLiteDataAdapter(FormatFilter, connection)) {
                            using (var dataTable = new DataTable()) {
                                adapter.Fill(dataTable);
                                foreach (DataRow dataRow in dataTable.Rows)
                                {
                                    var record = new LiveMusicRecord {
                                        LiveID           = (int)(long)dataRow["live_id"],
                                        MusicID          = (int)(long)dataRow["music_id"],
                                        MusicName        = ((string)dataRow["music_name"]).Replace(@" \n", " ").Replace(@"\n", " "),
                                        DifficultyExists = new bool[5]
                                    };
                                    for (var i = (int)Difficulty.Debut; i <= (int)Difficulty.MasterPlus; ++i)
                                    {
                                        var v = (int)(long)dataRow["d" + i];
                                        record.DifficultyExists[i - 1] = v > 0;
                                    }
                                    var color = (int)(long)dataRow["live_type"];
                                    if (color > 0)
                                    {
                                        record.Attribute |= (MusicColor)(1 << (color - 1));
                                    }
                                    var isEvent = (long)dataRow["event_type"] > 0;
                                    if (isEvent)
                                    {
                                        record.Attribute |= MusicColor.Event;
                                    }
                                    // お願い!シンデレラ (solo ver.)
                                    if (record.MusicID == 1901)
                                    {
                                        record.Attribute |= MusicColor.Solo;
                                    }
                                    // TODO: some other temporary songs (e.g. for songs election)

                                    musicList.Add(record);
                                }
                            }
                        }
                        connection.Close();
                    }

                    _musicList = musicList;
                    var itemTextTemplate = LanguageManager.TryGetString("ui.fselectmusicid.combobox.item.text_template") ?? "{0} [{1}]";
                    foreach (var record in musicList)
                    {
                        var attributeDescription = DescribedEnumConverter.GetEnumDescription(record.Attribute);
                        var str = string.Format(itemTextTemplate, record.MusicName, attributeDescription);
                        cboDatabaseItems.Items.Add(str);
                    }

                    if (cboDatabaseItems.Items.Count > 0)
                    {
                        if (initialMusicID <= 0)
                        {
                            cboDatabaseItems.SelectedIndex = 0;
                        }
                        else
                        {
                            var targetSelectionIndex = musicList.FindIndex(record => {
                                if (initialMusicID != 0 && initialMusicID != record.MusicID)
                                {
                                    return(false);
                                }
                                if (initialLiveID != 0 && initialLiveID != record.LiveID)
                                {
                                    return(false);
                                }
                                return(true);
                            });
                            if (targetSelectionIndex < 0)
                            {
                                targetSelectionIndex = 0;
                            }
                            cboDatabaseItems.SelectedIndex = targetSelectionIndex;
                        }
                    }
                } catch (Exception ex) {
                    MessageBox.Show(this, $"An error occurred while reading the database. Using the default music ID.{Environment.NewLine}Information: {ex.Message}", AssemblyHelper.GetTitle(), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    _musicID = 1001;
                    _liveID  = 1;
                    Close();
                }
            }
        }
Ejemplo n.º 5
0
        private void FExportTxt_Load(object sender, EventArgs e)
        {
            {
                var scoreDifficulty = _score.Difficulty;

                cboDifficulty.Items.Clear();

                for (var d = Difficulty.Debut; d <= Difficulty.MasterPlus; ++d)
                {
                    cboDifficulty.Items.Add(DescribedEnumConverter.GetEnumDescription(d));
                }

                cboDifficulty.SelectedIndex = scoreDifficulty - Difficulty.Debut;

                int level;

                switch (scoreDifficulty)
                {
                case Difficulty.Debut:
                    level = 7;
                    break;

                case Difficulty.Regular:
                    level = 13;
                    break;

                case Difficulty.Pro:
                    level = 17;
                    break;

                case Difficulty.Master:
                    level = 24;
                    break;

                case Difficulty.MasterPlus:
                    level = 30;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                txtLevel.Text = level.ToString();
            }

            {
                cboColor.Items.Clear();

                var musicColors = new[] { MusicColor.Cute, MusicColor.Cool, MusicColor.Passion, MusicColor.Multicolor };

                foreach (var c in musicColors)
                {
                    cboColor.Items.Add(DescribedEnumConverter.GetEnumDescription(c));
                }

                cboColor.SelectedIndex = 3; // multicolor
            }

            {
                cboFormat.Items.Clear();

                var formats = new[] { TxtScoreFormat.Default, TxtScoreFormat.Converted };

                foreach (var f in formats)
                {
                    cboFormat.Items.Add(DescribedEnumConverter.GetEnumDescription(f));
                }

                cboFormat.SelectedIndex = 1; // converted
            }

            {
                saveFileDialog.OverwritePrompt = true;
                saveFileDialog.ValidateNames   = true;
                saveFileDialog.Filter          = LanguageManager.TryGetString("misc.filter.deleste.txt") ?? "Deleste TXT Beatmap (*.txt)|*.txt";
            }
        }