public override void Update()
    {
        base.Update();

        ChartEditor editor = ChartEditor.Instance;

        if (!audioStarted)
        {
            float audioPlayPoint = playFromTime + editor.services.totalSongAudioOffset;
            float currentTime    = editor.services.currentAudioTime;
            if (currentTime >= audioPlayPoint && currentTime > 0)
            {
                editor.PlayAudio(currentTime);
                audioStarted = true;
            }
        }

        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.StepIncrease))
        {
            GameSettings.snappingStep.Increment();
        }

        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.StepDecrease))
        {
            GameSettings.snappingStep.Decrement();
        }

        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.PlayPause) || MSChartEditorInput.GetInputDown(MSChartEditorInputActions.StartGameplay))
        {
            editor.Stop();
        }
    }
    void Shortcuts()
    {
        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToggleMetronome))
        {
            services.ToggleMetronome();
            services.notificationBar.PushNotification("METRONOME TOGGLED " + Services.BoolToStrOnOff(GameSettings.metronomeActive), 2, true);
        }

        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.FileSave))
        {
            editor._Save();
        }

        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.FileSaveAs))
        {
            editor.SaveAs();
        }

        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.FileLoad))
        {
            editor.Load();
        }

        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.FileNew))
        {
            editor.New();
        }
    }
    public static bool GetFretInput(Note.GuitarFret fret)
    {
        switch (fret)
        {
        case Note.GuitarFret.Green:
            return(MSChartEditorInput.GetInput(MSChartEditorInputActions.GuitarFretGreen));

        case Note.GuitarFret.Red:
            return(MSChartEditorInput.GetInput(MSChartEditorInputActions.GuitarFretRed));

        case Note.GuitarFret.Yellow:
            return(MSChartEditorInput.GetInput(MSChartEditorInputActions.GuitarFretYellow));

        case Note.GuitarFret.Blue:
            return(MSChartEditorInput.GetInput(MSChartEditorInputActions.GuitarFretBlue));

        case Note.GuitarFret.Orange:
            return(MSChartEditorInput.GetInput(MSChartEditorInputActions.GuitarFretOrange));

        case Note.GuitarFret.Open:
            return(false);

        default:
            Debug.LogError("Unhandled note type for guitar input: " + fret);
            break;
        }

        return(false);
    }
 protected override void Controls()
 {
     if (!GameSettings.keysModeEnabled)
     {
         if (Input.GetMouseButtonDown(0))
         {
             int pos = SongObjectHelper.FindObjectPosition(chartEvent, editor.currentChart.events);
             if (pos == SongObjectHelper.NOTFOUND)
             {
                 AddObject();
             }
             // Link to the event already in
             else
             {
                 editor.selectedObjectsManager.currentSelectedObject = editor.currentChart.events[pos];
             }
         }
     }
     else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.AddSongObject))
     {
         var searchArray = editor.currentChart.events;
         int pos         = SongObjectHelper.FindObjectPosition(chartEvent, searchArray);
         if (pos == SongObjectHelper.NOTFOUND)
         {
             AddObject();
         }
         else
         {
             editor.commandStack.Push(new SongEditDelete(searchArray[pos]));
             editor.selectedObjectsManager.currentSelectedObject = null;
         }
     }
 }
