Exemplo n.º 1
0
        public static Button FindButtonAndAddToggleBehavior(string buttonName, Func <bool> getValue, Action <bool> setValue, Action <bool, Button> updateF)
        {
            var button = UnityUtil.FindGameObjectByName(buttonName).GetComponent <Button>();

            AddToggleBehavior(button, getValue, setValue, updateF);
            return(button);
        }
Exemplo n.º 2
0
        public static Dropdown FindDropDownAndAddHandlers(string inputName, Func <int> getValue, Action <int> setValue, int minValue, int maxValue)
        {
            var dropdown = UnityUtil.FindGameObjectByName(inputName).GetComponent <Dropdown>();

            DropDownAddHandlers(dropdown, getValue, setValue, minValue, maxValue);
            return(dropdown);
        }
Exemplo n.º 3
0
        public static InputField FindInputAndAddFloatHandlers(string inputName, Func <float> getValue, Action <float> setValue, float minValue, float maxValue)
        {
            var field = UnityUtil.FindGameObjectByName(inputName).GetComponent <InputField>();

            AddFloatHandlers(field, getValue, setValue, minValue, maxValue);
            return(field);
        }
Exemplo n.º 4
0
        public static InputField FindInputAndAddValueChangedHandler(string inputName, UnityAction <string> handler)
        {
            var field = UnityUtil.FindGameObjectByName(inputName).GetComponent <InputField>();

            field.onValueChanged.AddListener(handler);
            return(field);
        }
Exemplo n.º 5
0
        public static Text FindTextAndSet(string textName, string newText)
        {
            var text = UnityUtil.FindGameObjectByName(textName).GetComponent <Text>();

            text.text = newText;
            return(text);
        }
Exemplo n.º 6
0
        public static Toggle FindToggleAndConnectToSource(string toggleName, Func <bool> getValue, Action <bool> setValue)
        {
            var toggle = UnityUtil.FindGameObjectByName(toggleName).GetComponent <Toggle>();

            ToggleConnectToSource(toggle, getValue, setValue);
            return(toggle);
        }
Exemplo n.º 7
0
        public static Button FindButtonAndAddClickHandler(string buttonName, UnityAction handler)
        {
            var button = UnityUtil.FindGameObjectByName(buttonName).GetComponent <Button>();

            if (handler != null)
            {
                button.onClick.AddListener(handler);
            }
            return(button);
        }
Exemplo n.º 8
0
        public static InputField FindInput(string inputName)
        {
            var field = UnityUtil.FindGameObjectByName(inputName).GetComponent <InputField>();

            return(field);
        }