void Start() { rightArrowKeyPressDetector.ContinuedKeyPressEventStream .Subscribe(_ => songSelectSceneController.OnNextSong()); leftArrowKeyPressDetector.ContinuedKeyPressEventStream .Subscribe(_ => songSelectSceneController.OnPreviousSong()); }
private void OnScrollWheel(InputAction.CallbackContext context) { if (songSelectSceneController.IsSearchEnabled()) { return; } if (context.ReadValue <Vector2>().y < 0) { songSelectSceneController.OnNextSong(); } if (context.ReadValue <Vector2>().y > 0) { songSelectSceneController.OnPreviousSong(); } }
void Update() { SongSelectSceneController songSelectSceneController = SongSelectSceneController.Instance; if (Input.GetKeyUp(NextSongShortcut)) { songSelectSceneController.OnNextSong(); } if (Input.GetKeyUp(PreviousSongShortcut)) { songSelectSceneController.OnPreviousSong(); } if (Input.GetKeyUp(KeyCode.Escape)) { if (songSelectSceneController.IsSearchEnabled()) { songSelectSceneController.DisableSearch(); } else { SceneNavigator.Instance.LoadScene(EScene.MainScene); } } if (Input.GetKeyUp(StartSingSceneShortcut)) { songSelectSceneController.OnStartSingScene(); } if (Input.GetKeyDown(QuickSearchArtist)) { songSelectSceneController.EnableSearch(SearchInputField.ESearchMode.ByArtist); } if (Input.GetKeyDown(QuickSearchSong)) { songSelectSceneController.EnableSearch(SearchInputField.ESearchMode.BySongTitle); } }
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(); } }
void Update() { SongSelectSceneController songSelectSceneController = SongSelectSceneController.Instance; // Open / close search if (Input.GetKeyDown(QuickSearchArtist)) { songSelectSceneController.EnableSearch(SearchInputField.ESearchMode.ByArtist); } if (Input.GetKeyDown(QuickSearchSong)) { songSelectSceneController.EnableSearch(SearchInputField.ESearchMode.BySongTitle); } if (songSelectSceneController.IsSearchEnabled()) { // When the search is enabled, then close it via Escape if (Input.GetKeyUp(KeyCode.Escape)) { songSelectSceneController.DisableSearch(); } } else { // When the search is not enabled, then open the main menu via Escape or Backspace if (Input.GetKeyUp(KeyCode.Escape) || Input.GetKeyUp(KeyCode.Backspace)) { SceneNavigator.Instance.LoadScene(EScene.MainScene); } if (Input.GetKeyUp(RandomSongShortcut)) { songSelectSceneController.OnRandomSong(); } } if (Input.GetKeyUp(NextSongShortcut)) { songSelectSceneController.OnNextSong(); } if (Input.GetKeyUp(PreviousSongShortcut)) { songSelectSceneController.OnPreviousSong(); } if (Input.GetKeyUp(StartSingSceneShortcut) || (Input.GetKeyUp(OpenInEditorShortcut) && !songSelectSceneController.IsSearchEnabled())) { GameObject focusedControl = GameObjectUtils.GetSelectedGameObject(); bool focusedControlIsSongButton = (focusedControl != null && focusedControl.GetComponent <SongRouletteItem>() != null); bool focusedControlIsSearchField = (focusedControl != null && focusedControl.GetComponent <SearchInputField>() != null); if (focusedControl == null || focusedControlIsSongButton || focusedControlIsSearchField) { if (Input.GetKeyUp(StartSingSceneShortcut)) { songSelectSceneController.StartSingScene(); } else if (Input.GetKeyUp(OpenInEditorShortcut)) { songSelectSceneController.StartSongEditorScene(); } } } }