コード例 #1
0
 public void buttonSet108Events(object sender, EventArgs e)
 {
     ExecAndRestoreTrackDifficulty(delegate()
     {
         var genConfig = new GenDiffConfig(SelectedSong,
                     true, checkGenDiffCopyGuitarToBass.Checked,
                     checkBoxInitSelectedDifficultyOnly.Checked,
                     checkBoxInitSelectedTrackOnly.Checked,
                     Utility.HandPositionGenerationEnabled);
         if (genConfig.Generate108Events)
         {
             if (!Set108Events(genConfig))
             {
                 MessageBox.Show("Failed");
             }
             Refresh108EventList();
         }
         if (Utility.ClearChordNames)
         {
             EditorPro.GuitarTrack.ClearChordNames();
         }
         else
         {
             EditorPro.GuitarTrack.CreateChordNames(GuitarTuning, BassTuning);
         }
     });
 }
コード例 #2
0
        public bool Set108Events(GenDiffConfig config)
        {
            bool ret = false;

            if (!EditorPro.IsLoaded)
                return ret;

            if (!config.Generate108Events)
                return true;

            try
            {
                var tracks = new List<Track>();
                if (config.SelectedTrackOnly)
                {
                    if (EditorPro.SelectedTrack != null)
                    {
                        tracks.Add(EditorPro.SelectedTrack);
                    }
                }
                else
                {
                    tracks.AddRange(EditorPro.GetTracks(GuitarTrack.TrackNames6));
                }
                foreach (var t in tracks)
                {
                    if (EditorPro.SetTrack(t, GuitarDifficulty.Expert))
                    {
                        EditorPro.GuitarTrack.CreateHandPositionEvents();
                        if (Utility.ClearChordNames)
                        {
                            EditorPro.GuitarTrack.ClearChordNames();
                        }
                        else
                        {
                            EditorPro.GuitarTrack.CreateChordNames(GuitarTuning, BassTuning);
                        }
                    }
                }
                ret = true;
            }
            catch { ret = false; }

            return ret;
        }
コード例 #3
0
        public bool GenerateCompletedDifficulties()
        {
            progressBarGenCompletedDifficulty.Value = 0;

            var songs = SongList.GetBatchSongList(checkBoxMultiSelectionSongList.Checked);

            progressBarGenCompletedDifficulty.Maximum = songs.Count();

            foreach (var item in songs.ToList())
            {
                Application.DoEvents();

                WriteBatchResult("Generating Difficulties: " + item.ToString());
                if (buttonSongLibCancel.Enabled == false)
                {
                    WriteBatchResult("User Cancelled");
                    return false;
                }
                try
                {
                    progressBarGenCompletedDifficulty.Value = songs.IndexOf(item);
                }
                catch { }

                if ((checkBoxBatchProcessIncomplete.Checked == false && !item.IsComplete) ||
                    (checkBoxBatchProcessFinalized.Checked == false && item.IsFinalized))
                {
                    WriteBatchResult("Skipping: " + item.ToString());
                }
                else
                {
                    WriteBatchResult("Processing: " + item.ToString());
                    try
                    {
                        if (!OpenSongCacheItem(item))
                        {
                            WriteBatchResult("Unable to open: " + item.ToString());
                            continue;
                        }

                        if (checkBoxSkipGenIfEasyNotes.Checked &&
                            hasEasyMedHardEvent6())
                        {
                            WriteBatchResult("Skipping (already calculated): " + item.ToString());
                        }
                        else
                        {
                            var config = new GenDiffConfig(item,
                                true,
                                checkBoxSongLibCopyGuitar.Checked,
                                false,
                                false,
                                Utility.HandPositionGenerationEnabled);

                            if (!GenerateDifficulties(true, config))
                            {
                                WriteBatchResult("Gen Difficulty Failed: " + item.ToString());
                                continue;
                            }

                            if (!SaveSongCacheItem(item, true))
                            {
                                WriteBatchResult("Failed Saving: " + item.ToString());
                                continue;
                            }
                        }

                    }
                    catch
                    {
                        WriteBatchResult("Error processing: " + item.ToString());
                    }
                }
            }

            WriteBatchResult("Batch Generate Difficulties Complete");

            return true;
        }
