Exemplo n.º 1
0
 private void OnSubmit(InputAction.CallbackContext callbackContext)
 {
     if (songSelectSceneController.IsSearchEnabled() &&
         songSelectSceneController.IsSearchTextInputHasFocus())
     {
         // Close search
         songSelectSceneController.DisableSearch();
     }
     else if (IsNoControlOrSongButtonFocused())
     {
         songSelectSceneController.CheckAudioAndStartSingScene();
     }
     else
     {
         songSelectSceneControlNavigator.SubmitSelectedControl();
     }
 }
Exemplo n.º 2
0
    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();
        }
    }