3 using System.Collections.Generic;
6 namespace SiliconStudio.
Paradox.Effects
14 private Dictionary<ParameterKey, ParameterKey> keyMapping;
15 private ParameterCollection.OnUpdateValueDelegate updateValueDelegate;
20 this.keyMapping =
new Dictionary<ParameterKey, ParameterKey>();
25 keyMapping.Add(keySource, keyTarget);
30 keyMapping.Add(key, key);
36 if (keyMapping.TryGetValue(key, out mappedKey))
42 ParameterCollection IParameterCollectionInheritanceInternal.GetParameterCollection()
47 ParameterCollection.OnUpdateValueDelegate IParameterCollectionInheritanceInternal.GetUpdateValueDelegate(ParameterCollection.OnUpdateValueDelegate original)
49 if (updateValueDelegate == null)
51 updateValueDelegate = (source, key, value) =>
53 if (keyMapping.ContainsKey(key))
55 original(source, keyMapping[key], value);
59 return updateValueDelegate;
62 int IParameterCollectionInheritanceInternal.GetInternalValueCount()
64 return keyMapping.Count;
67 ParameterCollection.InternalValue IParameterCollectionInheritanceInternal.GetInternalValue(ParameterKey key)
69 return source.GetInternalValue(keyMapping[key]);
72 IEnumerable<KeyValuePair<ParameterKey, ParameterCollection.InternalValue>> IParameterCollectionInheritanceInternal.GetInternalValues()
74 return source.InternalValues.Where(x => x.Value != null && keyMapping.ContainsKey(x.Key)).Select(x =>
new KeyValuePair<ParameterKey, ParameterCollection.InternalValue>(keyMapping[x.Key], x.Value));
81 foreach (var dynamicValue
in source.DynamicValues)
83 var dynamicValueCopy = dynamicValue.Clone();
84 dynamicValueCopy.Dependencies = dynamicValue.Dependencies.Select(MapKey).ToArray();
85 dynamicValueCopy.Target = MapKey(dynamicValue.Target);
86 yield
return dynamicValueCopy;
93 throw new System.NotImplementedException();
System.Collections.IEnumerator GetEnumerator()
Key of an effect parameter.
Inheritance only applies to specific keys (which can be remapped).
InheritanceDefinition(ParameterCollection source)
void Add(ParameterKey key)
void Add(ParameterKey keySource, ParameterKey keyTarget)
A container to handle a hierarchical collection of effect variables.