Beispiel #5
0
 protected override void Controls()
 {
     if (!Globals.gameSettings.keysModeEnabled)
     {
         if (Input.GetMouseButtonDown(0))
         {
             Section sectionSearched = sectionSearch(section.tick);
             if (sectionSearched == null)
             {
                 AddObject();
             }
             else
             {
                 editor.selectedObjectsManager.currentSelectedObject = sectionSearched;
             }
         }
     }
     else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.AddSongObject))
     {
         var searchArray = editor.currentSong.sections;
         int pos         = SongObjectHelper.FindObjectPosition(section, searchArray);
         if (pos == SongObjectHelper.NOTFOUND)
         {
             AddObject();
         }
         else
         {
             editor.commandStack.Push(new SongEditDelete(searchArray[pos]));
             editor.selectedObjectsManager.currentSelectedObject = null;
         }
     }
 }
    void Controls()
    {
        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToggleNoteTap) && tapToggle.interactable)
        {
            if (tapToggle.isOn)
            {
                tapToggle.isOn = false;
            }
            else
            {
                tapToggle.isOn = true;
            }
        }

        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToggleNoteForced) && forcedToggle.interactable)
        {
            if (forcedToggle.isOn)
            {
                forcedToggle.isOn = false;
            }
            else
            {
                forcedToggle.isOn = true;
            }
        }
    }
    protected override void Update()
    {
        base.Update();

        if (Input.GetMouseButton(0))
        {
            GameObject currentMouseHover = editor.services.mouseMonitorSystem.currentSelectableUnderMouse;
            if (currentMouseHover)
            {
                SongObjectController soController = currentMouseHover.GetComponent <SongObjectController>();
                if (soController && soController.GetSongObject() != null)       // Dunno why song object would ever be null, but may as well be safe
                {
                    SongObject songObject = soController.GetSongObject();
                    if (MSChartEditorInput.GetInput(MSChartEditorInputActions.ChordSelect) && songObject.classID == (int)SongObject.ID.Note)
                    {
                        foreach (Note note in ((Note)songObject).chord)
                        {
                            dragEraseHistory.Add(note);
                        }
                    }
                    else if ((songObject.classID != (int)SongObject.ID.BPM && songObject.classID != (int)SongObject.ID.TimeSignature) || songObject.tick != 0)
                    {
                        dragEraseHistory.Add(songObject);
                    }

                    ExecuteCurrentDeletes();
                }
            }
        }

        if (Input.GetMouseButtonUp(0))
        {
            dragEraseHistory.Clear();
        }
    }
Beispiel #8
0
    static bool GetPadPressedInput(Note.DrumPad drumFret, LaneInfo laneInfo, Dictionary <Note.DrumPad, MSChartEditorInputActions> inputsToCheck, Dictionary <int, Dictionary <Note.DrumPad, MSChartEditorInputActions?> > laneCountOverridesDict)
    {
        if (laneCountOverridesDict != null)
        {
            Dictionary <Note.DrumPad, MSChartEditorInputActions?> inputOverrideDict;
            MSChartEditorInputActions?overrideInput;

            if (laneCountOverridesDict.TryGetValue(laneInfo.laneCount, out inputOverrideDict) && inputOverrideDict.TryGetValue(drumFret, out overrideInput))
            {
                bool inputFound = false;

                if (overrideInput != null)
                {
                    inputFound = MSChartEditorInput.GetInputDown((MSChartEditorInputActions)overrideInput);
                }

                return(inputFound);
            }
        }

        MSChartEditorInputActions input;

        if (inputsToCheck.TryGetValue(drumFret, out input))
        {
            return(MSChartEditorInput.GetInputDown(input));
        }

        return(false);
    }
Beispiel #9
0
 void Controls()
 {
     if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToggleStarpowerDrumsFillActivation) && drumFillToggle.gameObject.activeSelf && drumFillToggle.interactable)
     {
         drumFillToggle.isOn = !drumFillToggle.isOn;
     }
 }
