private void Start() { InputManager.GetInputAction(R.InputActions.usplay_skipToNextLyrics).PerformedAsObservable() .Subscribe(_ => singSceneController.SkipToNextSingableNote()); InputManager.GetInputAction(R.InputActions.ui_navigate).PerformedAsObservable() .Where(context => context.ReadValue <Vector2>().x > 0) .Subscribe(_ => singSceneController.SkipToNextSingableNote()); InputManager.GetInputAction(R.InputActions.usplay_openSongEditor).PerformedAsObservable() .Subscribe(_ => singSceneController.OpenSongInEditor()); InputManager.GetInputAction(R.InputActions.usplay_restartSong).PerformedAsObservable() .Subscribe(_ => singSceneController.Restart()); InputManager.GetInputAction(R.InputActions.usplay_togglePause).PerformedAsObservable() .Subscribe(_ => singSceneController.TogglePlayPause()); InputManager.GetInputAction(R.InputActions.usplay_back).PerformedAsObservable() .Subscribe(_ => { if (!songAudioPlayer.IsPlaying) { singSceneController.TogglePlayPause(); } else { singSceneController.FinishScene(false); } }); InputManager.AdditionalInputActionInfos.Add(new InputActionInfo("Skip To Next Lyrics", "Navigate Right")); InputManager.AdditionalInputActionInfos.Add(new InputActionInfo("Toggle Pause", "Double Click")); }
void Update() { if (Input.GetKeyUp(SkipShortcut)) { singSceneController.SkipToNextSingableNote(); } if (Input.GetKeyUp(OpenInEditorShortcut)) { singSceneController.OpenSongInEditor(); } if (Input.GetKeyUp(RestartShortcut)) { singSceneController.Restart(); } if (Input.GetKeyUp(BackToSongSelectShortcut) || Input.GetKeyUp(BackToSongSelectShortcut2)) { singSceneController.FinishScene(false); } if (Input.GetKeyUp(PauseShortcut)) { singSceneController.TogglePlayPause(); } }
public void OnPointerClick(PointerEventData eventData) { bool isDoubleClick = Time.time - lastClickTime < InputUtils.DoubleClickThresholdInSeconds; lastClickTime = Time.time; if (isDoubleClick) { singSceneController.TogglePlayPause(); } }
protected override void FillContextMenu(ContextMenu contextMenu) { contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_togglePause), () => singSceneController.TogglePlayPause()); contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_restart), () => singSceneController.Restart()); contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_skipToNextLyrics), () => singSceneController.SkipToNextSingableNote()); contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_exitSong), () => singSceneController.FinishScene(false)); contextMenu.AddItem(I18NManager.GetTranslation(R.String.action_openSongEditor), () => singSceneController.OpenSongInEditor()); }