// Use this for initialization void Start() { for (int i = 0; i < 12; i++) { colorsInOrder.Add(Color.red); } for (int i = 0; i < colorsOfNotes.Count; i++) { Color c = colorsOfNotes[i]; if (i % 2 == 1) { colorsInOrder[(i + 6) % 12] = c; } else { colorsInOrder[i] = c; } } lastXNotes = new CircularBuffer <int>(numNotes); for (int i = 0; i < numNotes; i++) { lastXNotes[i] = -1; } for (int i = -1; i < 12; i++) { SortablePair s = new SortablePair(i, 0); noteDict[i] = s; } //myColorSphere = GetComponent<ColorSpheres>(); //myColorSphere.SpawnCircle(); }
public void UpdateNote(int newNote) { //decrement the count of the note to be removed DecrementCount(lastXNotes[circularIndex]); lastXNotes[circularIndex] = newNote; IncrementCount(newNote); circularIndex++; noteCounts.Clear(); foreach (var item in noteDict) { if (item.Key == -1) { continue; } noteCounts.Enqueue(item.Value); } string str = "Sorted :\n"; Dictionary <int, int> rankings = new Dictionary <int, int>(); int index = noteCounts.Count - 1; while (noteCounts.Count > 0) { SortablePair s = noteCounts.Dequeue(); rankings[s.note] = index--; str += "Note: " + s.note + "Rank: " + rankings[s.note] + " Count: " + s.count + " ||||| "; } //Debug.Log(str); //myColorSphere.GrowCircle(noteDict, numNotes); }
void Start() { foreach (var item in GameObject.FindObjectsOfType <NoteVisualizers>()) { if (item.gameObject.activeInHierarchy) { allNoteVisualizers.Add(item); } } foreach (var item in allNoteVisualizers) { songData[item.name] = new DataPortion(); for (int i = -1; i < 12; i++) { SortablePair s = new SortablePair(i, 0); songData[item.name].noteDict[i] = s; } } }
public int CompareTo(object obj) { SortablePair pair = (SortablePair)(obj); return(CompareTo(pair.count)); }