Beispiel #10
0
    public override void OnSelectableMouseDrag()
    {
        // Move note
        if (moveCheck)
        {
            if (MSChartEditorInput.GetInput(MSChartEditorInputActions.ChordSelect))
            {
                Note[] chordNotes = note.GetChord();
                editor.groupMove.StartMoveAction(chordNotes, 0);

                foreach (Note chordNote in chordNotes)
                {
                    chordNote.Delete();
                }
            }
            else
            {
                //base.OnSelectableMouseDrag();
            }
        }
        else
        {
            sustain.OnSelectableMouseDrag();
        }
    }
    void Update()
    {
        if (Input.GetMouseButtonDown(2))
        {
            middleClickDownScreenPos = Input.mousePosition;
        }
        else if (!Input.GetMouseButton(2) && middleClickDownScreenPos.HasValue)
        {
            middleClickDownScreenPos = null;
            Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
        }

        if (Input.GetMouseButtonUp(0) && editor.currentState == ChartEditor.State.Editor)
        {
            cancel = false;
        }

        if (Services.IsInDropDown)
        {
            cancel = true;
        }

        // Update timer text
        if (timePosition)
        {
            bool audioLoaded = false;
            foreach (var stream in editor.currentSongAudio.bassAudioStreams)
            {
                if (AudioManager.StreamIsValid(stream))
                {
                    audioLoaded = true;
                }
            }

            if (!audioLoaded)//editor.currentSong.songAudioLoaded)
            {
                timePosition.color = Color.red;
                timePosition.text  = "No audio";
            }
            else
            {
                timePosition.color = Color.white;
                timePosition.text  = Utility.timeConvertion(TickFunctions.WorldYPositionToTime(strikeLine.position.y));
            }
        }

        if (MSChartEditorInput.GetGroupInputDown(arrowKeyShortcutGroup))
        {
            arrowMoveTimer = 0;
        }
        else if (MSChartEditorInput.GetGroupInput(arrowKeyShortcutGroup))
        {
            arrowMoveTimer += Time.deltaTime;
        }
        else
        {
            arrowMoveTimer = 0;
        }
    }
    void Controls()
    {
        if (!(MSChartEditorInput.GetInput(MSChartEditorInputActions.BpmIncrease) && MSChartEditorInput.GetInput(MSChartEditorInputActions.BpmDecrease)))    // Can't hit both at the same time
        {
            if (!Services.IsTyping && !Globals.modifierInputActive)
            {
                if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.BpmDecrease) && decrement.interactable)
                {
                    uint newValue = GetValueForDecrement();
                    SetBpmValue(newValue);
                }
                else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.BpmIncrease) && increment.interactable)
                {
                    uint newValue = GetValueForIncrement();
                    SetBpmValue(newValue);
                }

                // Adjust to time rather than framerate
                if (incrementInputHoldTime > AUTO_INCREMENT_WAIT_TIME && autoIncrementTimer > AUTO_INCREMENT_RATE)
                {
                    if (MSChartEditorInput.GetInput(MSChartEditorInputActions.BpmDecrease) && decrement.interactable)
                    {
                        uint newValue = GetValueForDecrement();
                        SetBpmValue(newValue, true);
                    }
                    else if (MSChartEditorInput.GetInput(MSChartEditorInputActions.BpmIncrease) && increment.interactable)
                    {
                        uint newValue = GetValueForIncrement();
                        SetBpmValue(newValue, true);
                    }

                    autoIncrementTimer = 0;
                }

                //
                if (MSChartEditorInput.GetInput(MSChartEditorInputActions.BpmIncrease) || MSChartEditorInput.GetInput(MSChartEditorInputActions.BpmDecrease))
                {
                    incrementInputHoldTime += Time.deltaTime;
                }
                else
                {
                    incrementInputHoldTime = 0;
                }
            }
            else
            {
                incrementInputHoldTime = 0;
            }
        }

        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToggleBpmAnchor) && anchorToggle.IsInteractable())
        {
            anchorToggle.isOn = !anchorToggle.isOn;
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToggleViewMode) && (editor.currentState == ChartEditor.State.Editor || editor.currentState == ChartEditor.State.Playing))
        {
            viewModeToggle.isOn = !viewModeToggle.isOn;
        }

        keysModePanel.gameObject.SetActive(editor.toolManager.currentToolId == EditorObjectToolManager.ToolID.Note && GameSettings.keysModeEnabled);

        Shortcuts();
    }
Beispiel #14
0
    void Controls()
    {
        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToggleExtendedSustains))
        {
            ToggleExtendedSustains();
            editor.globals.services.notificationBar.PushNotification("EXTENDED SUSTAINS TOGGLED " + Services.BoolToStrOnOff(GameSettings.extendedSustainsEnabled), 2, true);
        }

        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToggleMouseMode))
        {
            ToggleMouseLockMode();
            editor.globals.services.notificationBar.PushNotification("KEYS MODE TOGGLED " + Services.BoolToStrOnOff(GameSettings.keysModeEnabled), 2, true);
        }
    }
    protected virtual void Update()
    {
        MovementController.cancel = true;

        bool exitInput = MSChartEditorInput.GetInputDown(MSChartEditorInputActions.CloseMenu) && !editor.uiServices.popupBlockerEnabled;

        if (
            exitInput ||
            (Input.GetMouseButtonDown(0) && !RectTransformUtility.RectangleContainsScreenPoint(mouseArea, editor.uiServices.GetUIMousePosition())) ||
            editor.errorManager.HasErrorToDisplay()
            )
        {
            Disable();
        }
    }
