public TreeSnapshot(Transform transform) { _root = transform; _children = _root.GetChildren() .ToDefaultingDictionary <Transform, string, TreeSnapshot>(t => t.gameObject.name, t => new TreeSnapshot(t)); AddChildNodes(this); }
public static DefaultingDictionary <TKey, TValue> ToDefaultingDictionary <TValue, TKey>(this IEnumerable <TValue> _this, System.Func <TValue, TKey> keySelector) { DefaultingDictionary <TKey, TValue> dictionary = new DefaultingDictionary <TKey, TValue>(); foreach (TValue value in _this) { dictionary[keySelector(value)] = value; } return(dictionary); }
public static DefaultingDictionary <TKey, TValue> ToDefaultingDictionary <TSource, TKey, TValue>(this IEnumerable <TSource> _this, System.Func <TSource, TKey> keySelector, System.Func <TSource, TValue> valueSelector, TValue defaultValue) { DefaultingDictionary <TKey, TValue> dictionary = new DefaultingDictionary <TKey, TValue>(defaultValue); foreach (TSource source in _this) { dictionary[keySelector(source)] = valueSelector(source); } return(dictionary); }
static CoreLogger() { s_defaultModule = new Module() { Name = DefaultModuleName }; s_modules[0] = s_defaultModule; s_namesToModules = new DefaultingDictionary <string, Module>(s_defaultModule); s_namesToModules[DefaultModuleName] = s_defaultModule; s_numModules = 1; if (s_provider == null) { SetProvider(new UnityLoggerProvider()); } }