private void UpdateInputToChangeNoteType(EKeyboardModifier modifier) { if (modifier != EKeyboardModifier.None) { return; } if (Input.GetKeyUp(KeyCode.G)) { toggleNoteTypeAction.ExecuteAndNotify(selectionController.GetSelectedNotes(), ENoteType.Golden); } if (Input.GetKeyUp(KeyCode.F)) { toggleNoteTypeAction.ExecuteAndNotify(selectionController.GetSelectedNotes(), ENoteType.Freestyle); } if (Input.GetKeyUp(KeyCode.N)) { toggleNoteTypeAction.ExecuteAndNotify(selectionController.GetSelectedNotes(), ENoteType.Normal); } if (Input.GetKeyUp(KeyCode.R)) { toggleNoteTypeAction.ExecuteAndNotify(selectionController.GetSelectedNotes(), ENoteType.Rap); } if (Input.GetKeyUp(KeyCode.T)) { toggleNoteTypeAction.ExecuteAndNotify(selectionController.GetSelectedNotes(), ENoteType.RapGolden); } }
private void OnScrollWheel(InputAction.CallbackContext context) { EKeyboardModifier modifier = InputUtils.GetCurrentKeyboardModifier(); int scrollDirection = Math.Sign(context.ReadValue <Vector2>().y); if (scrollDirection != 0 && noteArea.IsPointerOver) { // Scroll horizontal in NoteArea with no modifier if (modifier == EKeyboardModifier.None) { noteArea.ScrollHorizontal(scrollDirection); } // Zoom horizontal in NoteArea with Ctrl if (modifier == EKeyboardModifier.Ctrl) { noteArea.ZoomHorizontal(scrollDirection); } // Scroll vertical in NoteArea with Shift if (modifier == EKeyboardModifier.Shift) { noteArea.ScrollVertical(scrollDirection); } // Zoom vertical in NoteArea with Ctrl + Shift if (modifier == EKeyboardModifier.CtrlShift) { noteArea.ZoomVertical(scrollDirection); } } }
private void UpdateInputToMoveAndStretchNotes(EKeyboardModifier modifier) { Vector2 arrowKeyDirection = GetArrowKeyDirection(); if (arrowKeyDirection == Vector2.zero) { return; } List <Note> selectedNotes = selectionController.GetSelectedNotes(); if (selectedNotes.IsNullOrEmpty()) { return; } foreach (Note note in selectedNotes) { // Move with Shift if (modifier == EKeyboardModifier.Shift) { note.MoveHorizontal((int)arrowKeyDirection.x); note.MoveVertical((int)arrowKeyDirection.y); } // Extend right side with Alt if (modifier == EKeyboardModifier.Alt) { int newEndBeat = note.EndBeat + (int)arrowKeyDirection.x; if (newEndBeat > note.StartBeat) { note.SetEndBeat(newEndBeat); } } // Extend left side with Ctrl if (modifier == EKeyboardModifier.Ctrl) { int newStartBeat = note.StartBeat + (int)arrowKeyDirection.x; if (newStartBeat < note.EndBeat) { note.SetStartBeat(newStartBeat); } } // Adjust following notes. if (settings.SongEditorSettings.AdjustFollowingNotes) { AdjustFollowingNotes(modifier, arrowKeyDirection, selectedNotes); } } editorNoteDisplayer.UpdateNotesAndSentences(); }
private string GetKeyboardBasedNoteManipulationControlHint() { EKeyboardModifier currentKeyboardModifier = InputUtils.GetCurrentKeyboardModifier(); return(currentKeyboardModifier switch { EKeyboardModifier.Shift => "Arrow keys to move notes", EKeyboardModifier.Ctrl => "Arrow keys to move left side of notes | Space to play notes", EKeyboardModifier.Alt => "Arrow keys to move right side of notes", EKeyboardModifier.CtrlShift => "Arrow keys to move notes one octave", _ => "" });
private void UpdateInputToMoveAndStretchNotes(EKeyboardModifier modifier) { Vector2 arrowKeyDirection = InputUtils.GetArrowKeyDirection(); if (arrowKeyDirection == Vector2.zero) { return; } List <Note> selectedNotes = selectionController.GetSelectedNotes(); if (selectedNotes.IsNullOrEmpty()) { return; } if (modifier == EKeyboardModifier.None) { return; } List <Note> followingNotes = GetFollowingNotesOrEmptyListIfDeactivated(selectedNotes); // Move with Shift if (modifier == EKeyboardModifier.Shift && arrowKeyDirection.x != 0) { moveNotesAction.MoveNotesHorizontalAndNotify((int)arrowKeyDirection.x, selectedNotes, followingNotes); } if (modifier == EKeyboardModifier.Shift && arrowKeyDirection.y != 0) { moveNotesAction.MoveNotesVerticalAndNotify((int)arrowKeyDirection.y, selectedNotes, followingNotes); } // Move notes one octave up / down via Ctrl+Shift if (modifier == EKeyboardModifier.CtrlShift) { moveNotesAction.MoveNotesVerticalAndNotify((int)arrowKeyDirection.y * 12, selectedNotes, followingNotes); } // Extend right side with Alt if (modifier == EKeyboardModifier.Alt) { extendNotesAction.ExtendNotesRightAndNotify((int)arrowKeyDirection.x, selectedNotes, followingNotes); } // Extend left side with Ctrl if (modifier == EKeyboardModifier.Ctrl) { extendNotesAction.ExtendNotesLeftAndNotify((int)arrowKeyDirection.x, selectedNotes); } }
void Update() { EKeyboardModifier modifier = InputUtils.GetCurrentKeyboardModifier(); if (modifier == EKeyboardModifier.Ctrl) { if (Input.GetKeyUp(KeyCode.C) && !InputFieldHasFocus()) { CopySelectedNotes(); } else if (Input.GetKeyUp(KeyCode.V) && !InputFieldHasFocus()) { PasteCopiedNotes(); } } }
private void UpdateInputToScrollAndZoom(EKeyboardModifier modifier) { // Scroll with arroy keys if (Input.GetKeyUp(KeyCode.LeftArrow) && modifier == EKeyboardModifier.None && !InputFieldHasFocus()) { noteArea.ScrollHorizontal(-1); } if (Input.GetKeyUp(KeyCode.RightArrow) && modifier == EKeyboardModifier.None && !InputFieldHasFocus()) { noteArea.ScrollHorizontal(1); } // Zoom and scroll with mouse wheel int scrollDirection = Math.Sign(Input.mouseScrollDelta.y); if (scrollDirection != 0 && noteArea.IsPointerOver) { // Scroll horizontal in NoteArea with mouse wheel if (modifier == EKeyboardModifier.None) { noteArea.ScrollHorizontal(scrollDirection); } // Zoom horizontal in NoteArea with Ctrl + mouse wheel if (modifier == EKeyboardModifier.Ctrl) { noteArea.ZoomHorizontal(scrollDirection); } // Scroll vertical in NoteArea with Shift + mouse wheel if (modifier == EKeyboardModifier.Shift) { noteArea.ScrollVertical(scrollDirection); } // Zoom vertical in NoteArea with Ctrl + Shift + mouse wheel if (modifier == EKeyboardModifier.CtrlShift) { noteArea.ZoomVertical(scrollDirection); } } }
void Update() { if (GameObjectUtils.InputFieldHasFocus(eventSystem)) { return; } EKeyboardModifier modifier = InputUtils.GetCurrentKeyboardModifier(); if (modifier == EKeyboardModifier.Ctrl) { if (Input.GetKeyUp(KeyCode.C)) { CopySelectedNotes(); } else if (Input.GetKeyUp(KeyCode.V)) { PasteCopiedNotes(); } } }
private void AdjustFollowingNotes(EKeyboardModifier modifier, Vector2 arrowKeyDirection, List <Note> selectedNotes) { // Moving is applied to following notes as well. // When extending / shrinking the right side, then the following notes are move to compensate. List <Note> followingNotes = SongMetaUtils.GetFollowingNotes(songMeta, selectedNotes); foreach (Note note in followingNotes) { // Moved with Shift. The following notes are moved as well. if (modifier == EKeyboardModifier.Shift) { note.MoveHorizontal((int)arrowKeyDirection.x); note.MoveVertical((int)arrowKeyDirection.y); } // Extended right side with Alt. The following notes must be moved to compensate. if (modifier == EKeyboardModifier.Alt) { note.MoveHorizontal((int)arrowKeyDirection.x); } } }
public void Update() { // Detect isAnyKeyUp isAnyKeyUp = false; if (Input.anyKey) { isAnyKey = true; } else if (isAnyKey) { isAnyKey = false; isAnyKeyUp = true; } bool inputFieldHasFocus = GameObjectUtils.InputFieldHasFocus(eventSystem); if (inputFieldHasFocus) { inputFieldHasFocusOld = true; return; } EKeyboardModifier modifier = InputUtils.GetCurrentKeyboardModifier(); // Jump to start / end of song, via Home (Pos1 on German keyboard) / End if (Input.GetKeyUp(KeyCode.Home)) { songAudioPlayer.PositionInSongInMillis = 0; } if (Input.GetKeyUp(KeyCode.End)) { songAudioPlayer.PositionInSongInMillis = songAudioPlayer.DurationOfSongInMillis - 1; } // Play / pause via Space or P bool isPlayPauseButtonUp = Input.GetKeyUp(KeyCode.Space) || Input.GetKeyUp(KeyCode.P); if (isPlayPauseButtonUp && modifier == EKeyboardModifier.None) { ToggleAudioPlayPause(); } // Play only the selected notes via Ctrl+Space or Ctrl+P if (isPlayPauseButtonUp && modifier == EKeyboardModifier.Ctrl) { List <Note> selectedNotes = selectionController.GetSelectedNotes(); PlayAudioInRangeOfNotes(selectedNotes); } // Stop playback or return to SingScene via Escape if (Input.GetKeyDown(KeyCode.Escape)) { if (songAudioPlayer.IsPlaying) { songAudioPlayer.PauseAudio(); } else if (!inputFieldHasFocusOld) { // Special case: the Escape key in an InputField removes its focus on key down. // Thus also check that in the previous frame no InputField was focused. songEditorSceneController.ContinueToSingScene(); } } // Select all notes via Ctrl+A if (Input.GetKeyUp(KeyCode.A) && modifier == EKeyboardModifier.Ctrl) { selectionController.SelectAll(); } // Delete notes if (Input.GetKeyUp(KeyCode.Delete)) { List <Note> selectedNotes = selectionController.GetSelectedNotes(); deleteNotesAction.ExecuteAndNotify(selectedNotes); } // Undo via Ctrl+Z if (Input.GetKeyUp(KeyCode.Z) && modifier == EKeyboardModifier.Ctrl) { historyManager.Undo(); } // Redo via Ctrl+Y if (Input.GetKeyUp(KeyCode.Y) && modifier == EKeyboardModifier.Ctrl) { historyManager.Redo(); } // Save via Ctrl+S if (Input.GetKeyUp(KeyCode.S) && modifier == EKeyboardModifier.Ctrl) { songEditorSceneController.SaveSong(); } // Tab to select next note, Shift+Tab to select previous note if (Input.GetKeyUp(KeyCode.Tab)) { if (modifier == EKeyboardModifier.None) { selectionController.SelectNextNote(); } else if (modifier == EKeyboardModifier.Shift) { selectionController.SelectPreviousNote(); } } // Start editing of lyrics with F2 if (Input.GetKeyUp(KeyCode.F2)) { List <Note> selectedNotes = selectionController.GetSelectedNotes(); if (selectedNotes.Count == 1) { Note selectedNote = selectedNotes.FirstOrDefault(); EditorUiNote uiNote = editorNoteDisplayer.GetUiNoteForNote(selectedNote); if (uiNote != null) { uiNote.StartEditingNoteText(); } } } // Change position in song with Ctrl+ArrowKey if (!songAudioPlayer.IsPlaying) { if (Input.GetKey(KeyCode.LeftArrow) && modifier == EKeyboardModifier.Ctrl) { songAudioPlayer.PositionInSongInMillis -= 1; } if (Input.GetKey(KeyCode.RightArrow) && modifier == EKeyboardModifier.Ctrl) { songAudioPlayer.PositionInSongInMillis += 1; } } // Make golden / freestyle / normal UpdateInputToChangeNoteType(modifier); // Move and stretch notes UpdateInputToMoveAndStretchNotes(modifier); // Scroll and zoom in NoteArea UpdateInputToScrollAndZoom(modifier); // Use the shortcuts that are also used in the YASS song editor. UpdateInputForYassShortcuts(modifier); inputFieldHasFocusOld = inputFieldHasFocus; }
private void UpdateInputToScrollAndZoom(EKeyboardModifier modifier) { // Scroll with arroy keys if (Input.GetKeyUp(KeyCode.LeftArrow) && modifier == EKeyboardModifier.None) { noteArea.ScrollHorizontal(-1); } if (Input.GetKeyUp(KeyCode.RightArrow) && modifier == EKeyboardModifier.None) { noteArea.ScrollHorizontal(1); } // Zoom horizontal with Ctrl+'+' and Ctrl+'-' // Note: On my keyboard, the plus button has KeyCode.Equals but I don't know why. bool isPlusKeyUp = Input.GetKeyUp(KeyCode.Plus) || Input.GetKeyUp(KeyCode.KeypadPlus) || Input.GetKeyUp(KeyCode.Equals); bool isMinusKeyUp = Input.GetKeyUp(KeyCode.Minus) || Input.GetKeyUp(KeyCode.KeypadMinus); if (isPlusKeyUp && modifier == EKeyboardModifier.Ctrl) { noteArea.ZoomHorizontal(1); } if (isMinusKeyUp && modifier == EKeyboardModifier.Ctrl) { noteArea.ZoomHorizontal(-1); } // Zoom vertical with Ctrl+Shift+'+' and Ctrl+Shift+'-' if (isPlusKeyUp && modifier == EKeyboardModifier.CtrlShift) { noteArea.ZoomVertical(1); } if (isMinusKeyUp && modifier == EKeyboardModifier.CtrlShift) { noteArea.ZoomVertical(-1); } // Zoom and scroll with mouse wheel int scrollDirection = Math.Sign(Input.mouseScrollDelta.y); if (scrollDirection != 0 && noteArea.IsPointerOver) { // Scroll horizontal in NoteArea with mouse wheel if (modifier == EKeyboardModifier.None) { noteArea.ScrollHorizontal(scrollDirection); } // Zoom horizontal in NoteArea with Ctrl + mouse wheel if (modifier == EKeyboardModifier.Ctrl) { noteArea.ZoomHorizontal(scrollDirection); } // Scroll vertical in NoteArea with Shift + mouse wheel if (modifier == EKeyboardModifier.Shift) { noteArea.ScrollVertical(scrollDirection); } // Zoom vertical in NoteArea with Ctrl + Shift + mouse wheel if (modifier == EKeyboardModifier.CtrlShift) { noteArea.ZoomVertical(scrollDirection); } } }
private void OnNavigate(InputAction.CallbackContext context) { if (!songAudioPlayer.IsPlaying) { Vector2 direction = context.ReadValue <Vector2>(); EKeyboardModifier modifier = InputUtils.GetCurrentKeyboardModifier(); // Scroll if (modifier == EKeyboardModifier.None) { if (direction.x < 0) { noteAreaControl.ScrollHorizontal(-1); } if (direction.x > 0) { noteAreaControl.ScrollHorizontal(1); } } List <Note> selectedNotes = selectionControl.GetSelectedNotes(); if (selectedNotes.IsNullOrEmpty()) { return; } // Move and stretch notes List <Note> followingNotes = GetFollowingNotesOrEmptyListIfDeactivated(selectedNotes); // Move with Shift if (modifier == EKeyboardModifier.Shift) { if (direction.x != 0) { moveNotesAction.MoveNotesHorizontalAndNotify((int)direction.x, selectedNotes, followingNotes); } if (direction.y != 0) { moveNotesAction.MoveNotesVerticalAndNotify((int)direction.y, selectedNotes, followingNotes); } } // Move notes one octave up / down via Ctrl+Shift if (modifier == EKeyboardModifier.CtrlShift) { moveNotesAction.MoveNotesVerticalAndNotify((int)direction.y * 12, selectedNotes, followingNotes); } // Extend right side with Alt if (modifier == EKeyboardModifier.Alt) { extendNotesAction.ExtendNotesRightAndNotify((int)direction.x, selectedNotes, followingNotes); } // Extend left side with Ctrl if (modifier == EKeyboardModifier.Ctrl) { extendNotesAction.ExtendNotesLeftAndNotify((int)direction.x, selectedNotes); } } }
// Implements keyboard shortcuts similar to Yass. // See: https://github.com/UltraStar-Deluxe/Play/issues/111 private void UpdateInputForYassShortcuts(EKeyboardModifier modifier) { if (modifier != EKeyboardModifier.None) { return; } if (!isAnyKeyUp) { return; } // 4 and 6 on keypad to move to the previous/next note List <Note> selectedNotes = selectionController.GetSelectedNotes(); List <Note> followingNotes = GetFollowingNotesOrEmptyListIfDeactivated(selectedNotes); if (Input.GetKeyUp(KeyCode.Keypad4)) { selectionController.SelectPreviousNote(); } if (Input.GetKeyUp(KeyCode.Keypad6)) { selectionController.SelectNextNote(); } // 1 and 3 moves the note left and right (by one beat, length unchanged) if (Input.GetKeyUp(KeyCode.Keypad1)) { moveNotesAction.MoveNotesHorizontalAndNotify(-1, selectedNotes, followingNotes); } if (Input.GetKeyUp(KeyCode.Keypad3)) { moveNotesAction.MoveNotesHorizontalAndNotify(1, selectedNotes, followingNotes); } // 7 and 9 shortens/lengthens the note (by one beat, on the right side) if (Input.GetKeyUp(KeyCode.Keypad7)) { extendNotesAction.ExtendNotesRightAndNotify(-1, selectedNotes, followingNotes); } if (Input.GetKeyUp(KeyCode.Keypad9)) { extendNotesAction.ExtendNotesRightAndNotify(1, selectedNotes, followingNotes); } // Minus sign moves a note up a half-tone (due to the key's physical location, this makes sense) // Plus sign moves a note down a half-tone if (Input.GetKeyUp(KeyCode.KeypadMinus)) { moveNotesAction.MoveNotesVerticalAndNotify(1, selectedNotes, followingNotes); } if (Input.GetKeyUp(KeyCode.KeypadPlus)) { moveNotesAction.MoveNotesVerticalAndNotify(-1, selectedNotes, followingNotes); } // 5 plays the current selected note if (Input.GetKeyUp(KeyCode.Keypad5)) { PlayAudioInRangeOfNotes(selectedNotes); } // scroll left with h, scroll right with j if (Input.GetKeyUp(KeyCode.H)) { noteArea.ScrollHorizontal(-1); } if (Input.GetKeyUp(KeyCode.J)) { noteArea.ScrollHorizontal(1); } }
// Implements keyboard shortcuts similar to Yass. // See: https://github.com/UltraStar-Deluxe/Play/issues/111 private void UpdateInputForYassShortcuts() { EKeyboardModifier modifier = InputUtils.GetCurrentKeyboardModifier(); if (modifier != EKeyboardModifier.None // Yass shortcuts only work with a keyboard. || Keyboard.current == null || AnyInputFieldHasFocus()) { return; } // 4 and 6 on keypad to move to the previous/next note List <Note> selectedNotes = selectionControl.GetSelectedNotes(); List <Note> followingNotes = GetFollowingNotesOrEmptyListIfDeactivated(selectedNotes); if (Keyboard.current.numpad4Key.wasReleasedThisFrame) { selectionControl.SelectPreviousNote(); } if (Keyboard.current.numpad6Key.wasReleasedThisFrame) { selectionControl.SelectNextNote(); } // 1 and 3 moves the note left and right (by one beat, length unchanged) if (Keyboard.current.numpad1Key.wasReleasedThisFrame) { moveNotesAction.MoveNotesHorizontalAndNotify(-1, selectedNotes, followingNotes); } if (Keyboard.current.numpad3Key.wasReleasedThisFrame) { moveNotesAction.MoveNotesHorizontalAndNotify(1, selectedNotes, followingNotes); } // 7 and 9 (and 8 to be more similar to division and multiply for left side) shortens/lengthens the note (by one beat, on the right side) if (Keyboard.current.numpad7Key.wasReleasedThisFrame || Keyboard.current.numpad8Key.wasReleasedThisFrame) { extendNotesAction.ExtendNotesRightAndNotify(-1, selectedNotes, followingNotes); } if (Keyboard.current.numpad9Key.wasReleasedThisFrame) { extendNotesAction.ExtendNotesRightAndNotify(1, selectedNotes, followingNotes); } // division and multiplication shortens/lengthens the note (by one beat, on the left side) if (Keyboard.current.numpadDivideKey.wasReleasedThisFrame) { extendNotesAction.ExtendNotesLeftAndNotify(-1, selectedNotes); } if (Keyboard.current.numpadMultiplyKey.wasReleasedThisFrame) { extendNotesAction.ExtendNotesLeftAndNotify(1, selectedNotes); } // Minus sign moves a note up a half-tone (due to the key's physical location, this makes sense) // Plus sign moves a note down a half-tone if (Keyboard.current.numpadMinusKey.wasReleasedThisFrame) { moveNotesAction.MoveNotesVerticalAndNotify(1, selectedNotes, followingNotes); } if (Keyboard.current.numpadPlusKey.wasReleasedThisFrame) { moveNotesAction.MoveNotesVerticalAndNotify(-1, selectedNotes, followingNotes); } // 5 plays the current selected notes (if any) if (Keyboard.current.numpad5Key.wasReleasedThisFrame) { if (selectedNotes.IsNullOrEmpty()) { songEditorSceneControl.ToggleAudioPlayPause(); } else { PlayAudioInRangeOfNotes(selectedNotes); } } // scroll left with h, scroll right with j if (Keyboard.current.hKey.wasReleasedThisFrame) { noteAreaControl.ScrollHorizontal(-1); } if (Keyboard.current.jKey.wasReleasedThisFrame) { noteAreaControl.ScrollHorizontal(1); } }
void Update() { EKeyboardModifier modifier = InputUtils.GetCurrentKeyboardModifier(); // Open / close search via Ctrl if (Input.GetKeyDown(KeyCode.LeftControl)) { if (songSelectSceneController.IsSearchEnabled()) { songSelectSceneController.DisableSearch(); } else { songSelectSceneController.EnableSearch(SearchInputField.ESearchMode.ByTitleOrArtist); } } // Fuzzy search. Do not handle other input in this case. if (IsFuzzySearchActive()) { UpdateFuzzySearchInput(); return; } if (modifier != EKeyboardModifier.None) { return; } if (songSelectSceneController.IsSearchEnabled()) { // Close search via Escape or Return / Enter if (Input.GetKeyUp(KeyCode.Escape) || (Input.GetKeyUp(KeyCode.Return) && songSelectSceneController.IsSearchTextInputHasFocus())) { songSelectSceneController.DisableSearch(); } } else { // Open the main menu via Escape or Backspace if (Input.GetKeyUp(KeyCode.Escape) || Input.GetKeyUp(KeyCode.Backspace)) { SceneNavigator.Instance.LoadScene(EScene.MainScene); } // Random song select via R if (Input.GetKeyUp(KeyCode.R) && IsNoControlOrSongButtonFocused()) { songSelectSceneController.OnRandomSong(); } // Open the song editor via E if (Input.GetKeyUp(KeyCode.E) && IsNoControlOrSongButtonFocused()) { songSelectSceneController.StartSongEditorScene(); } } // Select next / previous song with arrow keys or mouse wheel if (Input.GetKeyUp(KeyCode.RightArrow) || Input.mouseScrollDelta.y > 0) { songSelectSceneController.OnNextSong(); } if (Input.GetKeyUp(KeyCode.LeftArrow) || Input.mouseScrollDelta.y < 0) { songSelectSceneController.OnPreviousSong(); } // Open the sing scene via Return / Enter if (Input.GetKeyUp(KeyCode.Return) && IsNoControlOrSongButtonFocused()) { songSelectSceneController.StartSingScene(); } // Toggle active players with Tab if (Input.GetKeyUp(KeyCode.Tab)) { songSelectSceneController.ToggleSelectedPlayers(); } }
public void Update() { // Detect isAnyKeyUp isAnyKeyUp = false; if (Input.anyKey) { isAnyKey = true; } else if (isAnyKey) { isAnyKey = false; isAnyKeyUp = true; } if (GameObjectUtils.InputFieldHasFocus(eventSystem)) { return; } EKeyboardModifier modifier = InputUtils.GetCurrentKeyboardModifier(); // Play / pause via Space or P bool isPlayPauseButtonUp = Input.GetKeyUp(KeyCode.Space) || Input.GetKeyUp(KeyCode.P); if (isPlayPauseButtonUp && modifier == EKeyboardModifier.None) { ToggleAudioPlayPause(); } // Play only the selected notes via Ctrl+Space or Ctrl+P if (isPlayPauseButtonUp && modifier == EKeyboardModifier.Ctrl) { List <Note> selectedNotes = selectionController.GetSelectedNotes(); PlayAudioInRangeOfNotes(selectedNotes); } // Stop via Escape if (Input.GetKeyUp(KeyCode.Escape)) { songAudioPlayer.PauseAudio(); } // Select all notes via Ctrl+A if (Input.GetKeyUp(KeyCode.A) && modifier == EKeyboardModifier.Ctrl) { selectionController.SelectAll(); } // Delete notes if (Input.GetKeyUp(KeyCode.Delete)) { List <Note> selectedNotes = selectionController.GetSelectedNotes(); deleteNotesAction.ExecuteAndNotify(selectedNotes); } // Undo via Ctrl+Z if (Input.GetKeyUp(KeyCode.Z) && modifier == EKeyboardModifier.Ctrl) { historyManager.Undo(); } // Redo via Ctrl+Y if (Input.GetKeyUp(KeyCode.Y) && modifier == EKeyboardModifier.Ctrl) { historyManager.Redo(); } // Save via Ctrl+S if (Input.GetKeyUp(KeyCode.S) && modifier == EKeyboardModifier.Ctrl) { songEditorSceneController.SaveSong(); } // Tab to select next note, Shift+Tab to select previous note if (Input.GetKeyUp(KeyCode.Tab)) { if (modifier == EKeyboardModifier.None) { selectionController.SelectNextNote(); } else if (modifier == EKeyboardModifier.Shift) { selectionController.SelectPreviousNote(); } } // Start editing of lyrics with F2 if (Input.GetKeyUp(KeyCode.F2)) { List <Note> selectedNotes = selectionController.GetSelectedNotes(); if (selectedNotes.Count == 1) { Note selectedNote = selectedNotes.FirstOrDefault(); EditorUiNote uiNote = editorNoteDisplayer.GetUiNoteForNote(selectedNote); if (uiNote != null) { uiNote.StartEditingNoteText(); } } } // Change position in song with Ctrl+ArrowKey if (!songAudioPlayer.IsPlaying) { if (Input.GetKey(KeyCode.LeftArrow) && modifier == EKeyboardModifier.Ctrl) { songAudioPlayer.PositionInSongInMillis -= 1; } if (Input.GetKey(KeyCode.RightArrow) && modifier == EKeyboardModifier.Ctrl) { songAudioPlayer.PositionInSongInMillis += 1; } } // Move and stretch notes UpdateInputToMoveAndStretchNotes(modifier); // Scroll and zoom in NoteArea UpdateInputToScrollAndZoom(modifier); // Use the shortcuts that are also used in the YASS song editor. UpdateInputForYassShortcuts(modifier); }
public void Update() { EKeyboardModifier modifier = InputUtils.GetCurrentKeyboardModifier(); // Play / pause via Space if (Input.GetKeyUp(KeyCode.Space) && !InputFieldHasFocus()) { ToggleAudioPlayPause(); } // Stop via Escape if (Input.GetKeyUp(KeyCode.Escape)) { songAudioPlayer.PauseAudio(); } // Delete notes if (Input.GetKeyUp(KeyCode.Delete)) { List <Note> selectedNotes = selectionController.GetSelectedNotes(); deleteNotesAction.ExecuteAndNotify(selectedNotes); } // Undo via Ctrl+Z if (Input.GetKeyUp(KeyCode.Z) && modifier == EKeyboardModifier.Ctrl) { historyManager.Undo(); } // Redo via Ctrl+Y if (Input.GetKeyUp(KeyCode.Y) && modifier == EKeyboardModifier.Ctrl) { historyManager.Redo(); } // Save via Ctrl+S if (Input.GetKeyUp(KeyCode.S) && modifier == EKeyboardModifier.Ctrl) { songEditorSceneController.SaveSong(); } // Tab to select next note, Shift+Tab to select previous note if (Input.GetKeyUp(KeyCode.Tab)) { if (modifier == EKeyboardModifier.None) { selectionController.SelectNextNote(); } else if (modifier == EKeyboardModifier.Shift) { selectionController.SelectPreviousNote(); } } // Start editing of lyrics with F2 if (Input.GetKeyUp(KeyCode.F2)) { List <Note> selectedNotes = selectionController.GetSelectedNotes(); if (selectedNotes.Count == 1) { Note selectedNote = selectedNotes.FirstOrDefault(); EditorUiNote uiNote = editorNoteDisplayer.GetUiNoteForNote(selectedNote); if (uiNote != null) { uiNote.StartEditingNoteText(); } } } // Change position in song with Ctrl+ArrowKey if (!songAudioPlayer.IsPlaying) { if (Input.GetKey(KeyCode.LeftArrow) && modifier == EKeyboardModifier.Ctrl && !InputFieldHasFocus()) { songAudioPlayer.PositionInSongInMillis -= 1; } if (Input.GetKey(KeyCode.RightArrow) && modifier == EKeyboardModifier.Ctrl && !InputFieldHasFocus()) { songAudioPlayer.PositionInSongInMillis += 1; } } // Move and stretch notes UpdateInputToMoveAndStretchNotes(modifier); // Scroll and zoom in NoteArea UpdateInputToScrollAndZoom(modifier); }