Beispiel #16
0
 // Update is called once per frame
 void Update()
 {
     // Shortcuts
     if (!Services.IsTyping && !Globals.modifierInputActive)
     {
         if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToolNoteHold))
         {
             buttons[0].onClick.Invoke();
         }
         else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToolNoteBurst))
         {
             buttons[1].onClick.Invoke();
         }
     }
 }
    void Controls()
    {
        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToggleNoteTap) && tapToggle.interactable)
        {
            tapToggle.isOn = !tapToggle.isOn;
        }

        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToggleNoteForced) && forcedToggle.interactable)
        {
            forcedToggle.isOn = !forcedToggle.isOn;
        }

        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToggleNoteCymbal) && cymbalToggle.interactable)
        {
            cymbalToggle.isOn = !cymbalToggle.isOn;
        }
    }
    void Shortcuts()
    {
        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToolSelectCursor))
        {
            cursorSelect.onClick.Invoke();
        }

        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToolSelectEraser))
        {
            eraserSelect.onClick.Invoke();
        }

        // else if (Input.GetKeyDown(KeyCode.L))
        // groupSelect.onClick.Invoke();

        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToolSelectNote))
        {
            noteSelect.onClick.Invoke();
        }

        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToolSelectStarpower))
        {
            starpowerSelect.onClick.Invoke();
        }

        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToolSelectBpm))
        {
            bpmSelect.onClick.Invoke();
        }

        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToolSelectTimeSignature))
        {
            timeSignatureSelect.onClick.Invoke();
        }

        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToolSelectSection))
        {
            sectionSelect.onClick.Invoke();
        }

        else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToolSelectEvent))
        {
            eventSelect.onClick.Invoke();
        }
    }
    void RefreshSectionHighlight()
    {
        if (!MSChartEditorInput.GetInput(MSChartEditorInputActions.SelectAllSection))
        {
            return;
        }

        int  currentSectionIndex = SongObjectHelper.GetIndexOfPrevious(editor.currentSong.sections, editor.currentTickPos);
        bool changed             = currentSectionIndex != sectionHighlightCurrentIndex;

        editor.selectedObjectsManager.currentSelectedObject = null;
        sectionHighlightCurrentIndex = currentSectionIndex;

        for (int i = 0; Mathf.Abs(i) <= Mathf.Abs(sectionHighlightOffset); i -= (int)Mathf.Sign(sectionHighlightOffset))
        {
            editor.selectedObjectsManager.AddHighlightCurrentSection(Globals.viewMode, i);
        }
    }
    public static bool GetPadPressedInput(Note.DrumPad drumFret, LaneInfo laneInfo)
    {
        Dictionary <Note.DrumPad, MSChartEditorInputActions?> inputOverrideDict;
        MSChartEditorInputActions?overrideInput;

        if (laneCountGamepadOverridesDict.TryGetValue(laneInfo.laneCount, out inputOverrideDict) && inputOverrideDict.TryGetValue(drumFret, out overrideInput))
        {
            bool inputFound = false;

            if (overrideInput != null)
            {
                inputFound = MSChartEditorInput.GetInputDown((MSChartEditorInputActions)overrideInput);
            }

            return(inputFound);
        }

        switch (drumFret)
        {
        case Note.DrumPad.Red:
            return(MSChartEditorInput.GetInputDown(MSChartEditorInputActions.DrumPadRed));

        case Note.DrumPad.Yellow:
            return(MSChartEditorInput.GetInputDown(MSChartEditorInputActions.DrumPadYellow));

        case Note.DrumPad.Blue:
            return(MSChartEditorInput.GetInputDown(MSChartEditorInputActions.DrumPadBlue));

        case Note.DrumPad.Orange:
            return(MSChartEditorInput.GetInputDown(MSChartEditorInputActions.DrumPadOrange));

        case Note.DrumPad.Green:
            return(MSChartEditorInput.GetInputDown(MSChartEditorInputActions.DrumPadGreen));

        case Note.DrumPad.Kick:
            return(MSChartEditorInput.GetInputDown(MSChartEditorInputActions.DrumPadKick));

        default:
            Debug.LogError("Unhandled note type for drum input: " + drumFret);
            break;
        }

        return(false);
    }
 void Shortcuts()
 {
     if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.NoteSetNatural))
     {
         setNoteNatural.onClick.Invoke();
     }
     else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.NoteSetStrum))
     {
         setNoteStrum.onClick.Invoke();
     }
     else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.NoteSetHopo))
     {
         setNoteHopo.onClick.Invoke();
     }
     else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.NoteSetTap))
     {
         setNoteTap.onClick.Invoke();
     }
 }
    new void LateUpdate()
    {
        if (editor.services.mouseMonitorSystem.world2DPosition != null && Input.mousePosition.y < Camera.main.WorldToScreenPoint(editor.mouseYMaxLimit.position).y)
        {
            pastePos = objectSnappedChartPos;
        }
        else
        {
            pastePos = editor.currentSong.WorldPositionToSnappedTick(strikeline.position.y, Globals.gameSettings.step);
        }

        transform.position = new Vector3(transform.position.x, editor.currentSong.TickToWorldYPosition(pastePos), transform.position.z);

        if (!Services.IsTyping && MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ClipboardPaste))
        {
            Paste(pastePos);
            groupSelectTool.reset();
        }
    }