コード例 #4
0
        private bool GenerateDifficulties(bool isBatch, GenDiffConfig config)
        {
            var ret = false;

            if (!EditorG5.IsLoaded || !EditorPro.IsLoaded)
                return false;
            ExecAndRestoreTrackDifficulty(() =>
                {
                    try
                    {
                        var g5Track = EditorG5.GuitarTrack;
                        var proTrack = EditorPro.GuitarTrack;

                        EditorPro.BackupSequence();

                        bool genGuitar = false;
                        bool genBass = false;

                        bool selectedTrackGuitar = false;
                        bool selectedTrackBass = false;

                        if (config.SelectedTrackOnly)
                        {
                            if (proTrack.Name.IsGuitarTrackName6())
                            {
                                genGuitar = true;
                                selectedTrackGuitar = true;
                            }
                            else if (proTrack.Name.IsBassTrackName6())
                            {
                                genBass = true;
                                selectedTrackBass = true;
                            }
                        }
                        else
                        {
                            genGuitar = true;
                            genBass = config.CopyGuitarToBass == false;
                        }

                        var guitarDifficulties = GuitarDifficulty.None;
                        var bassDifficulties = GuitarDifficulty.None;

                        if (config.SelectedDifficultyOnly)
                        {
                            guitarDifficulties = EditorPro.CurrentDifficulty;
                            bassDifficulties = EditorPro.CurrentDifficulty;
                        }
                        else
                        {
                            if (config.ProcessingSong)
                            {
                                if (genGuitar)
                                {
                                    if (config.EnableProGuitarHard)
                                        guitarDifficulties |= GuitarDifficulty.Hard;
                                    if (config.EnableProGuitarMedium)
                                        guitarDifficulties |= GuitarDifficulty.Medium;
                                    if (config.EnableProGuitarEasy)
                                        guitarDifficulties |= GuitarDifficulty.Easy;
                                }
                                if (genBass)
                                {
                                    if (config.EnableProBassHard)
                                        bassDifficulties |= GuitarDifficulty.Hard;
                                    if (config.EnableProBassMedium)
                                        bassDifficulties |= GuitarDifficulty.Medium;
                                    if (config.EnableProBassEasy)
                                        bassDifficulties |= GuitarDifficulty.Easy;
                                }
                            }
                            else
                            {
                                if (genGuitar)
                                {
                                    guitarDifficulties = GuitarDifficulty.Hard | GuitarDifficulty.Medium | GuitarDifficulty.Easy;
                                }
                                if (genBass)
                                {
                                    bassDifficulties = GuitarDifficulty.Hard | GuitarDifficulty.Medium | GuitarDifficulty.Easy;
                                }
                            }
                        }

                        if (config.SelectedTrackOnly)
                        {
                            if (selectedTrackGuitar && genGuitar)
                            {
                                if (!guitarDifficulties.IsUnknownOrNone())
                                {
                                    GenerateDifficultiesForTrack(EditorG5.GuitarTrack.GetTrack(), EditorPro.GuitarTrack.GetTrack(), guitarDifficulties, config);
                                }
                            }
                            else if (selectedTrackBass && genBass)
                            {
                                if (!bassDifficulties.IsUnknownOrNone())
                                {
                                    GenerateDifficultiesForTrack(EditorG5.GuitarTrack.GetTrack(), EditorPro.GuitarTrack.GetTrack(), bassDifficulties, config);
                                }
                            }
                        }
                        else
                        {
                            if (genGuitar)
                            {
                                var gt5 = EditorG5.GetGuitar5MidiTrack();
                                var gt6 = EditorPro.GetTrackGuitar17();

                                if (gt5 != null && gt6 != null)
                                {
                                    GenerateDifficultiesForTrack(gt5, gt6, guitarDifficulties, config);
                                }

                                gt6 = EditorPro.GetTrackGuitar22();
                                if (gt5 != null && gt6 != null)
                                {
                                    GenerateDifficultiesForTrack(gt5, gt6, guitarDifficulties, config);
                                }
                            }

                            if (config.CopyGuitarToBass)
                            {
                                if (EditorPro.GetTrackGuitar17() != null)
                                {
                                    CopyTrack(GuitarTrack.GuitarTrackName17, GuitarTrack.BassTrackName17);
                                }
                                if (EditorPro.GetTrackGuitar22() != null)
                                {
                                    CopyTrack(GuitarTrack.GuitarTrackName22, GuitarTrack.BassTrackName22);
                                }
                            }
                            else if (genBass)
                            {
                                var gt5 = EditorG5.GetGuitar5BassMidiTrack();

                                var gt6 = EditorPro.GetTrackBass17();
                                if (gt5 != null && gt6 != null)
                                {
                                    GenerateDifficultiesForTrack(gt5, gt6, bassDifficulties, config);
                                }

                                gt6 = EditorPro.GetTrackBass22();
                                if (gt5 != null && gt6 != null)
                                {
                                    GenerateDifficultiesForTrack(gt5, gt6, bassDifficulties, config);
                                }
                            }
                        }

                        if (config.Generate108Events)
                        {
                            Set108Events(config);
                        }

                        ret = true;
                    }
                    catch { ret = false; }
                });
            return ret;
        }
