private void Update() { if (myEventSystem.currentSelectedGameObject == null) { return; } currentObject = myEventSystem.currentSelectedGameObject.GetComponent <Selectable> (); if (InputManager.SelectButtonDown()) { if (currentObject.GetComponent <Button> () == null) { return; } Button button = currentObject.GetComponent <Button> (); ExecuteEvents.Execute(button.gameObject, new BaseEventData(myEventSystem), ExecuteEvents.submitHandler); } if (InputManager.UpButtonDown()) { if (currentObject.FindSelectableOnUp() == null) { return; } GameObject nextObj = currentObject.FindSelectableOnUp().gameObject; myEventSystem.SetSelectedGameObject(nextObj); Debug.Log("Navigate up"); } if (InputManager.DownButtonDown()) { if (currentObject.FindSelectableOnDown() == null) { return; } GameObject nextObj = currentObject.GetComponent <Selectable> ().FindSelectableOnDown().gameObject; myEventSystem.SetSelectedGameObject(nextObj); Debug.Log("Navigate down"); } if (InputManager.LeftButtonDown()) { if (currentObject.FindSelectableOnLeft() == null) { return; } GameObject nextObj = currentObject.FindSelectableOnLeft().gameObject; myEventSystem.SetSelectedGameObject(nextObj); Debug.Log("Navigate left"); } if (InputManager.RightButtonDown()) { if (currentObject.FindSelectableOnRight() == null) { return; } GameObject nextObj = currentObject.FindSelectableOnRight().gameObject; myEventSystem.SetSelectedGameObject(nextObj); Debug.Log("Navigate right"); } }
private void OnDestroy() { if (EventSystem.current == null) { return; } if (EventSystem.current.currentSelectedGameObject == gameObject) { if (m_selectable.FindSelectableOnUp() != null) { m_selectable.FindSelectableOnUp().Select(); } else if (m_selectable.FindSelectableOnDown() != null) { m_selectable.FindSelectableOnDown().Select(); } else if (m_selectable.FindSelectableOnLeft() != null) { m_selectable.FindSelectableOnLeft().Select(); } else if (m_selectable.FindSelectableOnRight() != null) { m_selectable.FindSelectableOnRight().Select(); } } }
/// <summary> /// 更新检查输入 /// </summary> void Update() { if (Input.GetButtonDown("Submit") || Input.GetKeyDown(KeyCode.Return)) { OnSubmit(); } if (Input.GetButtonDown("Cancel")) { OnCancel?.Invoke(); } if (Input.GetButtonDown("Vertical") && Input.GetAxis("Vertical") > 0) { ForcusControl(mActiveControl?.FindSelectableOnUp()); } if (Input.GetButtonDown("Vertical") && Input.GetAxis("Vertical") < 0) { ForcusControl(mActiveControl?.FindSelectableOnDown()); } if (Input.GetButtonDown("Horizontal") && Input.GetAxis("Horizontal") > 0) { ForcusControl(mActiveControl?.FindSelectableOnRight()); } if (Input.GetButtonDown("Horizontal") && Input.GetAxis("Horizontal") < 0) { ForcusControl(mActiveControl?.FindSelectableOnLeft()); } }
private void UpdateSelectable(EPlayer player, float horizontalAxis, float verticalAxis) { EventSystem currentEventSystem = EventSystem.current; if (currentEventSystem != null) { GameObject selectedGO = currentEventSystem.currentSelectedGameObject; if (selectedGO != null) { Selectable selectableGO = selectedGO.GetComponent <Selectable>(); if (selectableGO != null) { if (horizontalAxis < 0f) { selectableGO.FindSelectableOnLeft()?.Select(); } else if (horizontalAxis > 0f) { selectableGO.FindSelectableOnRight()?.Select(); } else if (verticalAxis < 0f) { selectableGO.FindSelectableOnDown()?.Select(); } else if (verticalAxis > 0f) { selectableGO.FindSelectableOnUp()?.Select(); } } } } }
private void NextObjectSelect(Selectable currentObject, ref Selectable nextObject) { if (currentObject != null) { // shift 누르고 있으면 (shift + tab 이면) 뒤로 if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { nextObject = currentObject.FindSelectableOnUp(); if (nextObject == null) { nextObject = currentObject.FindSelectableOnLeft(); } } else { nextObject = currentObject.FindSelectableOnDown(); if (nextObject == null) { nextObject = currentObject.FindSelectableOnRight(); } } } // current가 null이면 선택가능한 전체에서 1번째를 잡음 else { if (Selectable.allSelectables.Count > 0) { nextObject = Selectable.allSelectables[0]; } } }
public InventorySlotUI FindNeighbours(UIMoveDirection dir) { InventorySlotUI s = null; if (dir == UIMoveDirection.Down) { if (selectable.FindSelectableOnDown().TryGetComponent <InventorySlotUI>(out InventorySlotUI outSlot)) { s = outSlot; } } else if (dir == UIMoveDirection.Up) { if (selectable.FindSelectableOnUp().TryGetComponent <InventorySlotUI>(out InventorySlotUI outSlot)) { s = outSlot; } } else if (dir == UIMoveDirection.Right) { if (selectable.FindSelectableOnRight().TryGetComponent <InventorySlotUI>(out InventorySlotUI outSlot)) { s = outSlot; } } else if (dir == UIMoveDirection.Left) { if (selectable.FindSelectableOnLeft().TryGetComponent <InventorySlotUI>(out InventorySlotUI outSlot)) { s = outSlot; } } return(s); }
private GameObject GetNearestOnRight(GameObject i_Source) { if (i_Source == null) { return(null); } Selectable sourceSelectable = i_Source.GetComponent <Selectable>(); if (sourceSelectable == null) { return(null); } Selectable selectable = sourceSelectable.FindSelectableOnRight(); while (selectable != null && !IsAvailable(selectable.gameObject)) { selectable = selectable.FindSelectableOnRight(); } if (selectable == null) { return(null); } return(selectable.gameObject); }
void ChangeSelectedByArrowKey() { GameObject goselected = eventsystem.currentSelectedGameObject; if (goselected == null) { return; } Selectable selected = goselected.GetComponent <Selectable>(); Selectable nextselectable = null; if (Input.GetKeyDown(KeyCode.DownArrow)) { nextselectable = selected.FindSelectableOnDown(); } else if (Input.GetKeyDown(KeyCode.UpArrow)) { nextselectable = selected.FindSelectableOnUp(); } else if (Input.GetKeyDown(KeyCode.RightArrow)) { nextselectable = selected.FindSelectableOnRight(); } else if (Input.GetKeyDown(KeyCode.LeftArrow)) { nextselectable = selected.FindSelectableOnLeft(); } if (nextselectable) { nextselectable.Select(); } }
public void FocusNext() { EventSystem system; system = EventSystem.current; if (!focus) { return; } Selectable current = focus.GetComponent <Selectable>(); Selectable next = current.FindSelectableOnRight(); if (!next) { next = current.FindSelectableOnDown(); } if (!next) { return; } InputField inputfield = next.GetComponent <InputField>(); if (inputfield != null) { inputfield.OnPointerClick(new PointerEventData(system)); focus = inputfield; } system.SetSelectedGameObject(next.gameObject); }
private void Next() { EventSystem eventSystem = EventSystem.current; Selectable currentSelectable = eventSystem.currentSelectedGameObject.GetComponent <Selectable>(); if (currentSelectable == null) { return; } Selectable nextSelectable = currentSelectable.FindSelectableOnRight(); if (nextSelectable == null) { nextSelectable = currentSelectable.FindSelectableOnDown(); if (nextSelectable == null) { return; } } InputField inputfield = nextSelectable.GetComponent <InputField>(); if (inputfield != null) { inputfield.OnPointerClick(new PointerEventData(eventSystem)); } eventSystem.SetSelectedGameObject(nextSelectable.gameObject, new BaseEventData(eventSystem)); }
public void OnSelect(BaseEventData evData) { // Don't apply skipping unless we are not interactable. if (m_Selectable.interactable) { return; } // Check if the user navigated to this selectable. if (player1.GetAxis("Menu Horizontal") < 0 || gamePadController2.GetAxis("Menu Horizontal") < 0) { Selectable select = m_Selectable.FindSelectableOnLeft(); if (select == null || !select.gameObject.activeInHierarchy) { select = m_Selectable.FindSelectableOnRight(); } StartCoroutine(DelaySelect(select)); } else if (player1.GetAxis("Menu Horizontal") > 0 || gamePadController2.GetAxis("Menu Horizontal") > 0) { Selectable select = m_Selectable.FindSelectableOnRight(); if (select == null || !select.gameObject.activeInHierarchy) { select = m_Selectable.FindSelectableOnLeft(); } StartCoroutine(DelaySelect(select)); } else if (player1.GetAxis("Menu Vertical") < 0 || gamePadController2.GetAxis("Menu Vertical") < 0) { Selectable select = m_Selectable.FindSelectableOnDown(); if (select == null || !select.gameObject.activeInHierarchy) { select = m_Selectable.FindSelectableOnUp(); } StartCoroutine(DelaySelect(select)); } else if (player1.GetAxis("Menu Vertical") > 0 || gamePadController2.GetAxis("Menu Vertical") > 0) { Selectable select = m_Selectable.FindSelectableOnUp(); if (select == null || !select.gameObject.activeInHierarchy) { select = m_Selectable.FindSelectableOnDown(); } StartCoroutine(DelaySelect(select)); } }
public void FindSelectableOnRight_ReturnsNextSelectableRightOfTarget() { Selectable selectableRightOfTopLeft = topLeftSelectable.FindSelectableOnRight(); Selectable selectableRightOfBottomLeft = bottomLeftSelectable.FindSelectableOnRight(); Assert.AreEqual(topRightSelectable, selectableRightOfTopLeft, "Wrong selectable to right of Top Left Selectable"); Assert.AreEqual(bottomRightSelectable, selectableRightOfBottomLeft, "Wrong selectable to right of Bottom Left Selectable"); }
static int FindSelectableOnRight(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); Selectable obj = LuaScriptMgr.GetUnityObject <Selectable>(L, 1); Selectable o = obj.FindSelectableOnRight(); LuaScriptMgr.Push(L, o); return(1); }
void Update() { if (Input.GetKeyDown(KeyCode.Tab)) { if (EventSystem.current != null) { GameObject selected = EventSystem.current.currentSelectedGameObject; //try and find the first selectable if there isn't one currently selected //only do it if the findFirstSelectable is true //you may not always want this feature and thus //it is disabled by default if (selected == null && findFirstSelectable) { Selectable found = (Selectable.allSelectables.Count > 0) ? Selectable.allSelectables[0] : null; if (found != null) { //simple reference so that selected isn't null and will proceed //past the next if statement selected = found.gameObject; } } if (selected != null) { Selectable current = (Selectable)selected.GetComponent("Selectable"); if (current != null) { Selectable nextDown = current.FindSelectableOnDown(); Selectable nextUp = current.FindSelectableOnUp(); Selectable nextRight = current.FindSelectableOnRight(); Selectable nextLeft = current.FindSelectableOnLeft(); if (nextDown != null) { nextDown.Select(); } else if (nextRight != null) { nextRight.Select(); } else if (nextUp != null) { nextUp.Select(); } else if (nextLeft != null) { nextLeft.Select(); } } } } } }
public void Update() { if (Input.GetKeyDown(KeyCode.Tab)) { if (EventSystem.current != null) { GameObject selected = EventSystem.current.currentSelectedGameObject; if (selected == null && findFirstSelectable) { Selectable found = (Selectable.allSelectables.Count > 0) ? Selectable.allSelectables[0] : null; if (found != null) { selected = found.gameObject; } } if (selected != null) { Selectable current = (Selectable)selected.GetComponent("Selectable"); if (current != null) { Selectable nextDown = current.FindSelectableOnDown(); Selectable nextUp = current.FindSelectableOnUp(); Selectable nextRight = current.FindSelectableOnRight(); Selectable nextLeft = current.FindSelectableOnLeft(); if (nextDown != null) { nextDown.Select(); } else if (nextRight != null) { nextRight.Select(); } else if (nextUp != null) { nextUp.Select(); } else if (nextLeft != null) { nextLeft.Select(); } } } } } if (Input.GetKeyDown(KeyCode.Return)) { CallLogin(); } }
// Allows quitting by pressing ESC. void Update() { //The following code was taken from http://answers.unity3d.com/questions/784526/46-ugui-select-next-inputfield-with-entertab.html //and exists solely to allow tabbing between input fields on the title screen. Whew! if (InputWrapper.GetKeyDown(KeyCode.Tab)) { Selectable next = null; Selectable current = null; EventSystem eventSystem = EventSystem.current; // Figure out if we have a valid current selected gameobject if (eventSystem.currentSelectedGameObject != null) { // Unity doesn't seem to "deselect" an object that is made inactive if (eventSystem.currentSelectedGameObject.activeInHierarchy) { current = eventSystem.currentSelectedGameObject.GetComponent <Selectable>(); } } if (current != null) { // When SHIFT is held along with tab, go backwards instead of forwards if (InputWrapper.GetKey(KeyCode.LeftShift) || InputWrapper.GetKey(KeyCode.RightShift)) { next = current.FindSelectableOnLeft(); if (next == null) { next = current.FindSelectableOnUp(); } } else { next = current.FindSelectableOnRight(); if (next == null) { next = current.FindSelectableOnDown(); } } } else { // If there is no current selected gameobject, select the first one if (Selectable.allSelectables.Count > 0) { next = Selectable.allSelectables[0]; } } if (next != null) { next.Select(); } } }
// Update is called once per frame void Update() { #region Use tab to navigate beetwen fields if (Input.GetKeyDown(KeyCode.Tab)) { Selectable next = null; Selectable current = null; // Figure out if we have a valid current selected gameobject if (eventSystem.currentSelectedGameObject != null) { // Unity doesn't seem to "deselect" an object that is made inactive if (eventSystem.currentSelectedGameObject.activeInHierarchy) { current = eventSystem.currentSelectedGameObject.GetComponent <Selectable>(); } } if (current != null) { // When SHIFT is held along with tab, go backwards instead of forwards if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { next = current.FindSelectableOnLeft(); if (next == null) { next = current.FindSelectableOnUp(); } } else { next = current.FindSelectableOnRight(); if (next == null) { next = current.FindSelectableOnDown(); } } } else { // If there is no current selected gameobject, select the first one if (Selectable.allSelectables.Count > 0) { next = Selectable.allSelectables[0]; } } if (next != null) { next.Select(); } } #endregion }
Selectable Next(Selectable current) { switch (Direction) { case DirectionEnum.UpDown: return(current.FindSelectableOnDown()); case DirectionEnum.LeftRight: return(current.FindSelectableOnRight()); } return(current.FindSelectableOnDown()); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Tab)) { Selectable next = null; Selectable current = null; // current 갱신 (현재 선택되어있는 오브젝트가 active상태면 current로) if (eventSystem.currentSelectedGameObject != null) { if (eventSystem.currentSelectedGameObject.activeInHierarchy) { current = eventSystem.currentSelectedGameObject.GetComponent <Selectable>(); } } // current가 존재하면 next를 찾음 if (current != null) { // shift 누르고 있으면 (shift + tab 이면) 뒤로 if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { next = current.FindSelectableOnUp(); if (next == null) { next = current.FindSelectableOnLeft(); } } else { next = current.FindSelectableOnDown(); if (next == null) { next = current.FindSelectableOnRight(); } } } // current가 null이면 선택가능한 전체에서 1번째를 잡음 else { if (Selectable.allSelectables.Count > 0) { next = Selectable.allSelectables[0]; } } // next가 존재하면 선택(포커스) if (next != null) { next.Select(); } } }
/// <summary> /// /// </summary> private void HandleHotkeySelect(int direction, bool isWrapAround) { GameObject selectedObject = eventSystem.currentSelectedGameObject; if (selectedObject == null || !selectedObject.activeInHierarchy) // Ensure a selection exists and is not an inactive object. { this.SelectFirstSelectable(); return; } Selectable currentSelection = selectedObject.GetComponent <Selectable>(); if (currentSelection == null) { this.SelectFirstSelectable(); return; } Selectable nextSelection = null; if (selectableType == SelectableType.Explicit) { nextSelection = this.FindNextSelectable(selectables.IndexOf(currentSelection), direction, isWrapAround, currentSelection); } else if (selectableType == SelectableType.Automatic) { switch (direction) { case 0: nextSelection = currentSelection.FindSelectableOnDown(); break; case 1: nextSelection = currentSelection.FindSelectableOnUp(); break; case 2: nextSelection = currentSelection.FindSelectableOnLeft(); break; case 3: nextSelection = currentSelection.FindSelectableOnRight(); break; } } else if (selectableType == SelectableType.Mixed) { nextSelection = this.FindNextSelectable(selectables.IndexOf(currentSelection), direction, isWrapAround, currentSelection); } if (nextSelection != null) { nextSelection.Select(); } }
private static void DrawNavigationForSelectable(Selectable sel) { if (!(sel == null)) { Transform transform = sel.transform; bool flag = Selection.transforms.Any((Transform e) => e == transform); Handles.color = new Color(1f, 0.9f, 0.1f, (!flag) ? 0.4f : 1f); SelectableEditor.DrawNavigationArrow(-Vector2.right, sel, sel.FindSelectableOnLeft()); SelectableEditor.DrawNavigationArrow(Vector2.right, sel, sel.FindSelectableOnRight()); SelectableEditor.DrawNavigationArrow(Vector2.up, sel, sel.FindSelectableOnUp()); SelectableEditor.DrawNavigationArrow(-Vector2.up, sel, sel.FindSelectableOnDown()); } }
private Selectable findNextSelectable(Selectable currentSelectable, bool isNavigateBackward) { Selectable selectable = null; if (currentSelectable != null) { selectable = ((!isNavigateBackward) ? (currentSelectable.FindSelectableOnRight() ?? currentSelectable.FindSelectableOnDown()) : (currentSelectable.FindSelectableOnLeft() ?? currentSelectable.FindSelectableOnUp())); } if (selectable != null && !selectable.isActiveAndEnabled) { selectable = findNextSelectable(selectable, isNavigateBackward); } return(selectable); }
void Update() { if (Input.GetKeyDown(KeyCode.Tab)) { if (EventSystem.current != null) { GameObject selected = EventSystem.current.currentSelectedGameObject; if (selected == null) { Selectable found = (Selectable.allSelectablesArray.Length > 0) ? Selectable.allSelectablesArray[0] : null; if (found != null) { //simple reference so that selected isn't null and will proceed //past the next if statement selected = found.gameObject; } } if (selected != null) { Selectable current = (Selectable)selected.GetComponent("Selectable"); if (current != null) { Selectable nextDown = current.FindSelectableOnDown(); Selectable nextUp = current.FindSelectableOnUp(); Selectable nextRight = current.FindSelectableOnRight(); Selectable nextLeft = current.FindSelectableOnLeft(); if (nextDown != null) { nextDown.Select(); } else if (nextRight != null) { nextRight.Select(); } else if (nextUp != null) { nextUp.Select(); } else if (nextLeft != null) { nextLeft.Select(); } } } } } }
void Update() { if (Input.GetKeyDown(KeyCode.Tab)) { Selectable next = null; Selectable current = null; if (eventSys.currentSelectedGameObject != null) { if (eventSys.currentSelectedGameObject.activeInHierarchy) { current = eventSys.currentSelectedGameObject.GetComponent <Selectable>(); } } if (current != null) { if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { next = current.FindSelectableOnLeft(); if (next == null) { next = current.FindSelectableOnUp(); } } else { next = current.FindSelectableOnRight(); if (next == null) { next = current.FindSelectableOnDown(); } } } else { if (Selectable.allSelectables.Count > 0) { next = Selectable.allSelectables[0]; } } if (next != null) { next.Select(); } } }
private static void DrawNavigationForSelectable(Selectable sel) { if (sel == null) { return; } Transform transform = sel.transform; bool active = Selection.transforms.Any(e => e == transform); Handles.color = new Color(1.0f, 0.9f, 0.1f, active ? 1.0f : 0.4f); DrawNavigationArrow(-Vector2.right, sel, sel.FindSelectableOnLeft()); DrawNavigationArrow(Vector2.right, sel, sel.FindSelectableOnRight()); DrawNavigationArrow(Vector2.up, sel, sel.FindSelectableOnUp()); DrawNavigationArrow(-Vector2.up, sel, sel.FindSelectableOnDown()); }
void Update() { navTimer -= Time.deltaTime; EventSystem cur = EventSystem.current; GameObject curSelectedGameObject = cur.currentSelectedGameObject; if (curSelectedGameObject == null) { curSelectedGameObject = cur.firstSelectedGameObject; cur.SetSelectedGameObject(curSelectedGameObject); } if (ControllerManager.instance.GetButtonDown(ControllerInputWrapper.Buttons.A, PlayerID.One)) { ExecuteEvents.Execute(curSelectedGameObject, new PointerEventData(cur), ExecuteEvents.submitHandler); } if ((ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadX, PlayerID.One) > ControllerManager.CUSTOM_DEADZONE || ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickX, PlayerID.One) > ControllerManager.CUSTOM_DEADZONE) && navTimer < 0) { SFXManager.instance.source.PlayOneShot(SFXManager.instance.menuClick); navTimer = 0.3f; Selectable sel = curSelectedGameObject.GetComponent <Selectable>(); Selectable right = sel.FindSelectableOnRight(); if (right) { cur.SetSelectedGameObject(right.gameObject); } } else if ((ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadX, PlayerID.One) < -ControllerManager.CUSTOM_DEADZONE || ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickX, PlayerID.One) < -ControllerManager.CUSTOM_DEADZONE) && navTimer < 0) { SFXManager.instance.source.PlayOneShot(SFXManager.instance.menuClick); navTimer = 0.3f; Selectable sel = curSelectedGameObject.GetComponent <Selectable>(); Selectable left = sel.FindSelectableOnLeft(); if (left) { cur.SetSelectedGameObject(left.gameObject); } } else if (ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.DPadX, PlayerID.One) == 0f && ControllerManager.instance.GetAxis(ControllerInputWrapper.Axis.LeftStickX, PlayerID.One) == 0f) { navTimer = 0f; } }
private static int FindSelectableOnRight(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 1); Selectable selectable = (Selectable)ToLua.CheckObject(L, 1, typeof(Selectable)); Selectable obj = selectable.FindSelectableOnRight(); ToLua.Push(L, obj); result = 1; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
public static int FindSelectableOnRight(IntPtr l) { int result; try { Selectable selectable = (Selectable)LuaObject.checkSelf(l); Selectable o = selectable.FindSelectableOnRight(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
private static void DrawNavigationForSelectable(Selectable sel) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type SelectableEditor.\u003CDrawNavigationForSelectable\u003Ec__AnonStorey1 selectableCAnonStorey1 = new SelectableEditor.\u003CDrawNavigationForSelectable\u003Ec__AnonStorey1(); if ((UnityEngine.Object)sel == (UnityEngine.Object)null) { return; } // ISSUE: reference to a compiler-generated field selectableCAnonStorey1.transform = sel.transform; // ISSUE: reference to a compiler-generated method Handles.color = new Color(1f, 0.9f, 0.1f, !((IEnumerable <Transform>)Selection.transforms).Any <Transform>(new Func <Transform, bool>(selectableCAnonStorey1.\u003C\u003Em__0)) ? 0.4f : 1f); SelectableEditor.DrawNavigationArrow(-Vector2.right, sel, sel.FindSelectableOnLeft()); SelectableEditor.DrawNavigationArrow(Vector2.right, sel, sel.FindSelectableOnRight()); SelectableEditor.DrawNavigationArrow(Vector2.up, sel, sel.FindSelectableOnUp()); SelectableEditor.DrawNavigationArrow(-Vector2.up, sel, sel.FindSelectableOnDown()); }
private void UpdateTabInput() { if (tabActive && Input.GetKeyDown(KeyCode.Tab)) { bool goingBackwards = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift); if (!goingBackwards) { Selectable tmp; if (forwardPriority == NavPriority.Down) { if ((tmp = curSelected.FindSelectableOnDown()) != null || (tmp = curSelected.FindSelectableOnRight()) != null) { curSelected = tmp; } } else if (forwardPriority == NavPriority.Right) { if ((tmp = curSelected.FindSelectableOnRight()) != null || (tmp = curSelected.FindSelectableOnDown()) != null) { curSelected = tmp; } } } else { Selectable tmp; if (forwardPriority == NavPriority.Down) { if ((tmp = curSelected.FindSelectableOnUp()) != null || (tmp = curSelected.FindSelectableOnLeft()) != null) { curSelected = tmp; } } else if (forwardPriority == NavPriority.Right) { if ((tmp = curSelected.FindSelectableOnLeft()) != null || (tmp = curSelected.FindSelectableOnUp()) != null) { curSelected = tmp; } } } curSelected.Select(); } }