public override object GetValue()
        {
            ManagedProperty obj = this.p;

            if (obj == null)
            {
                return(null);
            }
            return(obj.Value);
        }
        protected virtual void Start()
        {
            ManagedProperty property = PropertiesManager.GetProperty(this.sourceTargetName);

            this.getter = ((property != null) ? property.getter : null);
            PropertiesManager.AddValueChangeListener(this.sourceTargetName, this.OnValueChanged);
            if (this.getter != null)
            {
                this.getter.UpdateValue();
                this.OnValueChanged();
            }
        }
 public static void RemoveValueChangeListener(string propertyName, Action callback)
 {
     if (PropertiesManager.cachedProperties != null && !((UnityEngine.Object)PropertiesManager.manager == (UnityEngine.Object)null))
     {
         ManagedProperty managedProperty = null;
         if (PropertiesManager.cachedProperties.TryGetValue(propertyName, out managedProperty))
         {
             managedProperty.RemoveValueChangeListener(callback);
         }
         else
         {
             Debug.LogError("[PropertiesManager] Property not defined: " + propertyName);
         }
     }
 }
 public static void AddValueChangeListener(string propertyName, Action callback)
 {
     if (PropertiesManager.cachedProperties != null)
     {
         ManagedProperty managedProperty = null;
         if (PropertiesManager.cachedProperties.TryGetValue(propertyName, out managedProperty))
         {
             managedProperty.Initialize();
             managedProperty.AddValueChangeListener(callback);
         }
         else
         {
             Debug.LogError("[PropertiesManager] Property not defined: " + propertyName);
         }
     }
 }
        /// <summary> Returns reference to a ManagedProperty. This reference should not be used to write values to the property if the value must be persisted. Rather use PropertiesManager.SetValue() </summary>
        public static ManagedProperty GetProperty(string name)
        {
            if (PropertiesManager.cachedProperties == null)
            {
                Debug.LogError("PropertiesManager not ready for use.");
                return(null);
            }
            ManagedProperty managedProperty = null;

            if (PropertiesManager.cachedProperties.TryGetValue(name, out managedProperty))
            {
                managedProperty.Initialize();
                return(managedProperty);
            }
            Debug.LogError("[PropertiesManager.GetProperty] Property not defined: " + name);
            return(null);
        }
 public override void Initialize(Component owner)
 {
     base.Initialize(owner);
     if (base.isSetter)
     {
         base.RegisterBind(this.valSetterSource.databind);
     }
     else
     {
         base.RegisterBindWithCallbacks(this.valSetterSource.databind);
     }
     if (!base.isSetter)
     {
         this.p = PropertiesManager.GetProperty(this.propertyName);
         ManagedProperty obj = this.p;
         if (obj != null)
         {
             obj.AddValueChangeListener(this.OnPropertyValueChange);
         }
     }
 }
 public static void SetValue(string name, object value)
 {
     if (PropertiesManager.cachedProperties == null)
     {
         Debug.LogError("PropertiesManager not ready for use.");
     }
     else
     {
         ManagedProperty managedProperty = null;
         if (PropertiesManager.cachedProperties.TryGetValue(name, out managedProperty))
         {
             if (managedProperty.setter == null)
             {
                 Debug.LogError("[PropertiesManager.SetValue] Property does not have a setter bind: " + name);
             }
             else
             {
                 managedProperty.Initialize();
                 managedProperty.setter.Execute(value);
                 if (managedProperty.runDuringBoot)
                 {
                     string value2 = BloxStringSerializer.Serialize(value);
                     if (string.IsNullOrEmpty(value2))
                     {
                         PlayerPrefs.DeleteKey("PropertiesManager." + name);
                     }
                     else
                     {
                         PlayerPrefs.SetString("PropertiesManager." + name, value2);
                     }
                 }
             }
         }
         else
         {
             Debug.LogError("[PropertiesManager.SetValue] Property not defined: " + name);
         }
     }
 }
        public static object GetValue(string name)
        {
            if (PropertiesManager.cachedProperties == null)
            {
                Debug.LogError("PropertiesManager not ready for use.");
                return(null);
            }
            ManagedProperty managedProperty = null;

            if (PropertiesManager.cachedProperties.TryGetValue(name, out managedProperty))
            {
                if (managedProperty.getter == null)
                {
                    Debug.LogError("[PropertiesManager.GetValue] Property does not have a getter bind: " + name);
                    return(null);
                }
                managedProperty.Initialize();
                return(managedProperty.getter.GetValue());
            }
            Debug.LogError("[PropertiesManager.GetValue] Property not defined: " + name);
            return(null);
        }