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 CreateSentenceMarkerRectangle(int startBeat, int endBeat, string label) { SentenceMarkerRectangle sentenceMarkerRectangle = Instantiate(sentenceMarkerRectanglePrefab, sentenceMarkerRectangleContainer); RectTransform rectTransform = sentenceMarkerRectangle.GetComponent <RectTransform>(); float xStart = (float)noteArea.GetHorizontalPositionForBeat(startBeat); float xEnd = (float)noteArea.GetHorizontalPositionForBeat(endBeat); rectTransform.anchorMin = new Vector2(xStart, 0); rectTransform.anchorMax = new Vector2(xEnd, 1); rectTransform.anchoredPosition = Vector2.zero; rectTransform.sizeDelta = Vector2.zero; sentenceMarkerRectangle.GetComponentInChildren <Text>().text = label; }
private void PositionUiIssue(EditorUiIssue uiIssue, int beat) { RectTransform uiIssueRectTransform = uiIssue.GetComponent <RectTransform>(); float xPercent = (float)noteArea.GetHorizontalPositionForBeat(beat); float anchorWidth = issuePrefabWidthInPixels / uiIssueContainer.rect.width; uiIssueRectTransform.anchorMin = new Vector2(xPercent, 0); uiIssueRectTransform.anchorMax = new Vector2(xPercent + anchorWidth, 1); uiIssueRectTransform.anchoredPosition = Vector2.zero; uiIssueRectTransform.sizeDelta = Vector2.zero; }