Esempio n. 1
0
    static IEnumerable <string> NotesheetToStrings(Song song, IEnumerable <NoteGroup> groups, Difficulty difficulty)
    {
        // Encabezado
        yield return(null);

        yield return(charComment + " Notesheet text importer/exporter v" + version);

        yield return(charComment + " Song: " + (song ? song.Title : "missingsong."));

        yield return(charComment + " Dificultad: " + difficulty);

        yield return(charComment + " Advertencia: Asegurarse de que el editor tenga " +
                     "\"Ajuste de línea\" desactivado para visualizar el texto correctamente.");

        yield return(null);

        yield return(charComment + string.Format(" {0} = Tiempo relativo en beats", charTime));

        yield return(charComment + string.Format(" {0} = Duración del grupo en beats (0 por defecto)", charDuration));

        yield return(charComment + string.Format(" {0}{1}{0} = Notas en ese grupo ({1} = nota, {0} = sin nota)", charNoteFalse, charNoteTrue));

        yield return(null);

        // Informar de las subdivisiones válidas:
        yield return(charComment + string.Format(" Los tiempos en beats se pueden fraccionar. Ej: 1{0}2", charFraction));

        string subdivisions = string.Join(" - ", Subdivision.GetDivisors().Select(d => d.ToString()).ToArray());

        yield return(charComment + " Divisores válidos: " + subdivisions);

        yield return(null);

        int inputLength = (int)difficulty;

        // Escribimos las líneas necesarias para
        foreach (var group in groups)
        {
            // Dejamos un espacio al principio de cada grupo
            yield return(null);


            // Tiempo
            // Devolvemos la línea de texto con el tiempo
            yield return(charTime + GetBeatTimeFraction(group.GetRelativeTime));


            // Duración:
            int duration = group.GetDuration;
            if (duration > 0)
            {
                yield return(charDuration + GetBeatTimeFraction(duration));
            }


            // Notas:

            // Devolvemos un línea con el array de notas de este grupo
            // Por ejemplo: 101 = Notas 0 y 2
            string notesText = string.Empty;
            for (int i = 0; i < inputLength; i++)
            {
                notesText += ((group.NoteBits & 1 << i) != 0) ? charNoteTrue : charNoteFalse;
            }
            yield return(notesText);
        }
    }