void HighlightAll()
    {
        editor.currentSelectedObject = null;

        if (viewMode == ViewMode.Chart)
        {
            editor.currentSelectedObjects = editor.currentChart.chartObjects.ToArray();
        }
        else
        {
            editor.currentSelectedObjects = editor.currentSong.syncTrack.ToArray();
            editor.AddToSelectedObjects(editor.currentSong.eventsAndSections.ToArray());
        }
    }
Esempio n. 2
0
    public override void OnSelectableMouseDown()
    {
        if (Toolpane.currentTool == Toolpane.Tools.Cursor && Globals.applicationMode == Globals.ApplicationMode.Editor && Input.GetMouseButtonDown(0) && !Input.GetMouseButton(1))
        {
            // Shift-clicking
            // Find the closest object already selected
            // Select all objects in range of that found and the clicked object

            if (Globals.viewMode == Globals.ViewMode.Chart && (Globals.modifierInputActive || Globals.secondaryInputActive))
            {
                // Ctrl-clicking
                if (Globals.modifierInputActive)
                {
                    if (editor.IsSelected(songObject))
                    {
                        editor.RemoveFromSelectedObjects(songObject);
                    }
                    else
                    {
                        editor.AddToSelectedObjects(songObject);
                    }
                }
                // Shift-clicking
                else
                {
                    int pos = SongObjectHelper.FindClosestPosition(this.songObject, editor.currentSelectedObjects);

                    if (pos != SongObjectHelper.NOTFOUND)
                    {
                        uint min;
                        uint max;

                        if (editor.currentSelectedObjects[pos].tick > songObject.tick)
                        {
                            max = editor.currentSelectedObjects[pos].tick;
                            min = songObject.tick;
                        }
                        else
                        {
                            min = editor.currentSelectedObjects[pos].tick;
                            max = songObject.tick;
                        }

                        editor.currentSelectedObjects = SongObjectHelper.GetRangeCopy(editor.currentChart.chartObjects, min, max);
                    }
                }
            }
            else if (!editor.IsSelected(songObject))
            {
                editor.currentSelectedObject = songObject;
            }
        }

        // Delete the object on erase tool or by holding right click and pressing left-click
        else if (Globals.applicationMode == Globals.ApplicationMode.Editor &&
                 (
                     (Toolpane.currentTool == Toolpane.Tools.Eraser && Input.GetMouseButtonDown(0)) ||
                     (Input.GetMouseButtonDown(0) && Input.GetMouseButton(1)) ||
                     Eraser.dragging)
                 )
        {
            if ((songObject.classID != (int)SongObject.ID.BPM && songObject.classID != (int)SongObject.ID.TimeSignature) || songObject.tick != 0)
            {
                if (!Input.GetMouseButton(1))
                {
                    Debug.Log("Deleted " + songObject + " at position " + songObject.tick + " with eraser tool");
                    Eraser.dragEraseHistory.Add(new ActionHistory.Delete(songObject));
                }
                else
                {
                    Debug.Log("Deleted " + songObject + " at position " + songObject.tick + " with hold-right left-click shortcut");
                    editor.actionHistory.Insert(new ActionHistory.Delete(songObject));
                }
                songObject.Delete();
                editor.currentSelectedObject = null;
            }
        }
    }