public GetMaxDifficulty ( |
||
xml | ||
return |
public Showlights(DLCPackageData info) : this() { // using max difficulty level and // arrangement with most notes and chords for good results // bass arrangement usually has few chords so not much use int maxArrNdx = 0; int maxNoteChordCount = 0; for (int i = 0, arrCnt = info.Arrangements.Count; i < arrCnt; i++) { if (info.Arrangements[i].ArrangementType == ArrangementType.Vocal) continue; if (info.Arrangements[i].ArrangementType == ArrangementType.ShowLight) continue; if (info.Arrangements[i].SongXml.File == null) continue; // use max difficulty level with most notes and chords var song = Song2014.LoadFromFile(info.Arrangements[i].SongXml.File); var mf = new ManifestFunctions(GameVersion.RS2014); int maxDif = mf.GetMaxDifficulty(song); int noteCount = song.Levels[maxDif].Notes.Count(); int chordCount = song.Levels[maxDif].Chords.Count(); int noteChordCount = noteCount + chordCount; if (noteChordCount > maxNoteChordCount) maxArrNdx = i; } DoTheThing(info, info.Arrangements[maxArrNdx]); }
/// <summary> /// Showlights Generator Rev2 /// max difficulty with most notes and chords /// </summary> /// <param name="xmlFile">Xml file.</param> public Showlights Generate(string xmlFile) { var midiNotes = new List<Showlight>(); var chordNotes = new List<Showlight>(); var song = Song2014.LoadFromFile(xmlFile); // If vocals if (song.Phrases == null || song.Tuning == null) return null; //Generate ShowlightList var tuning = song.Tuning.ToArray(); if (song.Levels != null) { var mf = new ManifestFunctions(GameVersion.RS2014); int maxDif = mf.GetMaxDifficulty(song); for (int i = 0; i < song.Levels[maxDif].Notes.Length; i++) { var mNote = Sng2014FileWriter.GetMidiNote(tuning, (Byte)song.Levels[maxDif].Notes[i].String, (Byte)song.Levels[maxDif].Notes[i].Fret, song.Arrangement == "Bass", song.Capo); midiNotes.Add(new Showlight { Time = song.Levels[maxDif].Notes[i].Time, Note = mNote }); } for (int i = 0; i < song.Levels[maxDif].Chords.Length; i++) { if (song.Levels[maxDif].Chords[i].HighDensity == 1) continue; //speedhack int mNote = Sng2014FileWriter.getChordNote(tuning, song.Levels[maxDif].Chords[i], song.ChordTemplates, song.Arrangement == "Bass", song.Capo); chordNotes.Add(new Showlight { Time = song.Levels[maxDif].Chords[i].Time, Note = mNote }); } } PopShList(midiNotes); PopShList(chordNotes); return this; }