示例#1
0
 // Remove note given note
 public void RemoveNote(EditorNoteBase note)
 {
     for (int i = 0; i < Notes.Count; i++)
     {
         if (note.Equals(Notes[i]))
         {
             Destroy(Notes[i].gameObject);
             Notes.RemoveAt(i);
             return;
         }
     }
 }
示例#2
0
    // Mouse Up event
    public void SetNote(int endPath, Vector3 point)
    {
        Debug.Log("Call Set Note");

        if (selectedNote == null)
        {
            return;
        }

        // Set the Hold Note length based on the mouse up
        if (selectedNoteType == NoteType.Hold || selectedNoteType == NoteType.Transition)
        {
            EditorNoteHold   temp      = selectedNote as EditorNoteHold;
            MeasureSeperator seperator = MeasureSeperatorManager.instance.FindClosestOffsetFromPoint(point);
            int   difference           = Mathf.RoundToInt(((seperator.timestamp - temp.offset) / EditorConductor.instance.spb) * 4f);
            float length = difference / 4f;
            temp.SetLength(length);
        }


        // Set the end path for flick note
        else if (selectedNoteType == NoteType.Flick)
        {
            if (Mathf.Abs(selectedNote.notePathId - endPath) != 1)
            {
                Debug.Log("Start: " + selectedNote.notePathId + ", End: " + endPath + ", Removing");
                RemoveNote(selectedNote);
                selectedNote = null;
                return;
            }
            EditorNoteFlick temp = selectedNote as EditorNoteFlick;
            temp.SetNote(endPath);
        }

        // Set the End locations and length for drag note
        else if (selectedNoteType == NoteType.Drag)
        {
            EditorNoteDrag   temp      = selectedNote as EditorNoteDrag;
            MeasureSeperator seperator = MeasureSeperatorManager.instance.FindClosestOffsetFromPoint(point);
            int   difference           = Mathf.RoundToInt(((seperator.timestamp - temp.offset) / EditorConductor.instance.spb) * 4f);
            float length = difference / 4f;
            temp.SetNote(length, endPath);
        }

        selectedNote = null;
    }
示例#3
0
    // notePath to place the note, and the position in world space where the
    // notepath was clicked.
    // Mouse Down Event
    public void PlaceNote(int notePathId, Vector3 point, float length = 1f, int endPath = -1)
    {
        // Get the closest Measure to the click, so we can snap notes to the measure.
        MeasureSeperator seperator = MeasureSeperatorManager.instance.FindClosestOffsetFromPoint(point);

        foreach (EditorNoteBase note in Notes)
        {
            if (seperator.timestamp == note.offset && notePathId == note.notePathId)
            {
                Debug.Log("There is already a note in this position, returning");
                return;
            }
        }

        switch (selectedNoteType)
        {
        case NoteType.Regular:
            selectedNote = SpawnRegularNote(seperator.timestamp, notePathId);
            break;

        case NoteType.Hold:
            selectedNote = SpawnHoldNote(seperator.timestamp, notePathId, length, false);
            break;

        case NoteType.Transition:
            selectedNote = SpawnHoldNote(seperator.timestamp, notePathId, length, true);
            break;

        case NoteType.Flick:
            selectedNote = SpawnFlickNote(seperator.timestamp, notePathId, endPath);
            break;

        case NoteType.Drag:
            selectedNote = SpawnDragNote(seperator.timestamp, notePathId, length, selectedNoteDragType, notePathId);
            break;
        }
    }
示例#4
0
 private void AddNoteToList(EditorNoteBase note)
 {
     Notes.Add(note);
     SortNotes();
 }
示例#5
0
 public void RemoveActiveNote(EditorNoteBase n)
 {
     // Debug.Log("Android Debug: Removing " + n.name + " from the ActiveNotes list");
     ActiveNotes.Remove(n);
 }
示例#6
0
 public void AddActiveNote(EditorNoteBase n)
 {
     // Debug.Log("Android Debug: Adding " + n.name + " to the ActiveNotes list");
     ActiveNotes.Add(n);
 }
示例#7
0
 public bool Equals(EditorNoteBase other)
 {
     return(Mathf.Abs((this.notePathId - other.notePathId)) < 0.01f && this.offset == other.offset);
 }