示例#1
0
    public bool CanMoveToPreviousSentence(List <Note> selectedNotes, Note targetNote)
    {
        if (selectedNotes.Count != 1)
        {
            return(false);
        }

        Note selectedNote = selectedNotes[0];

        if (selectedNote != targetNote || selectedNote.Sentence == null)
        {
            return(false);
        }

        // Check that the selected note is the first note in the sentence.
        List <Note> notesInSentence = new List <Note>(selectedNote.Sentence.Notes);

        notesInSentence.Sort(Note.comparerByStartBeat);
        if (notesInSentence.First() != selectedNote)
        {
            return(false);
        }

        // Check that there exists a previous sentence
        Sentence previousSentence = SongMetaUtils.GetPreviousSentence(selectedNote.Sentence);

        return(previousSentence != null);
    }
示例#2
0
    public void MoveToPreviousSentence(Note targetNote)
    {
        Sentence oldSentence = targetNote.Sentence;

        Sentence previousSentence = SongMetaUtils.GetPreviousSentence(targetNote.Sentence);

        targetNote.SetSentence(previousSentence);

        // Remove old sentence if not more notes left
        if (oldSentence.Notes.Count == 0)
        {
            oldSentence.SetVoice(null);
        }
        else
        {
            oldSentence.FitToNotes();
        }
    }