コード例 #1
0
    private void SetKeyIndex(int index)
    {
        int currentIndex     = index;
        int currentNoteIndex = 0;

        for (int i = 0, count = WheelParts.Count; i < count; ++i)
        {
            bool      isActive         = Constants.ACTIVE_INDICES.Contains(i);
            WheelPart currentWheelpart = WheelParts[currentIndex];
            currentWheelpart.SetIsKey(i == 0);
            currentWheelpart.SetActive(isActive);

            Text currentNoteLabel = NoteLabels[i];
            currentNoteLabel.text = Constants.NoteIntAssociations[index][i];

            Text currentNoteNumber = NoteNumbers[currentIndex];
            currentNoteNumber.text = string.Empty;
            if (isActive)
            {
                if (Constants.NOTE_NUMBERS[currentNoteIndex] != null)
                {
                    currentNoteNumber.text = Constants.NOTE_NUMBERS[currentNoteIndex];
                }
                ++currentNoteIndex;
            }

            currentIndex = currentIndex + 1 >= count ? 0 : currentIndex + 1;
        }
        KeyOfText.text = WheelParts[index].Key;
        chordsComponent.SetKeyIndex(WheelParts[index]);
    }