Exemple #1
0
    private void DrawSentencesInVoice(Voice voice)
    {
        int             viewportWidthInBeats   = noteArea.MaxBeatInViewport - noteArea.MinBeatInViewport;
        List <Sentence> sortedSentencesOfVoice = voiceToSortedSentencesMap[voice];

        int sentenceIndex = 0;

        foreach (Sentence sentence in sortedSentencesOfVoice)
        {
            if (noteArea.IsInViewport(sentence))
            {
                float xStartPercent = (float)noteArea.GetHorizontalPositionForBeat(sentence.MinBeat);
                float xEndPercent   = (float)noteArea.GetHorizontalPositionForBeat(sentence.ExtendedMaxBeat);

                // Do not draw the sentence marker lines, when there are too many beats
                if (viewportWidthInBeats < 1200)
                {
                    CreateSentenceMarkerLine(xStartPercent, Colors.saddleBrown, 0);
                    CreateSentenceMarkerLine(xEndPercent, Colors.black, 20);
                }

                CreateUiSentence(sentence, xStartPercent, xEndPercent, sentenceIndex);
            }
            sentenceIndex++;
        }
    }
    private void UpdateSentences()
    {
        if (!gameObject.activeInHierarchy)
        {
            return;
        }
        sentenceLinesImage.ClearTexture();
        sentenceMarkerRectangleContainer.DestroyAllDirectChildren();

        int viewportWidthInBeats = noteArea.MaxBeatInViewport - noteArea.MinBeatInViewport;

        int sentenceIndex = 0;

        foreach (Sentence sentence in sortedSentencesOfAllVoices)
        {
            if (noteArea.IsInViewport(sentence))
            {
                int startBeat = sentence.MinBeat;
                int endBeat   = Math.Max(sentence.MaxBeat, sentence.LinebreakBeat);

                // Do not draw the sentence marker lines, when there are too many beats
                if (viewportWidthInBeats < 1200)
                {
                    CreateSentenceMarkerLine(startBeat, Colors.red, 0);
                    CreateSentenceMarkerLine(endBeat, Colors.black, 20);
                }

                string label = (sentenceIndex + 1).ToString();
                CreateSentenceMarkerRectangle(startBeat, endBeat, label);
            }
            sentenceIndex++;
        }

        sentenceLinesImage.ApplyTexture();
    }