protected override void OnPropertySet(PropertyInfo property, IEnumerable<object> targets)
 {
     base.OnPropertySet(property, targets);
     if (property.IsEquivalent(ReflectionInfo.Property_Pixmap_AnimCols) ||
         property.IsEquivalent(ReflectionInfo.Property_Pixmap_AnimRows) ||
         property.IsEquivalent(ReflectionInfo.Property_Pixmap_AnimFrameBorder) ||
         property.IsEquivalent(ReflectionInfo.Property_Pixmap_Atlas))
     {
         this.PerformGetValue();
         (this.ParentEditor as PixmapPropertyEditor).UpdatePreview();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Creates a new change list entry.
        /// </summary>
        /// <param name="target">The target object in which the change has been made. Must be a GameObject or Component.</param>
        /// <param name="prop">The target objects <see cref="System.Reflection.PropertyInfo">Property</see> that has been changed.</param>
        /// <param name="value">The value to which the specified Property has been changed to.</param>
        public void PushChange(object target, PropertyInfo prop, object value)
        {
            if (prop.IsEquivalent(ReflectionInfo.Property_GameObject_Parent)) return; // Reject changing "Parent" as it would destroy the PrefabLink
            if (!prop.CanWrite) return;
            if (this.changes == null) this.changes = new List<VarMod>();

            GameObject targetObj = target as GameObject;
            Component targetComp = target as Component;
            if (targetObj == null && targetComp != null) targetObj = targetComp.gameobj;

            if (targetObj == null)
                throw new ArgumentException("Target object is not a valid child of this PrefabLinks GameObject", "target");
            if (value == null && prop.PropertyType.IsValueType)
                throw new ArgumentException("Target field cannot be assigned from null value.", "value");
            if (value != null && !prop.PropertyType.IsInstanceOfType(value))
                throw new ArgumentException("Target field not assignable from Type " + value.GetType().Name + ".", "value");

            VarMod change;
            change.childIndex		= this.obj.IndexPathOfChild(targetObj);
            change.componentType	= (targetComp != null) ? targetComp.GetType() : null;
            change.prop				= prop;
            change.val				= value;

            this.PopChange(change.childIndex, prop, change.componentType);
            this.changes.Add(change);
        }