Example #1
0
        void Start()
        {
            slider            = GetComponent <Slider>();
            cachedSourceValue = source.GetValue(sourceTag);
            cachedSliderValue = slider.value;

            if (cachedSourceValue != null)
            {
                slider.value = (float)cachedSourceValue;
            }
        }
Example #2
0
        void Update()
        {
            object val = source.GetValue(sourceTag);

            if (val != null && Convert.ToString(cachedSourceValue) != Convert.ToString(val))
            {
                cachedSourceValue = val;
                if (string.IsNullOrEmpty(format))
                {
                    field.text = Convert.ToString(val);
                }
                else
                {
                    field.text = string.Format(format, val);
                }
            }
            else if (field.text != cachedTextValue)
            {
                cachedTextValue = field.text;
                try {
                    source.SetValue(sourceTag, field.text);
                } catch (Exception e) {
                    Debug.Log("Failed to set data binding value from InputField");
                    Debug.Log(e);
                }
            }
        }
Example #3
0
        // Update is called once per frame
        void Update()
        {
            object val = source.GetValue(sourceTag);

            if (slider.value != cachedSliderValue)
            {
                cachedSliderValue = slider.value;
                source.SetValue(sourceTag, slider.value);
            }
            else if (val != null && Convert.ToSingle(val) != Convert.ToSingle(cachedSourceValue))
            {
                cachedSourceValue = val;
                slider.value      = (float)cachedSourceValue;
            }
        }
Example #4
0
        // Update is called once per frame
        void Update()
        {
            object val = source.GetValue(sourceTag);

            if (val != null && Convert.ToString(cachedSourceValue) != Convert.ToString(val))
            {
                cachedSourceValue = val;
                if (string.IsNullOrEmpty(format))
                {
                    text.text = Convert.ToString(val);
                }
                else
                {
                    text.text = string.Format(format, val);
                }
            }
            //else if (text.text != cachedTextValue) {
            //    cachedTextValue = text.text;
            //    source.SetValue(sourceTag, text.text);
            //}
        }