コード例 #1
0
        public void Init(Object asset, SerializedObject serializedObject)
        {
            _dirtiableAsset   = asset as IDirtiable;
            _serializedObject = serializedObject;

            Assert.IsNotNull(_dirtiableAsset);
        }
コード例 #2
0
 public AssetsUpgradeOperation([NotNull] IDirtiable dirtiable)
 {
     if (dirtiable == null)
     {
         throw new ArgumentNullException(nameof(dirtiable));
     }
     Dirtiables = new [] { dirtiable };
 }
コード例 #3
0
ファイル: DirtiableManager.cs プロジェクト: FERRERDEV/xenko
 /// <summary>
 /// Unregisters a <see cref="IDirtiable"/> as a dependency of another <see cref="IDirtiable"/> regarding its dirty flag.
 /// </summary>
 /// <param name="affectingDirtiable">The dirtiable object that doesn't affect anymore the dirtiness of another object.</param>
 /// <param name="affectedDirtiable">The dirtiable object that isn't affected anymore by the dirtiness of another object. If <c>null</c>, all affected objects are unregistered.</param>
 /// <exception cref="ArgumentException">The given dirtiable object is not registered.</exception>
 public void UnregisterDirtiableDependency(IDirtiable affectingDirtiable, IDirtiable affectedDirtiable)
 {
     if (affectedDirtiable == null)
     {
         dependenciesMap.Remove(affectingDirtiable);
     }
     else
     {
         List<IDirtiable> dependencies;
         if (!dependenciesMap.TryGetValue(affectingDirtiable, out dependencies) || !dependencies.Remove(affectedDirtiable))
             throw new InvalidOperationException("This dependency between IDirtiable objects is not registered.");
     }
 }
コード例 #4
0
ファイル: DirtiableManager.cs プロジェクト: FERRERDEV/xenko
 /// <summary>
 /// Registers a <see cref="IDirtiable"/> as a dependency of another <see cref="IDirtiable"/> regarding its dirty flag.
 /// When the affecting object becomes dirty, the affected object also become dirty.
 /// </summary>
 /// <param name="affectingDirtiable">The dirtiable object that affects the dirtiness of another object.</param>
 /// <param name="affectedDirtiable">The dirtiable object that is affected by the dirtiness of another object.</param>
 /// <exception cref="ArgumentException">The given dirtiable object is already registered.</exception>
 public void RegisterDirtiableDependency(IDirtiable affectingDirtiable, IDirtiable affectedDirtiable)
 {
     List<IDirtiable> dependencies;
     if (dependenciesMap.TryGetValue(affectingDirtiable, out dependencies))
     {
         if (dependencies.Contains(affectedDirtiable))
             throw new InvalidOperationException("This dependency between IDirtiable objects is already registered.");
         dependencies.Add(affectedDirtiable);
     }
     else
     {
         dependencies = new List<IDirtiable> { affectedDirtiable };
         dependenciesMap.Add(affectingDirtiable, dependencies);
     }
 }
コード例 #5
0
 /// <summary>
 /// Unregisters a <see cref="IDirtiable"/> as a dependency of another <see cref="IDirtiable"/> regarding its dirty flag.
 /// </summary>
 /// <param name="affectingDirtiable">The dirtiable object that doesn't affect anymore the dirtiness of another object.</param>
 /// <param name="affectedDirtiable">The dirtiable object that isn't affected anymore by the dirtiness of another object. If <c>null</c>, all affected objects are unregistered.</param>
 /// <exception cref="ArgumentException">The given dirtiable object is not registered.</exception>
 public void UnregisterDirtiableDependency(IDirtiable affectingDirtiable, IDirtiable affectedDirtiable)
 {
     if (affectedDirtiable == null)
     {
         dependenciesMap.Remove(affectingDirtiable);
     }
     else
     {
         List <IDirtiable> dependencies;
         if (!dependenciesMap.TryGetValue(affectingDirtiable, out dependencies) || !dependencies.Remove(affectedDirtiable))
         {
             throw new InvalidOperationException("This dependency between IDirtiable objects is not registered.");
         }
     }
 }
コード例 #6
0
        /// <summary>
        /// Registers a <see cref="IDirtiable"/> as a dependency of another <see cref="IDirtiable"/> regarding its dirty flag.
        /// When the affecting object becomes dirty, the affected object also become dirty.
        /// </summary>
        /// <param name="affectingDirtiable">The dirtiable object that affects the dirtiness of another object.</param>
        /// <param name="affectedDirtiable">The dirtiable object that is affected by the dirtiness of another object.</param>
        /// <exception cref="ArgumentException">The given dirtiable object is already registered.</exception>
        public void RegisterDirtiableDependency(IDirtiable affectingDirtiable, IDirtiable affectedDirtiable)
        {
            List <IDirtiable> dependencies;

            if (dependenciesMap.TryGetValue(affectingDirtiable, out dependencies))
            {
                if (dependencies.Contains(affectedDirtiable))
                {
                    throw new InvalidOperationException("This dependency between IDirtiable objects is already registered.");
                }
                dependencies.Add(affectedDirtiable);
            }
            else
            {
                dependencies = new List <IDirtiable> {
                    affectedDirtiable
                };
                dependenciesMap.Add(affectingDirtiable, dependencies);
            }
        }
コード例 #7
0
ファイル: DirtiableManager.cs プロジェクト: glepag1/stride
        private static List <IDirtyingOperation> TryGetOperationsMap([NotNull] Dictionary <IDirtiable, List <IDirtyingOperation> > operationsMap, [NotNull] IDirtiable dirtiable)
        {
            List <IDirtyingOperation> dirtyingOperations;

            operationsMap.TryGetValue(dirtiable, out dirtyingOperations);
            return(dirtyingOperations);
        }
コード例 #8
0
ファイル: DirtiableManager.cs プロジェクト: glepag1/stride
        private static List <IDirtyingOperation> GetOrCreateOperationsMap([NotNull] Dictionary <IDirtiable, List <IDirtyingOperation> > operationsMap, [NotNull] IDirtiable dirtiable)
        {
            List <IDirtyingOperation> dirtyingOperations;

            if (!operationsMap.TryGetValue(dirtiable, out dirtyingOperations))
            {
                dirtyingOperations = new List <IDirtyingOperation>();
                operationsMap.Add(dirtiable, dirtyingOperations);
            }
            return(dirtyingOperations);
        }
コード例 #9
0
 private static List<IDirtyingOperation> TryGetOperationsMap(Dictionary<IDirtiable, List<IDirtyingOperation>> operationsMap, IDirtiable dirtiable)
 {
     List<IDirtyingOperation> dirtyingOperations;
     operationsMap.TryGetValue(dirtiable, out dirtyingOperations);
     return dirtyingOperations;
 }
コード例 #10
0
 private static List<IDirtyingOperation> GetOrCreateOperationsMap(Dictionary<IDirtiable, List<IDirtyingOperation>> operationsMap, IDirtiable dirtiable)
 {
     List<IDirtyingOperation> dirtyingOperations;
     if (!operationsMap.TryGetValue(dirtiable, out dirtyingOperations))
     {
         dirtyingOperations = new List<IDirtyingOperation>();
         operationsMap.Add(dirtiable, dirtyingOperations);
     }
     return dirtyingOperations;
 }