Ejemplo n.º 1
0
        public object GetValue(object component)
        {
            StateSave stateSave = SelectedState.Self.SelectedStateSave;

            if (stateSave != null)
            {
                string name = GetVariableNameConsideringSelection();
                return(stateSave.GetValue(name));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        protected bool DoValuesDiffer(StateSave newStateSave, string variableName, object oldValue)
        {
            var newValue = newStateSave.GetValue(variableName);

            if (newValue == null && oldValue != null)
            {
                return(true);
            }
            if (newValue != null && oldValue == null)
            {
                return(true);
            }
            if (newValue == null && oldValue == null)
            {
                return(false);
            }
            // neither are null
            else
            {
                if (oldValue is float)
                {
                    var oldFloat = (float)oldValue;
                    var newFloat = (float)newValue;

                    return(oldFloat != newFloat);
                }
                else if (oldValue is string)
                {
                    return((string)oldValue != (string)newValue);
                }
                else if (oldValue is bool)
                {
                    return((bool)oldValue != (bool)newValue);
                }
                else if (oldValue is int)
                {
                    return((int)oldValue != (int)newValue);
                }
                else if (oldValue is Vector2)
                {
                    return((Vector2)oldValue != (Vector2)newValue);
                }
                else
                {
                    return(oldValue.Equals(newValue));
                }
            }
        }
        private object HandleCustomGet(object instance)
        {
            if (mPropertyDescriptor != null)
            {
                var toReturn = mPropertyDescriptor.GetValue(instance);

                if (toReturn == null)
                {
                    toReturn = mStateSave.GetValueRecursive(mVariableName);
                }

                return(toReturn);
            }
            else
            {
                return(mStateSave.GetValue(mVariableName));
            }
        }