示例#1
0
    private void Navigate(CustomInput.UserInput direction)
    {
        if (EventSystem.current.currentSelectedGameObject == this.gameObject)
        {
            switch (direction)
            {
            case CustomInput.UserInput.Left:
                slider.value -= .01f;
                break;

            case CustomInput.UserInput.Right:
                slider.value += .01f;
                break;
            }
        }

        if (isSfx)
        {
            GameManager.SFXVol = slider.value;
        }
        else
        {
            GameManager.MusicVol = slider.value;
        }
    }
示例#2
0
        private void Navigate(CustomInput.UserInput direction)
        {
            GameObject next = EventSystem.current.currentSelectedGameObject;

            if (next == null)
            {
                if (deck.GetDeck.Count > 0)
                {
                    Transition(0);
                    EventSystem.current.SetSelectedGameObject(selectionButtons[0].gameObject);
                }
                else
                {
                    EventSystem.current.SetSelectedGameObject(okayButton.gameObject);
                }
                return;
            }

            bool nextIsValid = false;

            while (!nextIsValid)
            {
                switch (direction)
                {
                case CustomInput.UserInput.Up:
                    next = EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnUp().gameObject;
                    break;

                case CustomInput.UserInput.Down:
                    next = EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnDown().gameObject;
                    break;

                case CustomInput.UserInput.Left:
                    next = EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnLeft().gameObject;
                    break;

                case CustomInput.UserInput.Right:
                    next = EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnRight().gameObject;
                    break;
                }
                EventSystem.current.SetSelectedGameObject(next);
                nextIsValid = next.GetComponent <Selectable>().interactable;
            }
        }
示例#3
0
    private void Navigate(CustomInput.UserInput direction)
    {
        if (EventSystem.current.currentSelectedGameObject == this.gameObject)
        {
            switch (direction)
            {
            case CustomInput.UserInput.Left:
                slider.value -= 1;
                break;

            case CustomInput.UserInput.Right:
                slider.value += 1;
                break;
            }
            if (sp)
            {
                sp.SetVolume(slider.value);
            }
        }
    }
示例#4
0
    private void Navigate(CustomInput.UserInput direction)
    {
        GameObject next = EventSystem.current.currentSelectedGameObject;

        switch (direction)
        {
        case CustomInput.UserInput.Up:
            next = EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnUp().gameObject;
            break;

        case CustomInput.UserInput.Down:
            next = EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnDown().gameObject;
            break;

        case CustomInput.UserInput.Left:
            next = EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnLeft().gameObject;
            break;

        case CustomInput.UserInput.Right:
            next = EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnRight().gameObject;
            break;
        }
        EventSystem.current.SetSelectedGameObject(next);
    }
示例#5
0
        public static void Navigate(CustomInput.UserInput direction, GameObject defaultGameObject)
        {
            GameObject next = EventSystem.current.currentSelectedGameObject;

            if (next == null)
            {
                if (defaultGameObject != null)
                {
                    EventSystem.current.SetSelectedGameObject(defaultGameObject);
                }
                return;
            }

            bool nextIsValid = false;

            while (!nextIsValid)
            {
                switch (direction)
                {
                case CustomInput.UserInput.Up:
                    if (EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnUp() != null)
                    {
                        next = EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnUp().gameObject;
                    }
                    else
                    {
                        next = null;
                    }
                    break;

                case CustomInput.UserInput.Down:
                    if (EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnDown() != null)
                    {
                        next = EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnDown().gameObject;
                    }
                    else
                    {
                        next = null;
                    }
                    break;

                case CustomInput.UserInput.Left:
                    if (EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnLeft() != null)
                    {
                        next = EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnLeft().gameObject;
                    }
                    else
                    {
                        next = null;
                    }
                    break;

                case CustomInput.UserInput.Right:
                    if (EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnRight() != null)
                    {
                        next = EventSystem.current.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnRight().gameObject;
                    }
                    else
                    {
                        next = null;
                    }
                    break;
                }
                if (next != null && next.activeSelf)
                {
                    EventSystem.current.SetSelectedGameObject(next);
                    nextIsValid = next.GetComponent <Selectable>().interactable;
                }
                else
                {
                    nextIsValid = true;
                }
            }
        }