Esempio n. 1
0
        public void ClearUndo(IUndoableObject obj)
        {
            ScriptableObject scriptableObject = this.CheckUndoObjectType(obj);

            if (scriptableObject != null)
            {
                Undo.ClearUndo(scriptableObject);
            }
        }
Esempio n. 2
0
        public void RegisterCompleteObjectUndo(IUndoableObject obj, string undoText)
        {
            ScriptableObject scriptableObject = this.CheckUndoObjectType(obj);

            if (scriptableObject != null)
            {
                Undo.RegisterCompleteObjectUndo(scriptableObject, undoText);
            }
        }
Esempio n. 3
0
        private ScriptableObject CheckUndoObjectType(IUndoableObject obj)
        {
            ScriptableObject scriptableObject = obj as ScriptableObject;

            if (scriptableObject == null)
            {
                Debug.LogError("Register Undo object is not a ScriptableObject");
            }
            return(scriptableObject);
        }
Esempio n. 4
0
        internal static void ResetChildEditLevel(IUndoableObject child, int parentEditLevel, bool bindingEdit)
        {
            int targetLevel = parentEditLevel;

            if (bindingEdit && targetLevel > 0 && !(child is FieldManager.FieldDataManager))
            {
                targetLevel--;
            }
            // if item's edit level is too high,
            // reduce it to match list
            while (child.EditLevel > targetLevel)
            {
                child.AcceptChanges(targetLevel, false);
            }
            // if item's edit level is too low,
            // increase it to match list
            while (child.EditLevel < targetLevel)
            {
                child.CopyState(targetLevel, false);
            }
        }
Esempio n. 5
0
 internal static void ResetChildEditLevel(IUndoableObject child, int parentEditLevel, bool bindingEdit)
 {
   int targetLevel = parentEditLevel;
   if (bindingEdit && targetLevel > 0 && !(child is FieldManager.FieldDataManager))
     targetLevel--;
   // if item's edit level is too high,
   // reduce it to match list
   while (child.EditLevel > targetLevel)
     child.AcceptChanges(targetLevel, false);
   // if item's edit level is too low,
   // increase it to match list
   while (child.EditLevel < targetLevel)
     child.CopyState(targetLevel, false);
 }