Esempio n. 1
0
        private async Task SelectArrangement_Impl(ShowLightType type)
        {
            string filename = services.OpenFileDialog($"Select Rocksmith 2014 XML File For {type} Colors Generation", "Rocksmith 2014 XML files|*.xml");

            if (filename is not null && await XmlHelper.ValidateRootElementAsync(filename, "song"))
            {
                ArrangementSelected = true;

                if (type == ShowLightType.Beam)
                {
                    ArrangementForBeamsFilename = filename;

                    if (string.IsNullOrEmpty(ArrangementForFogFilename))
                    {
                        ArrangementForFogFilename = filename;
                    }
                }
                else
                {
                    ArrangementForFogFilename = filename;

                    if (string.IsNullOrEmpty(ArrangementForBeamsFilename))
                    {
                        ArrangementForBeamsFilename = filename;
                    }
                }
            }
        }
Esempio n. 2
0
        private void GenerateShowlights(List <ShowLight> showlights, ShowLightType type)
        {
            ClearNotesofType(showlights, type);

            var arrData = GetArrangementData(arrangementFilenames[type]);

            if (type == ShowLightType.Fog)
            {
                showlights.AddRange(GenerateFogNotes(arrData));
            }
            else
            {
                showlights.AddRange(GenerateBeamNotes(arrData, showlights));
            }

            ValidateFirstNoteOfType(showlights, type);
        }
Esempio n. 3
0
        // Ensures that at least one note of the type is present and moves the first note to the start of the beatmap.
        private void ValidateFirstNoteOfType(List <ShowLight> showlights, ShowLightType showlightType)
        {
            int firstNoteIndex = showlights.FindIndex(sl => sl.GetShowLightType() == showlightType);

            if (firstNoteIndex == -1)
            {
                // Add new random note if not found
                showlights.Insert(0,
                                  new ShowLight(FirstBeatTime,
                                                showlightType == ShowLightType.Fog ? FogGenerationFunctions.GetRandomFogNote() : BeamGenerationFunctions.GetRandomBeamNote())
                                  );
            }
            else if (showlights[firstNoteIndex].Time != FirstBeatTime)
            {
                // Move first note to start of the beatmap
                showlights[firstNoteIndex] = new ShowLight(FirstBeatTime, showlights[firstNoteIndex].Note);
            }
        }
Esempio n. 4
0
 private static void ClearNotesofType(List <ShowLight> showlights, ShowLightType type)
 => showlights.RemoveAll(sl => sl.GetShowLightType() == type);
Esempio n. 5
0
 private ShowLightViewModel FindActiveOrFirstShowlightOfType(ShowLightType type, float time)
 => ObservableShowlights.LastOrDefault(sl => sl.ShowlightType == type && sl.Time <= time) ??
 ObservableShowlights.FirstOrDefault(sl => sl.ShowlightType == type);