Пример #1
0
        public void Touch(string label, TryProcess process, bool create_undo_state)
        {
            if (target_type.CanBeTreatedAs <UnityEngine.Object>())
            {
                if (create_undo_state)
                {
                    Undo.RecordObjects(
                        objects.Convert <UnityEngine.Object>().ToArray(),
                        label
                        );
                }

                if (process())
                {
                    objects
                    .Convert <IEditSerializationCallbackReciever>()
                    .Process(r => r.OnBeforeEditSerialize());

                    objects
                    .Convert <ISerializationCallbackReceiver>()
                    .Process(r => r.OnBeforeSerialize());

                    objects
                    .Convert <UnityEngine.Object>()
                    .Narrow(o => o.IsPrefabInstance())
                    .Process(o => PrefabUtility.RecordPrefabInstancePropertyModifications(o));

                    objects
                    .Convert <UnityEngine.Object>()
                    .Skip(o => o.IsSceneObject())
                    .Process(o => EditorUtility.SetDirty(o));
                }

                if (create_undo_state)
                {
                    Undo.FlushUndoRecordObjects();
                }
            }
            else
            {
                if (parent != null)
                {
                    parent.Touch(label, process, create_undo_state);
                }
                else
                {
                    process();
                }
            }
        }
Пример #2
0
 public void Execute()
 {
     target.Touch(GetName(), delegate() {
         target.GetObjects().Process(o => action.Execute(o));
     }, true);
 }
Пример #3
0
 public void Execute(object gadget_target, string name)
 {
     target.Touch(name, delegate() {
         aux_actions.GetValue(name).IfNotNull(a => a.Execute(gadget_target));
     }, true);
 }
Пример #4
0
 public void Execute()
 {
     target.Touch(GetName(), delegate() {
         target.GetObjects().Process(o => function.Execute(o, arguments.GetContents <object[]>()));
     }, true);
 }
Пример #5
0
 public void ClearContents(bool create_undo_state)
 {
     target.Touch("Clearing " + GetName(), delegate() {
         return(GetVariables().ProcessOR(v => v.ClearContents().IsChange()));
     }, create_undo_state);
 }