protected override void ShowStarted() { base.ShowStarted(); CurrentEventSystem.SetSelectedGameObject(nameText.gameObject); nameText.text = WorkingLevelData.name; descriptionText.text = WorkingLevelData.description; }
private void CheckToMoveFilter() { bool leftButtonPressed = InputManager.Instance.QueryAction(Strings.Input.UI.TAB_LEFT, ButtonMode.DOWN); bool rightBumperPressed = InputManager.Instance.QueryAction(Strings.Input.UI.TAB_RIGHT, ButtonMode.DOWN); bool mouseClicked = Input.GetMouseButtonDown(MouseButtons.LEFT) || Input.GetMouseButtonDown(MouseButtons.RIGHT) || Input.GetMouseButtonDown(MouseButtons.MIDDLE); if (!mouseClicked && (leftButtonPressed || rightBumperPressed)) { if (leftButtonPressed) { SelectedFilterToggle--; } else { SelectedFilterToggle++; } CurrentEventSystem.SetSelectedGameObject(RewireSubMenu().gameObject); } }
public void SelectLevel(int levelIndex, bool selectSelectable = true) { SFXManager.Instance.Play(SFXType.UI_Click); Timing.KillCoroutines(PulseCoroutineName); if (lastSelectedLevel != null) { lastSelectedLevel.ScaleLevelUISize(1f); } SelectedLevelIndex = levelIndex; selectLevelAnim.OnUpdate = SelectedLevelUI.ScaleLevelUISize; selectLevelAnim.Animate(PulseCoroutineName); if (selectSelectable) { SelectedLevelUI.selectable.Select(); CurrentEventSystem.SetSelectedGameObject(SelectedLevelUI.selectable.gameObject); } lastSelectedLevel = SelectedLevelUI; LevelData selectedLevel = SelectedLevelUI.levelData; selectedLevelNameText.text = selectedLevel.name; selectedLevelDescriptionText.text = selectedLevel.description; Sprite spriteToShow = selectedLevel.isHathosLevel ? hathosBigPreview : selectedLevel.MySprite; selectedLevelImage.sprite = spriteToShow; levelUIs.ForEach(levelUI => { levelUI.OnGroupSelectChanged(levelIndex); }); selectedLevelFavoriteIcon.enabled = selectedLevel.isFavorite; SetButtonsInteractabilityAndNavigation(); AlignScrollbar(); }
internal void SelectInitialButton() { if (InitialSelection != null && Displayed) { InitialSelection.Select(); CurrentEventSystem.SetSelectedGameObject(InitialSelection.gameObject); } }
void HandleInputFieldSelection() { if (MoveForward) { CurrentEventSystem.SetSelectedGameObject(descriptionText.gameObject); } else if (MoveBack) { CurrentEventSystem.SetSelectedGameObject(nameText.gameObject); } }
private void GoBackFromBothSelected() { selectingPlayerLeft = true; selectingPlayerRight = false; leftArm.SelectArrows(); rightArm.UnselectArrows(); leftArm.GlowControl.SetState(WeaponSelectState.Highlighted); ChangeWeaponTextPanel(leftArm); leftArmAnimator.SetTrigger("DoUnlock"); CurrentEventSystem.SetSelectedGameObject(null); }
public void SelectMenuItem(PLEMenuType menu) { SFXManager.Instance.Play(SFXType.UI_Click); MenuSelectable selectedMenuItem = menuToggles.Find(menuToggle => menuToggle.menu == menu); Selectable selectedSelectable = selectedMenuItem.selectable; if (menu != currentDisplayedMenu) { selectedSelectable.Select(); SwitchToMenu(menu); } CurrentEventSystem.SetSelectedGameObject(selectedSelectable.gameObject); }
private void LockInLeftAction() { ModManager.leftArmOnLoad = leftArm.GetModType; selectingPlayerRight = false; selectingPlayerLeft = false; leftArm.UnselectArrows(); leftArm.GlowControl.SetState(WeaponSelectState.Confirmed); leftArmAnimator.SetTrigger("DoLock"); playerFaceController.SetTemporaryEmotion(PlayerFaceController.Emotion.Happy, .4f); SFXManager.Instance.Play(SFXType.LandmarkBlastShort, Camera.main.transform.position); AnimateStartButton(); startButton.Select(); CurrentEventSystem.SetSelectedGameObject(startButton.gameObject); }
private void CheckToSelectNewLevelFromController() { bool isLevelUISelected = SelectedLevelUI != null && levelUIs.Exists(currentSelectedUIIsLevel); if (isLevelUISelected && SelectedLevelUI.selectable.gameObject != lastSelectedGameObject) { LevelUI newlySelectedLevelUI = levelUIs.Find(currentSelectedUIIsLevel); SelectLevel(newlySelectedLevelUI.LevelIndex); } if (InputManager.Instance.QueryAction(Strings.Input.UI.SUBMIT, ButtonMode.DOWN)) { if (isLevelUISelected) { SFXManager.Instance.Play(SFXType.UI_Click); CurrentEventSystem.SetSelectedGameObject(loadButton.gameObject); } } }
private void SetButtonStates() { testLevelButton.gameObject.SetActive(false); weaponSelectButton.gameObject.SetActive(false); restartButton.gameObject.SetActive(false); quitButton.gameObject.SetActive(false); if (SceneTracker.IsCurrentSceneEditor) { testLevelButton.gameObject.SetActive(true); CurrentEventSystem.SetSelectedGameObject(testLevelButton.gameObject); } else { weaponSelectButton.gameObject.SetActive(true); restartButton.gameObject.SetActive(true); quitButton.gameObject.SetActive(true); CurrentEventSystem.SetSelectedGameObject(weaponSelectButton.gameObject); } }
private void Update() { if (CurrentEventSystem == null || CurrentEventSystem.currentInputModule == null) { return; } var selected = CurrentEventSystem.currentSelectedGameObject; if (SceneIsLoading() || ShouldDisableNavigation()) { if (selected != null) { CurrentEventSystem.SetSelectedGameObject(null); } return; } var input = CurrentEventSystem.currentInputModule.input; if (Mathf.Abs(input.GetAxisRaw("Horizontal")) > 0.01f || Mathf.Abs(input.GetAxisRaw("Vertical")) > 0.01f || input.GetButtonDown("Submit")) { // Do not show the cursor or select anything if we are currently editing a text field if (selected != null && selected.GetComponent <InputField>()?.isFocused == true) { return; } _timeSinceLastAction = 0f; } else { // Wait until next frame to check if current selection is still valid after pressing a button if (_timeSinceLastAction.Equals(0f)) { if (!CanvasManager.IsSelectionValid(selected)) { if (GamepadSupportPlugin.CanvasDebug.Value) { GamepadSupportPlugin.Logger.Log(LogLevel.Message, "invalid selection"); } selected = null; } } _timeSinceLastAction = Mathf.Min(_timeSinceLastAction + Time.deltaTime, CursorTimeout); } // When using mouse hide immediately if (Input.GetMouseButton(0) || Input.GetMouseButton(1) || Input.GetMouseButton(3)) { _timeSinceLastAction = CursorTimeout; } if (_timeSinceLastAction >= CursorTimeout) { return; } if (CanvasManager.UpdateAllNavigation()) { if (!CanvasManager.IsSelectionValid(selected)) { if (GamepadSupportPlugin.CanvasDebug.Value) { GamepadSupportPlugin.Logger.Log(LogLevel.Message, "invalid selection"); } selected = null; } } if (selected == null) { CanvasManager.SelectFirstControl(); } else { var selectable = selected.GetComponent <Selectable>(); if (selectable == null) { if (GamepadSupportPlugin.CanvasDebug.Value) { GamepadSupportPlugin.Logger.Log(LogLevel.Message, "not a Selectable"); } CanvasManager.SelectFirstControl(); } else { if (!selectable.isActiveAndEnabled) { if (GamepadSupportPlugin.CanvasDebug.Value) { GamepadSupportPlugin.Logger.Log(LogLevel.Message, "object not isActiveAndEnabled"); } // Needed for some transitions, e.g. live mode CanvasManager.UpdateCanvases(); CanvasManager.SelectFirstControl(); } } } }