public void Init(Object asset, SerializedObject serializedObject) { _dirtiableAsset = asset as IDirtiable; _serializedObject = serializedObject; Assert.IsNotNull(_dirtiableAsset); }
public AssetsUpgradeOperation([NotNull] IDirtiable dirtiable) { if (dirtiable == null) { throw new ArgumentNullException(nameof(dirtiable)); } Dirtiables = new [] { dirtiable }; }
/// <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."); } }
/// <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); } }
/// <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."); } } }
/// <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); } }
private static List <IDirtyingOperation> TryGetOperationsMap([NotNull] Dictionary <IDirtiable, List <IDirtyingOperation> > operationsMap, [NotNull] IDirtiable dirtiable) { List <IDirtyingOperation> dirtyingOperations; operationsMap.TryGetValue(dirtiable, out dirtyingOperations); return(dirtyingOperations); }
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); }
private static List<IDirtyingOperation> TryGetOperationsMap(Dictionary<IDirtiable, List<IDirtyingOperation>> operationsMap, IDirtiable dirtiable) { List<IDirtyingOperation> dirtyingOperations; operationsMap.TryGetValue(dirtiable, out dirtyingOperations); return dirtyingOperations; }
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; }