Esempio n. 1
0
    public static int GetNoteChannel(int note, InputChannel channel)
    {
        if (channel == InputChannel.ExternalKeyboard ||
            channel == InputChannel.InGameKeyboard ||
            channel == InputChannel.InGamePiano)
        {
            return(channel.ToInt());
        }

        if (channel == InputChannel.LeftHand)
        {
            if (DictLeftHand.ContainsKey(note))
            {
                if (DictLeftHand[note])
                {
                    DictLeftHand[note] = false;
                    return(4);
                }
                else
                {
                    DictLeftHand[note] = true;
                    return(3);
                }
            }
            else
            {
                DictLeftHand.Add(note, true);
                return(3);
            }
        }

        if (channel == InputChannel.RightHand)
        {
            if (DictRightHand.ContainsKey(note))
            {
                if (DictRightHand[note])
                {
                    DictRightHand[note] = false;
                    return(6);
                }
                else
                {
                    DictRightHand[note] = true;
                    return(5);
                }
            }
            else
            {
                DictRightHand.Add(note, true);
                return(5);
            }
        }

        if (channel == InputChannel.Voice)
        {
            if (DictVoice.ContainsKey(note))
            {
                if (DictVoice[note])
                {
                    DictVoice[note] = false;
                    return(8);
                }
                else
                {
                    DictVoice[note] = true;
                    return(7);
                }
            }
            else
            {
                DictVoice.Add(note, true);
                return(7);
            }
        }

        Debug.LogWarning("GetNoteChannel note " + note + " channel " + channel);
        return(channel.ToInt());
    }