Beispiel #23
0
    public override void OnServiceUpdate()
    {
        if (editor.currentChart.note_count != prevNoteCount)
        {
            noteCount.text = "Notes: " + editor.currentChart.note_count.ToString();
        }

        if (Globals.gameSettings.step != prevSnappingStep)
        {
            UpdateSnappingStepText();
        }

        // Shortcuts
        if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.ToggleClap))
        {
            clapToggle.isOn = !clapToggle.isOn;
        }

        prevNoteCount = editor.currentChart.note_count;
    }
Beispiel #24
0
    void DeleteSongObject(SongObjectController soController)
    {
        if (soController && soController.GetSongObject() != null)       // Dunno why song object would ever be null, but may as well be safe
        {
            SongObject songObject = soController.GetSongObject();
            if (MSChartEditorInput.GetInput(MSChartEditorInputActions.ChordSelect) && songObject.classID == (int)SongObject.ID.Note)
            {
                foreach (Note note in ((Note)songObject).chord)
                {
                    dragEraseHistory.Add(note);
                }
            }
            else if ((songObject.classID != (int)SongObject.ID.BPM && songObject.classID != (int)SongObject.ID.TimeSignature) || songObject.tick != 0)
            {
                dragEraseHistory.Add(songObject);
            }

            ExecuteCurrentDeletes();
        }
    }
Beispiel #25
0
    protected virtual void Update()
    {
        MovementController.cancel = true;

        bool exitInput            = MSChartEditorInput.GetInputDown(MSChartEditorInputActions.CloseMenu) && !editor.uiServices.popupBlockerEnabled;
        bool clickedOutSideWindow = Input.GetMouseButtonDown(0) && !RectTransformUtility.RectangleContainsScreenPoint(mouseArea, editor.uiServices.GetUIMousePosition());

        if (clickedOutSideWindow)
        {
            var         mouseMonitor         = editor.services.mouseMonitorSystem;
            var         uiUnderMouse         = mouseMonitor.GetUIRaycastableUnderPointer();
            DisplayMenu menu                 = uiUnderMouse ? uiUnderMouse.GetComponentInParent <DisplayMenu>() : null;
            bool        clickingObjectInMenu = menu && menu == this;

            clickedOutSideWindow &= !clickingObjectInMenu;
        }

        if (exitInput || clickedOutSideWindow || editor.errorManager.HasErrorToDisplay())
        {
            Disable();
        }
    }
Beispiel #26
0
    public override void OnSelectableMouseDown()
    {
        if (nCon.note.song != null)
        {
            if (Input.GetMouseButton(1))
            {
                {
                    uint snappedSustainPos = GetSnappedSustainPos();
                    if (snappedSustainPos == nCon.note.tick)        // Only assigned if we're clicking on the note itself, otherwise we can modify the sustain instantly.
                    {
                        initialDraggingSnappedPos = snappedSustainPos;
                    }
                }

                originalDraggedNotes.Clear();
                sustainDragCommands.Clear();
                commandPushCount = 0;

                if (!GameSettings.extendedSustainsEnabled || MSChartEditorInput.GetInput(MSChartEditorInputActions.ChordSelect))
                {
                    foreach (Note chordNote in nCon.note.chord)
                    {
                        originalDraggedNotes.Add(chordNote.CloneAs <Note>());
                    }
                }
                else
                {
                    originalDraggedNotes.Add(nCon.note.CloneAs <Note>());
                }

                GenerateSustainDragCommands(false);
                if (sustainDragCommands.Count > 0)
                {
                    editor.commandStack.Push(new BatchedSongEditCommand(sustainDragCommands));
                    ++commandPushCount;
                }
            }
        }
    }
