コード例 #1
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);
                }
            }
        }
コード例 #2
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;
            }
        }