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]);
    }
Beispiel #2
0
    // F    : F, A, C      - 0, 4, 7
    // Fm   : F, Ab,C      - 0, 3, 7
    // F7   : F, A, C, Eb  - 0, 4, 7, 10
    // Fmaj7: F, A, C, E   - 0, 4, 7, 11
    // Fmin7: F, Ab,C, Eb  - 0, 3, 7, 10
    // Fm7b5: F, Ab,B, Eb  - 0, 3, 6, 10
    public void SetKeyIndex(WheelPart key)
    {
        List <string> chordsList    = new List <string>();
        List <string> currentNotes  = Constants.NoteStringAssociations[key.Key];
        int           startIndex    = GetNoteIndex(key.Key);
        List <int>    offsetIndices = GetOffsetIndices(startIndex);

        for (int i = 0, count = Constants.ACTIVE_INDICES.Count; i < count; ++i)
        {
            int currentNoteIndex =
                ComputeIndex(Constants.ACTIVE_INDICES[i] + startIndex);
            string baseNote = currentNotes[currentNoteIndex];

            bool majorThree =
                offsetIndices.Contains(ComputeIndex(currentNoteIndex + 4));
            bool flatThree =
                offsetIndices.Contains(ComputeIndex(currentNoteIndex + 3));
            bool flatFive =
                offsetIndices.Contains(ComputeIndex(currentNoteIndex + 6));
            bool majorFive =
                offsetIndices.Contains(ComputeIndex(currentNoteIndex + 7));
            bool sharpFive =
                offsetIndices.Contains(ComputeIndex(currentNoteIndex + 8));
            bool majorSeven =
                offsetIndices.Contains(ComputeIndex(currentNoteIndex + 11));
            bool flatSeven =
                offsetIndices.Contains(ComputeIndex(currentNoteIndex + 10));

            if (majorThree && majorFive)
            {
                chordsList.Add(baseNote);
            }

            if (flatThree && !flatFive)
            {
                chordsList.Add(baseNote + "m");
            }

            if (!flatThree && !flatFive && flatSeven)
            {
                chordsList.Add(baseNote + "7");
            }

            if (majorThree && majorFive && majorSeven)
            {
                chordsList.Add(baseNote + "maj7");
            }

            if (flatThree && !flatFive && flatSeven)
            {
                chordsList.Add(baseNote + "m7");
            }

            if (flatThree && flatFive && flatSeven)
            {
                chordsList.Add(baseNote + "m7b5");
            }
        }
        display.text = string.Join("\n", chordsList.ToArray());
    }
    public void SetKeyIndex(WheelPart key)
    {
        List <string> noteNames    = Constants.NoteStringAssociations[key.Key];
        int           startIndex   = previousNoteAssociations.IndexOf(key.Key);
        int           currentIndex = startIndex;

        for (int i = 0, count = WheelParts.Count; i < count; ++i)
        {
            WheelPart part = WheelParts[i];
            part.SetNoteLabel(noteNames[currentIndex]);
            currentIndex = currentIndex >= noteNames.Count - 1 ? 0 : currentIndex + 1;
        }
        previousNoteAssociations = noteNames;
        KeyOfText.text           = WheelParts[0].Key;
        chordsComponent.SetKeyIndex(WheelParts[0]);
    }
Beispiel #4
0
 public void SetKeyIndex(WheelPart key)
 {
     currentDisplayMode.SetKeyIndex(key);
 }
 public void SetKeyIndex(WheelPart key)
 {
     SetKeyIndex(WheelParts.IndexOf(key));
 }
Beispiel #6
0
    public MotorPart motor;     //马达零件

    //重置方法
    public void Reset()
    {
        wheel = Resources.Load <WheelPart>(wheelPath + "DefaultWheel");
        cover = Resources.Load <CoverPart>(coverPath + "DefaultCover");
        motor = Resources.Load <MotorPart>(motorPath + "DefaultMotor");
    }