示例#1
0
 private void HighlightNotes()
 {
     foreach (var judgeline in judgeLines)
     {
         foreach (var note in judgeline.notesAbove)
         {
             if (!note.IsHighlighted)
             {
                 PhiNote sameTimingNote = FindSameTiming(note);
                 if (sameTimingNote != null)
                 {
                     note.IsHighlighted = sameTimingNote.IsHighlighted = true;
                     continue;
                 }
             }
         }
         foreach (var note in judgeline.notesBelow)
         {
             if (!note.IsHighlighted)
             {
                 PhiNote sameTimingNote = FindSameTiming(note);
                 if (sameTimingNote != null)
                 {
                     note.IsHighlighted = sameTimingNote.IsHighlighted = true;
                     continue;
                 }
             }
         }
     }
 }
示例#2
0
        private PhiNote FindSameTiming(PhiNote note)
        {
            //Will find a better algorithm to do this
            int foundindex;

            foreach (var judgeline in judgeLines)
            {
                foundindex = judgeline.notesAbove.BinarySearch(note, comparer);
                if (foundindex >= 0)
                {
                    if (note.IsTheSameAs(judgeline.notesAbove[foundindex]))
                    {
                        try { if (note == judgeline.notesAbove[foundindex - 1])
                              {
                                  return(judgeline.notesAbove[foundindex - 1]);
                              }
                        } catch {};
                        try { if (note == judgeline.notesAbove[foundindex + 1])
                              {
                                  return(judgeline.notesAbove[foundindex + 1]);
                              }
                        } catch {};
                    }
                    else
                    {
                        return(judgeline.notesAbove[foundindex]);
                    }
                }

                foundindex = judgeline.notesBelow.BinarySearch(note, comparer);
                if (foundindex >= 0)
                {
                    if (note.IsTheSameAs(judgeline.notesBelow[foundindex]))
                    {
                        try { if (note == judgeline.notesBelow[foundindex - 1])
                              {
                                  return(judgeline.notesBelow[foundindex - 1]);
                              }
                        } catch {};
                        try { if (note == judgeline.notesBelow[foundindex + 1])
                              {
                                  return(judgeline.notesBelow[foundindex + 1]);
                              }
                        } catch {};
                        continue;
                    }
                    else
                    {
                        return(judgeline.notesBelow[foundindex]);
                    }
                }
            }
            return(null);
        }
示例#3
0
        private int GetCombo()
        {
            float second = AudioManager.Instance.Timing;
            CompareNoteByTimeAndHoldTime comparer = new CompareNoteByTimeAndHoldTime();
            int combo = 0;

            foreach (var judgeline in PhiChartFileReader.Instance.CurrentChart.JudgeLineList)
            {
                float   time      = PhiUnitConvert.secondToTime(second, judgeline.bpm);
                PhiNote dummyNote = new PhiNote(time);

                int found = judgeline.notesAbove.BinarySearch(dummyNote, comparer);
                //If current timing doesn't matches exactly with one note BinarySearch returns the bitwise complement of index of the next note
                combo += (found >= 0) ? found + 1 : -found - 1;

                found  = judgeline.notesBelow.BinarySearch(dummyNote, comparer);
                combo += (found >= 0) ? found + 1 : -found - 1;
                // Debug.Log(dummyNote.time + " " + found + " " + combo + " " + judgeline.numOfNotes);
            }
            return(combo);
        }