Example #1
0
    void RhythmGameBtnTouch(RhythmGameBtnTouchMsg msg)
    {
        if (msg.isRight)
        {
            rightOver.SetActive(true);
            StartCoroutine(ButtonOverClose(rightOver));

            RhythmNote tempRhythmNote = RhythmNote.None;
            int        minValue       = -1;
            int        noteIndex      = 0;
            for (int i = 0; i < RightNote.Length; i++)
            {
                if (RightNote[i] != null)
                {
                    int tempNum = RightNote[i].GetComponent <RhythmGameNote_Controller>().noteCount;
                    if (minValue == -1)
                    {
                        noteIndex = i;
                        minValue  = tempNum;
                    }
                    else if (minValue > tempNum)
                    {
                        noteIndex = i;
                        minValue  = tempNum;
                    }
                }
            }
            if (RightNote[noteIndex] == null)
            {
                return;
            }

            tempRhythmNote = RightNote[noteIndex].GetComponent <RhythmGameNote_Controller>().rhythmNote;
            if (tempRhythmNote != RhythmNote.None && tempRhythmNote != RhythmNote.Miss)
            {
                RhythmGameNoteDelete(new RhythmGameNoteDeleteMsg(tempRhythmNote, noteIndex, RightNote[noteIndex], true, false));
            }
        }
        else
        {
            leftOver.SetActive(true);
            StartCoroutine(ButtonOverClose(leftOver));
            RhythmNote tempRhythmNote = RhythmNote.None;
            int        minValue       = -1;
            int        noteIndex      = 0;
            for (int i = 0; i < LeftNote.Length; i++)
            {
                if (LeftNote[i] != null)
                {
                    int tempNum = LeftNote[i].GetComponent <RhythmGameNote_Controller>().noteCount;
                    if (minValue == -1)
                    {
                        noteIndex = i;
                        minValue  = tempNum;
                    }
                    else if (minValue > tempNum)
                    {
                        noteIndex = i;
                        minValue  = tempNum;
                    }
                }
            }
            if (LeftNote[noteIndex] == null)
            {
                return;
            }

            tempRhythmNote = LeftNote[noteIndex].GetComponent <RhythmGameNote_Controller>().rhythmNote;
            if (tempRhythmNote != RhythmNote.None && tempRhythmNote != RhythmNote.Miss)
            {
                RhythmGameNoteDelete(new RhythmGameNoteDeleteMsg(tempRhythmNote, noteIndex, LeftNote[noteIndex], false, false));
            }
        }
    }
    void RhythmGameBtnTouch(RhythmGameBtnTouchMsg msg)
    {
        if (msg.isRight)
        {
            RhythmNote tempRhythmNote = RhythmNote.None;
            int        minValue       = -1;
            int        noteIndex      = 0;
            for (int i = 0; i < RightNote.Length; i++)
            {
                if (RightNote[i] != null)
                {
                    int tempNum = RightNote[i].GetComponent <RhythmGameNote_Controller>().noteCount;
                    if (minValue == -1)
                    {
                        noteIndex = i;
                        minValue  = tempNum;
                    }
                    else if (minValue > tempNum)
                    {
                        noteIndex = i;
                        minValue  = tempNum;
                    }
                }
            }
            if (RightNote[noteIndex] == null)
            {
                return;
            }

            tempRhythmNote = RightNote[noteIndex].GetComponent <RhythmGameNote_Controller>().rhythmNote;
            if (tempRhythmNote != RhythmNote.None)
            {
                RhythmGameNoteDelete(new RhythmGameNoteDeleteMsg(tempRhythmNote, noteIndex, RightNote[noteIndex], true, false));
            }
        }
        else
        {
            RhythmNote tempRhythmNote = RhythmNote.None;
            int        minValue       = -1;
            int        noteIndex      = 0;
            for (int i = 0; i < LeftNote.Length; i++)
            {
                if (LeftNote[i] != null)
                {
                    int tempNum = LeftNote[i].GetComponent <RhythmGameNote_Controller>().noteCount;
                    if (minValue == -1)
                    {
                        noteIndex = i;
                        minValue  = tempNum;
                    }
                    else if (minValue > tempNum)
                    {
                        noteIndex = i;
                        minValue  = tempNum;
                    }
                }
            }
            if (LeftNote[noteIndex] == null)
            {
                return;
            }

            tempRhythmNote = LeftNote[noteIndex].GetComponent <RhythmGameNote_Controller>().rhythmNote;
            if (tempRhythmNote != RhythmNote.None)
            {
                RhythmGameNoteDelete(new RhythmGameNoteDeleteMsg(tempRhythmNote, noteIndex, LeftNote[noteIndex], false, false));
            }
        }
    }