Beispiel #27
0
 // Update is called once per frame
 void Update()
 {
     if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.CloseMenu))
     {
         Close(false);
     }
     else
     {
         InputAction conflict;
         IInputMap   attemptedInput;
         if (!device.Connected || rebinder.TryMap(out conflict, out attemptedInput))
         {
             Close(true);
         }
         else if (conflict != null)
         {
             inputConflictEvent.Fire(conflict);
             conflictNotificationText.text    = string.Format(conflictFormatStr, attemptedInput.GetInputStr(), conflict.properties.displayName);
             conflictNotificationText.enabled = true;
         }
     }
 }
 protected override void Controls()
 {
     if (!Globals.gameSettings.keysModeEnabled)
     {
         if (Input.GetMouseButton(0))
         {
             if (lastPlacedSP == null)
             {
                 AddObject();
             }
             else
             {
                 UpdateLastPlacedSp();
             }
         }
     }
     else if (MSChartEditorInput.GetInput(MSChartEditorInputActions.AddSongObject))
     {
         if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.AddSongObject))
         {
             var searchArray = editor.currentChart.starPower;
             int pos         = SongObjectHelper.FindObjectPosition(starpower, searchArray);
             if (pos == SongObjectHelper.NOTFOUND)
             {
                 AddObject();
             }
             else
             {
                 editor.commandStack.Push(new SongEditDelete(searchArray[pos]));
             }
         }
         else if (lastPlacedSP != null)
         {
             UpdateLastPlacedSp();
         }
     }
 }
Beispiel #29
0
 protected override void Controls()
 {
     if (!GameSettings.keysModeEnabled)
     {
         if (Input.GetMouseButtonDown(0))
         {
             AddObject();
         }
     }
     else if (MSChartEditorInput.GetInputDown(MSChartEditorInputActions.AddSongObject))
     {
         IList <SyncTrack> searchArray = editor.currentSong.syncTrack;
         int pos = SongObjectHelper.FindObjectPosition(bpm, searchArray);
         if (pos == SongObjectHelper.NOTFOUND)
         {
             AddObject();
         }
         else if (searchArray[pos].tick != 0)
         {
             editor.commandStack.Push(new SongEditDelete(searchArray[pos]));
             editor.selectedObjectsManager.currentSelectedObject = null;
         }
     }
 }
    public override void OnSelectableMouseDown()
    {
        if (editor.toolManager.currentToolId == EditorObjectToolManager.ToolID.Cursor && editor.currentState == ChartEditor.State.Editor && Input.GetMouseButtonDown(0) && !Input.GetMouseButton(1))
        {
            var selectedObjectsManager = editor.selectedObjectsManager;

            // Ctrl-clicking
            if (Globals.modifierInputActive)
            {
                if (selectedObjectsManager.IsSelected(songObject))
                {
                    selectedObjectsManager.RemoveFromSelectedObjects(songObject);
                }
                else
                {
                    selectedObjectsManager.AddToSelectedObjects(songObject);
                }

                return;
            }

            // Shift-clicking
            if (Globals.secondaryInputActive)
            {
                int pos = SongObjectHelper.FindClosestPosition(this.songObject, editor.selectedObjectsManager.currentSelectedObjects);

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

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

                    var chartObjects = editor.currentChart.chartObjects;
                    int index, length;
                    SongObjectHelper.GetRange(chartObjects, min, max, out index, out length);
                    selectedObjectsManager.SetCurrentSelectedObjects(chartObjects, index, length);

                    return;
                }
            }

            // Regular clicking
            if (!selectedObjectsManager.IsSelected(songObject))
            {
                if (MSChartEditorInput.GetInput(MSChartEditorInputActions.ChordSelect))
                {
                    selectedObjectsManager.SetCurrentSelectedObjects(note.chord);
                }
                else
                {
                    selectedObjectsManager.currentSelectedObject = songObject;
                }

                return;
            }
        }

        // Delete the object on left and right click shortcut
        else if (editor.currentState == ChartEditor.State.Editor &&
                 Input.GetMouseButtonDown(0) && Input.GetMouseButton(1))
        {
            if (MSChartEditorInput.GetInput(MSChartEditorInputActions.ChordSelect))
            {
                Note[] chordNotes = note.GetChord();
                if (Input.GetMouseButton(1))
                {
                    if (SustainController.SustainDraggingInProgress)
                    {
                        editor.commandStack.Pop();  // Cancel the last sustain drag action
                    }
                    Debug.Log("Deleted " + note + " chord at position " + note.tick + " with hold-right left-click shortcut");
                    editor.commandStack.Push(new SongEditDelete(chordNotes));

                    SustainController.ResetSustainDragData();
                }
            }
            else if (Input.GetMouseButton(1))
            {
                if (SustainController.SustainDraggingInProgress)
                {
                    editor.commandStack.Pop();    // Cancel the last sustain drag action
                }
                Debug.Log("Deleted " + note + " at position " + note.tick + " with hold-right left-click shortcut");
                editor.commandStack.Push(new SongEditDelete(note));
                SustainController.ResetSustainDragData();
            }
        }
        else
        {
            sustain.OnSelectableMouseDown();
        }
    }