protected virtual UiNote CreateUiNote(Note note)
    {
        if (note.StartBeat == note.EndBeat)
        {
            return(null);
        }

        UiNote uiNote = Instantiate(uiNotePrefab, uiNotesContainer);

        uiNote.Init(note, uiEffectsContainer);
        if (micProfile != null)
        {
            uiNote.SetColorOfMicProfile(micProfile);
        }

        Text   uiNoteText = uiNote.lyricsUiText;
        string pitchName  = MidiUtils.GetAbsoluteName(note.MidiNote);

        if (settings.GraphicSettings.showLyricsOnNotes && showPitchOfNotes)
        {
            uiNoteText.text = GetDisplayText(note) + " (" + pitchName + ")";
        }
        else if (settings.GraphicSettings.showLyricsOnNotes)
        {
            uiNoteText.text = GetDisplayText(note);
        }
        else if (showPitchOfNotes)
        {
            uiNoteText.text = pitchName;
        }
        else
        {
            uiNoteText.text = "";
        }

        RectTransform uiNoteRectTransform = uiNote.RectTransform;

        PositionUiNote(uiNoteRectTransform, note.MidiNote, note.StartBeat, note.EndBeat);

        noteToUiNoteMap[note] = uiNote;

        return(uiNote);
    }
示例#2
0
    private void CreateUiNote(Note note)
    {
        if (note.StartBeat == note.EndBeat)
        {
            return;
        }

        UiNote uiNote = Instantiate(uiNotePrefab, uiNotesContainer);

        uiNote.Init(note, uiEffectsContainer);
        if (micProfile != null)
        {
            uiNote.SetColorOfMicProfile(micProfile);
        }

        Text   uiNoteText = uiNote.GetComponentInChildren <Text>();
        string pitchName  = MidiUtils.GetAbsoluteName(note.MidiNote);

        if (showLyricsOfNotes && showPitchOfNotes)
        {
            uiNoteText.text = note.Text + " (" + pitchName + ")";
        }
        else if (showLyricsOfNotes)
        {
            uiNoteText.text = note.Text;
        }
        else if (showPitchOfNotes)
        {
            uiNoteText.text = pitchName;
        }
        else
        {
            uiNoteText.text = "";
        }

        RectTransform uiNoteRectTransform = uiNote.GetComponent <RectTransform>();

        PositionUiNote(uiNoteRectTransform, note.MidiNote, note.StartBeat, note.EndBeat);
    }