public static Selectable GetSelectableOn(Selectable i_Current, UINavigationDirection i_NavigationDirection) { if (i_Current == null) { return(null); } Selectable selectable = null; switch (i_NavigationDirection) { case UINavigationDirection.Down: selectable = GetSelectableOnDown(i_Current); break; case UINavigationDirection.Left: selectable = GetSelectableOnLeft(i_Current); break; case UINavigationDirection.Right: selectable = GetSelectableOnRight(i_Current); break; case UINavigationDirection.Up: selectable = GetSelectableOnUp(i_Current); break; } return(selectable); }
private GameObject GetNearest(GameObject i_Source, UINavigationDirection i_Direction) { if (i_Source == null) { return(null); } GameObject nextSelection = null; switch (i_Direction) { case UINavigationDirection.Left: nextSelection = GetNearestOnLeft(i_Source); break; case UINavigationDirection.Right: nextSelection = GetNearestOnRight(i_Source); break; case UINavigationDirection.Up: nextSelection = GetNearestOnUp(i_Source); break; case UINavigationDirection.Down: nextSelection = GetNearestOnDown(i_Source); break; } return(nextSelection); }
public void Move(int i_TeamIndex, UINavigationDirection i_Direction) { if (viewInstance != null) { viewInstance.Move(i_TeamIndex, i_Direction); } }
/// <summary> /// /// </summary> /// <param name="direction"></param> private void SendNavigation(UINavigationDirection direction) { var data = new UINavigationData(_currentNavigable, this, direction); SendMessage(OnNavigateMethodName, data, SendMessageOptions.DontRequireReceiver); TryMoveFocus(direction); if (gameObject != _currentNavigable?.gameObject) { _currentNavigable?.SendMessage(OnNavigateMethodName, data, SendMessageOptions.DontRequireReceiver); } }
public void MoveSelection(int i_TeamIndex, UINavigationDirection i_Direction) { if (viewInstance != null) { if (i_TeamIndex >= 0 && i_TeamIndex < s_MaxPlayers) { if (!m_TeamConfirmed[i_TeamIndex]) { viewInstance.Move(i_TeamIndex, i_Direction); } } } }
public void Move(int i_TeamIndex, UINavigationDirection i_Direction) { if (IsValidIndex(i_TeamIndex)) { GameObject selected = m_Selections[i_TeamIndex]; if (selected != null) { GameObject nearest = GetNearest(selected, i_Direction); if (nearest != null) { SfxPlayer.PlayMain(m_SelectionChangedSfx); Select(i_TeamIndex, nearest); } } } }
/// <summary> /// /// </summary> /// <param name="direction"></param> private void TryMoveFocus(UINavigationDirection direction) { if (_currentNavigable != null) { UINavigable nextNavigable = null; switch (direction) { case UINavigationDirection.Up: nextNavigable = _currentNavigable.up; break; case UINavigationDirection.Right: nextNavigable = _currentNavigable.right; break; case UINavigationDirection.Down: nextNavigable = _currentNavigable.down; break; case UINavigationDirection.Left: nextNavigable = _currentNavigable.left; break; } if (nextNavigable != null) { Focus(nextNavigable); } } }
public UINavigationData(UINavigable navigable, UINavigation navigationHandler, UINavigationDirection direction) { this.navigable = navigable; this.navigationHandler = navigationHandler; this.direction = direction; }