Exemplo n.º 1
0
    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");
        }
    }
Exemplo n.º 2
0
 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();
         }
     }
 }
Exemplo n.º 3
0
    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();
                    }
                }
            }
        }
    }
Exemplo n.º 4
0
 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];
         }
     }
 }
Exemplo n.º 5
0
 /// <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());
     }
 }
Exemplo n.º 6
0
    private GameObject GetNearestOnLeft(GameObject i_Source)
    {
        if (i_Source == null)
        {
            return(null);
        }

        Selectable sourceSelectable = i_Source.GetComponent <Selectable>();

        if (sourceSelectable == null)
        {
            return(null);
        }

        Selectable selectable = sourceSelectable.FindSelectableOnLeft();

        while (selectable != null && !IsAvailable(selectable.gameObject))
        {
            selectable = selectable.FindSelectableOnLeft();
        }

        if (selectable == null)
        {
            return(null);
        }

        return(selectable.gameObject);
    }
Exemplo n.º 7
0
    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();
        }
    }
Exemplo n.º 8
0
    public void FocusPrevious()
    {
        EventSystem system;

        system = EventSystem.current;

        if (!focus)
        {
            return;
        }

        Selectable current = focus.GetComponent <Selectable>();
        Selectable next    = current.FindSelectableOnLeft();

        if (!next)
        {
            next = current.FindSelectableOnUp();
        }
        if (!next)
        {
            return;
        }
        InputField inputfield = next.GetComponent <InputField>();

        if (inputfield != null)
        {
            inputfield.OnPointerClick(new PointerEventData(system));
            focus = inputfield;
        }
        system.SetSelectedGameObject(next.gameObject);
    }
Exemplo n.º 9
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);
    }
    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));
        }
    }
Exemplo n.º 11
0
        public void FindSelectableOnLeft_ReturnsNextSelectableLeftOfTarget()
        {
            Selectable selectableLeftOfTopRight    = topRightSelectable.FindSelectableOnLeft();
            Selectable selectableLeftOfBottomRight = bottomRightSelectable.FindSelectableOnLeft();

            Assert.AreEqual(topLeftSelectable, selectableLeftOfTopRight, "Wrong selectable to left of Top Right Selectable");
            Assert.AreEqual(bottomLeftSelectable, selectableLeftOfBottomRight, "Wrong selectable to left of Bottom Right Selectable");
        }
Exemplo n.º 12
0
    static int FindSelectableOnLeft(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        Selectable obj = LuaScriptMgr.GetUnityObject <Selectable>(L, 1);
        Selectable o   = obj.FindSelectableOnLeft();

        LuaScriptMgr.Push(L, o);
        return(1);
    }
Exemplo n.º 13
0
    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();
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 14
0
        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();
            }
        }
Exemplo n.º 15
0
        // 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
        }
Exemplo n.º 16
0
    // 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();
            }
        }
    }
    Selectable Previous(Selectable current)
    {
        switch (Direction)
        {
        case DirectionEnum.UpDown:
            return(current.FindSelectableOnUp());

        case DirectionEnum.LeftRight:
            return(current.FindSelectableOnLeft());
        }
        return(current.FindSelectableOnUp());
    }
Exemplo n.º 18
0
        /// <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();
            }
        }
Exemplo n.º 19
0
 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());
     }
 }
Exemplo n.º 20
0
    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();
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 21
0
    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());
    }
Exemplo n.º 23
0
    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;
        }
    }
Exemplo n.º 24
0
    protected GameObject FindRecurseLeft(Selectable selectable)
    {
        var left = selectable.FindSelectableOnLeft();

        if ((UnityEngine.Object)left != (UnityEngine.Object)null)
        {
            if (!left.IsActive())
            {
                return(FindRecurseLeft(left));
            }
            else
            {
                return(left.gameObject);
            }
        }

        return(null);
    }
    private static int FindSelectableOnLeft(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            Selectable selectable = (Selectable)ToLua.CheckObject(L, 1, typeof(Selectable));
            Selectable obj        = selectable.FindSelectableOnLeft();
            ToLua.Push(L, obj);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
    public static int FindSelectableOnLeft(IntPtr l)
    {
        int result;

        try
        {
            Selectable selectable = (Selectable)LuaObject.checkSelf(l);
            Selectable o          = selectable.FindSelectableOnLeft();
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemplo n.º 27
0
 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());
 }
Exemplo n.º 28
0
 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();
     }
 }