示例#1
0
        // Token: 0x06000121 RID: 289 RVA: 0x00006588 File Offset: 0x00004788
        public int nextNIndex(int Offset, NoteTrack Notes)
        {
            int result;

            if (Notes == null)
            {
                result = 0;
            }
            else
            {
                int i;
                for (i = this.nearNIndex(Offset, Notes); i < Notes.Count <Note>(); i++)
                {
                    if (Notes[i].Offset > Offset)
                    {
                        return(i);
                    }
                }
                result = i - 1;
            }
            return(result);
        }
示例#2
0
        // Token: 0x0600011F RID: 287 RVA: 0x000063B4 File Offset: 0x000045B4
        public int nearNIndexEnd(int Offset, NoteTrack Notes, int fret)
        {
            int result;

            if (Notes == null)
            {
                result = 0;
            }
            else
            {
                int num  = 0;
                int num2 = Notes.Count(fret) - 1;
                switch (num2)
                {
                case -1:
                case 0:
                    result = 0;
                    break;

                case 1:
                {
                    int num3 = Math.Abs(Notes[0, fret].OffsetEnd - Offset);
                    int num4 = Math.Abs(Notes[1, fret].OffsetEnd - Offset);
                    if (num3 >= num4)
                    {
                        result = 1;
                    }
                    else
                    {
                        result = 0;
                    }
                    break;
                }

                default:
                {
                    int num5 = num2 / 2;
                    while (Notes[num5, fret].OffsetEnd != Offset)
                    {
                        num5 = (num + num2) / 2;
                        if (Notes[num5, fret].OffsetEnd > Offset)
                        {
                            num2 = num5;
                        }
                        else
                        {
                            num = num5;
                        }
                        if (num2 - num <= 1)
                        {
                            int num6 = Math.Abs(Notes[num5, fret].OffsetEnd - Offset);
                            int num7 = Math.Abs(Notes[num5 - 1, fret].OffsetEnd - Offset);
                            int num8 = Math.Abs(Notes[num5 + 1, fret].OffsetEnd - Offset);
                            if (num6 <= num7 && num6 <= num8)
                            {
                                return(num5);
                            }
                            if (num7 <= num8)
                            {
                                return(num5 - 1);
                            }
                            return(num5 + 1);
                        }
                    }
                    result = num5;
                    break;
                }
                }
            }
            return(result);
        }