/// <summary> /// /// </summary> /// <returns></returns> private float GetHorizontalAxis() { if (userIndex == -1) { return(InputHelper.GetAnyUIHorizontalAxis()); } return(InputHelper.GetUIHorizontalAxis(userIndex)); }
/// <summary> /// /// </summary> private void Update() { var horizontalAxis = InputHelper.GetAnyUIHorizontalAxis(); if (horizontalAxis == 0.0f || (horizontalAxis != 0.0f && _lastHorizontalAxis != 0.0f)) { _lastHorizontalAxis = horizontalAxis; return; } _lastHorizontalAxis = horizontalAxis; if (canFlip && horizontalAxis != 0.0f) { SwitchScheme(); } }
/// <summary> /// /// </summary> private void SettingsTabCycle() { if (InputHelper.AnyAxis(PrevInputName) != 0.0f || (isNavigatingTabs && InputHelper.GetAnyUIHorizontalAxis() < 0.0f)) { if (!_isPrevPressed) { _currentOptionIndex -= 1; _currentOptionIndex = MathExtensions.Mod(_currentOptionIndex, _optionIndex); FocusChanged(); } _isPrevPressed = true; } else { _isPrevPressed = false; } if (InputHelper.AnyAxis(NextInputName) != 0.0f || (isNavigatingTabs && InputHelper.GetAnyUIHorizontalAxis() > 0.0f)) { if (!_isNextPressed) { _currentOptionIndex += 1; _currentOptionIndex = MathExtensions.Mod(_currentOptionIndex, _optionIndex); FocusChanged(); } _isNextPressed = true; } else { _isNextPressed = false; } GameObject selectedPanel = null; _tabsToUnfocus.Clear(); switch (_optionTexts[_currentOptionIndex]) { case "Gameplay": _tabsToUnfocus.Add(_controlsPanel.GetComponent <SettingsTabUINavigation>()); _tabsToUnfocus.Add(_videoPanel.GetComponent <SettingsTabUINavigation>()); _tabsToUnfocus.Add(_audioPanel.GetComponent <SettingsTabUINavigation>()); _gameplayPanel.SetActive(true); _controlsPanel.SetActive(false); _videoPanel.SetActive(false); _audioPanel.SetActive(false); selectedPanel = _gameplayPanel; break; case "Controls": _tabsToUnfocus.Add(_gameplayPanel.GetComponent <SettingsTabUINavigation>()); _tabsToUnfocus.Add(_videoPanel.GetComponent <SettingsTabUINavigation>()); _tabsToUnfocus.Add(_audioPanel.GetComponent <SettingsTabUINavigation>()); _controlsPanel.SetActive(true); selectedPanel = _controlsPanel; break; case "Video": _tabsToUnfocus.Add(_gameplayPanel.GetComponent <SettingsTabUINavigation>()); _tabsToUnfocus.Add(_controlsPanel.GetComponent <SettingsTabUINavigation>()); _tabsToUnfocus.Add(_audioPanel.GetComponent <SettingsTabUINavigation>()); _videoPanel.SetActive(true); selectedPanel = _videoPanel; break; case "Audio": _tabsToUnfocus.Add(_gameplayPanel.GetComponent <SettingsTabUINavigation>()); _tabsToUnfocus.Add(_controlsPanel.GetComponent <SettingsTabUINavigation>()); _tabsToUnfocus.Add(_videoPanel.GetComponent <SettingsTabUINavigation>()); _audioPanel.SetActive(true); selectedPanel = _audioPanel; break; } foreach (var tabToUnfocus in _tabsToUnfocus) { if (tabToUnfocus != null) { tabToUnfocus.Unfocus(true); tabToUnfocus.gameObject.SetActive(false); } } var navigation = selectedPanel?.GetComponent <SettingsTabUINavigation>(); if (navigation != null) { navigation.panelNavigationHandler = this; if (!isNavigatingTabs && !navigation.hasFocus) { navigation.SetLastAxes(Vector2.one); navigation.Focus(); } } }