Пример #1
0
        public void AddProperty(Property <T> property, BindingDirection direction)
        {
            BindingsCleaner.Check();
            if (property.GetType() != typeof(LabelProperty))
            {
//								Debug.Log (_type + "," + property.GetPropertyType ());
                if (_type == property.GetPropertyType())
                {
                    if (direction == BindingDirection.BiDirectional || direction == BindingDirection.PropertyToBinding)
                    {
//												property.AddBinding (this);
                        property.AddListener(OnNewValue);
//												Debug.Log ("Bound ");
                    }

                    if (direction == BindingDirection.BiDirectional || direction == BindingDirection.BindingToProperty)
                    {
                        if (!propertyListeners.Contains(property))
                        {
                            propertyListeners.Add(property);
                        }
                    }
                }
            }
        }
Пример #2
0
        public Binding(T value = default(T), string discoverableName = null)
        {
            BindingsCleaner.Add(CleanupBinding);
            _value        = value;
            _type         = typeof(T);
            _name         = discoverableName;
            labelProperty = new BindingLabelProperty(value as System.Object);

            if (_name != null)
            {
                BindingLabelUtils.AddLabelBinding(_name, labelProperty);
                if (!bindingsDictionary.ContainsKey(_name))
                {
                    bindingsDictionary.Add(_name, this);
                }
                else
                {
                    Debug.LogWarning("Key {0} is already in use, assigning variable _name with null value and not adding it to bindingsDictionary");
                    _name = null;
                }
            }
        }
Пример #3
0
 protected Property()
 {
     BindingsCleaner.Add(CleanupProperty);
 }
Пример #4
0
 public Property(T value)
 {
     BindingsCleaner.Add(CleanupProperty);
     _value = value;
     _type  = typeof(T);
 }