3 using System.Collections.Generic;
6 namespace SiliconStudio.
Paradox.Effects
15 private Dictionary<ParameterKey, ParameterKey> keyMapping =
new Dictionary<ParameterKey, ParameterKey>();
16 private ParameterCollection.OnUpdateValueDelegate updateValueDelegate;
21 this.keyIndex = keyIndex;
29 ParameterKey MapKey(ParameterKey key,
bool createIfMissing =
true)
31 ParameterKey mappedKey;
32 bool keyFound = keyMapping.TryGetValue(key, out mappedKey);
40 keyMapping.Add(key, mappedKey = key.AppendKey(keyIndex));
44 ParameterCollection.OnUpdateValueDelegate IParameterCollectionInheritanceInternal.GetUpdateValueDelegate(ParameterCollection.OnUpdateValueDelegate original)
46 if (updateValueDelegate == null)
48 updateValueDelegate = (source, key, value) =>
50 original(source, MapKey(key), value);
53 return updateValueDelegate;
56 int IParameterCollectionInheritanceInternal.GetInternalValueCount()
58 return ((IParameterCollectionInheritanceInternal)source).GetInternalValueCount();
62 ParameterCollection.InternalValue IParameterCollectionInheritanceInternal.GetInternalValue(ParameterKey key)
64 return source.GetInternalValue(MapKey(key));
67 IEnumerable<KeyValuePair<ParameterKey, ParameterCollection.InternalValue>> IParameterCollectionInheritanceInternal.GetInternalValues()
69 return source.InternalValues.Where(x => x.Value != null).
Select(x =>
new KeyValuePair<ParameterKey, ParameterCollection.InternalValue>(MapKey(x.Key), x.Value));
76 foreach (var dynamicValue
in source.DynamicValues)
78 var dynamicValueCopy = dynamicValue.Clone();
81 dynamicValueCopy.Dependencies = dynamicValue.Dependencies.Select(x => MapKey(x,
false)).ToArray();
82 dynamicValueCopy.Target = MapKey(dynamicValue.Target);
84 yield
return dynamicValueCopy;
Applies IndexedOf(index) on each key.
InheritanceIndexer(ParameterCollection source, int keyIndex)
A container to handle a hierarchical collection of effect variables.