Exemple #1
0
    public void UpdateData()
    {
        var colEntry = view.data.GetPatternColumn(view.data.currentPattern, channel);

        for (int i = 0; i < dataEntries.Length; i++)
        {
            UpdateHighlight(i);
            Text label = dataEntries [i].GetComponentInChildren <Text> ( );
            if (colEntry == null)
            {
                label.text  = "-";
                label.color = Color.white;
                continue;
            }
            int val = colEntry.data [line, i];
            if (val < 0)
            {
                label.text  = "-";
                label.color = Color.white;
                continue;
            }

            string text  = System.String.Empty;
            Color  color = Color.white;
            switch (i)
            {
            case 0:
                int off = view.data.GetTransposeOffset(channel);
                off   = Mathf.Clamp((off + 12) / 2, 0, 12);
                color = transposeGradient.Evaluate(off / 12f);

                text = VirtualKeyboard.FormatNote(val);
                break;

            case 1:
                color = val < view.instruments.presets.Length ? validInstrument : invalidInstrument;
                text  = val.ToString("X2");
                break;

            case 2:
                color = volumeGradient.Evaluate(val / 15f);
                text  = val.ToString("X");
                break;

            case 3:
            case 4:
                color = effectColor;
                text  = val.ToString("X2");
                break;
            }

            label.color = color;
            label.text  = text;
        }
    }