public IEnumerator OpenRadial(Vector2 startPosition, MenuActionLayer menuAction) { if (_state != State.Disabled) { StartCloseRadial(); while (_state != State.Disabled) { yield return(null); } } _currentLayer = menuAction; PanelTransform.position = startPosition; var point = PanelTransform.anchoredPosition; point.x = Mathf.Clamp(point.x, -_positionLimit.x, _positionLimit.x); point.y = Mathf.Clamp(point.y, -_positionLimit.y, _positionLimit.y); PanelTransform.anchoredPosition = point; if (GameOptions.PauseForInput) { Game.Pause("Radial"); } Game.CursorUnlock("Radial"); _clickTimer.StartTimer(); _state = State.Opening; DetermineTargetAngle(_currentControl); _currentLayer.Init(this, _cursorTargetAngle); _fadeIn.Restart(0, 1); _canvasGroup.SetActive(true); }
public static void TransitionToNewLayer(MenuActionLayer actionLayer) { actionLayer.Init(_main, _main._cursorTargetAngle); _main._currentLayer.StartClose(); _main._previousLayers.Add(_main._currentLayer); _main._nextLayer = actionLayer; _main._state = State.Changing; }
public void SetupRadial(string defaultLabel, MenuActionLayer menuAction, Vector2 position) { if (_state == State.Opening || menuAction == null || menuAction.Count == 0) { return; } UITooltip.main.HideTooltip(); //UICursor.SetActive(false); _defaultText = defaultLabel; _topText.text = _defaultText; _detailText.text = ""; TimeManager.StartUnscaled(OpenRadial(position, menuAction)); }
public IEnumerator CloseRadial() { _state = State.Closing; _fadeOut.Restart(1, 0); if (_currentLayer != null) { _currentLayer.StartClose(); } while (true) { if (_fadeOut.Active) { _canvasGroup.alpha = _fadeOut.Get(); } if (_currentLayer != null) { if (_currentLayer.TransitionComplete() && !_fadeOut.Active) { break; } } else { if (!_fadeOut.Active) { break; } } yield return(null); } if (_currentLayer != null) { _currentLayer.Pool(); _currentLayer = null; } for (int i = 0; i < _previousLayers.Count; i++) { _previousLayers[i].Pool(); } _previousLayers.Clear(); _canvasGroup.SetActive(false); if (GameOptions.PauseForInput) { Game.RemovePause("Radial"); } Game.RemoveCursorUnlock("Radial"); _state = State.Disabled; }
public bool TransitionToPreviousLayer() { if (_previousLayers.Count == 0) { StartCloseRadial(); return(false); } var prev = _previousLayers.LastElement(); _previousLayers.Remove(prev); _currentLayer.StartClose(); _nextLayer = prev; _nextLayer.Init(this, _cursorTargetAngle); _state = State.Changing; _detailText.text = ""; return(true); }
void Update() { if (_state == State.Disabled || _state == State.Closing) { return; } switch (_state) { case State.Opening: if (_fadeIn.Active) { _canvasGroup.alpha = _fadeIn.Get(); } if (_currentLayer.TransitionComplete() && !_fadeIn.Active) { _state = State.Open; } break; case State.Changing: if (_currentLayer.TransitionComplete() && _nextLayer.TransitionComplete()) { _currentLayer = _nextLayer; _state = State.Open; } break; } //hurry up is breaking animation fix later if (_currentLayer == null || _currentLayer.IsTransitioningOut || _state == State.Opening) { return; } _currentControl = ControlMethod.None; TouchInput(); ControllerInput(); MouseInput(); }
public static void Open(string defaultLabel, MenuActionLayer menuAction, Vector2 position) { _main.SetupRadial(defaultLabel, menuAction, position); }