Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #4
0
        public static InputField FindInputAndAddValueChangedHandler(string inputName, UnityAction <string> handler)
        {
            var field = UnityUtil.FindGameObjectByName(inputName).GetComponent <InputField>();

            field.onValueChanged.AddListener(handler);
            return(field);
        }
Пример #5
0
        public static Text FindTextAndSet(string textName, string newText)
        {
            var text = UnityUtil.FindGameObjectByName(textName).GetComponent <Text>();

            text.text = newText;
            return(text);
        }
Пример #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);
        }
Пример #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);
        }
Пример #8
0
        public static InputField FindInput(string inputName)
        {
            var field = UnityUtil.FindGameObjectByName(inputName).GetComponent <InputField>();

            return(field);
        }