コード例 #5
0
        private void GenDiffNotes(
            IEnumerable<GuitarChord> expertChords,
            IEnumerable<GuitarChord> sourceChords,
            IEnumerable<GuitarArpeggio> sourceArpeggio,
            GuitarDifficulty targetDifficulty, GenDiffConfig config)
        {
            var chords = sourceChords.Where(x => x.IsPureArpeggioHelper == false).ToList();
            CreateChords(expertChords, targetDifficulty, chords);

            if (targetDifficulty == GuitarDifficulty.Hard)
            {
                var owner = EditorPro.Messages;
                foreach (var arp in sourceArpeggio.Where(x => owner.Chords.AnyBetweenTick(x.TickPair)))
                {
                    GuitarArpeggio.CreateArpeggio(owner, arp.TickPair, targetDifficulty);
                }
            }
        }
コード例 #6
0
        private void GenerateDifficultiesForTrack(
            Track trackG5,
            Track trackG6,
            GuitarDifficulty guitarDifficulties,
            GenDiffConfig config)
        {
            if (guitarDifficulties.IsUnknownOrNone())
                return;

            var diffs = guitarDifficulties.GetDifficulties().Where(x => x.IsEasyMediumHard());

            EditorPro.SetTrack(trackG6, GuitarDifficulty.Expert);
            EditorG5.SetTrack(trackG5, GuitarDifficulty.Expert);

            var expertChords = EditorPro.Messages.Chords.ToList();

            foreach (var diff in diffs)
            {
                var sourceDifficulty =
                    diff == GuitarDifficulty.Easy ? GuitarDifficulty.Medium :
                    diff == GuitarDifficulty.Medium ? GuitarDifficulty.Hard :
                    GuitarDifficulty.Expert;

                EditorPro.CurrentDifficulty = sourceDifficulty;

                var sourceChords = EditorPro.Messages.Chords.ToList();
                var sourceArpeggio = EditorPro.Messages.Arpeggios.ToList();

                EditorPro.CurrentDifficulty = diff;
                EditorG5.CurrentDifficulty = diff;

                EditorPro.Messages.Chords.ToList().ForEach(x => x.DeleteAll());

                EditorPro.Messages.Arpeggios.Where(x => x.Difficulty == diff).ToList().ForEach(x => x.DeleteAll());

                GenDiffNotes(expertChords, sourceChords, sourceArpeggio, diff, config);

            }
        }