public static void Bind(BindPrefabPath data, Type type) { string path = data.Path; if (mPrefabPathAndScriptMap.ContainsKey(path) == false) { mPrefabPathAndScriptMap.Add(path, new List <Type>()); } if (mPrefabPathAndScriptMap[path].Contains(type) == false) { mPrefabPathAndScriptMap[path].Add(type); mPriorityMap.Add(type, data.Priority); mPrefabPathAndScriptMap[path].Sort(new BindPriorityCompare()); } }
public void Init() { Assembly assembly = Assembly.GetAssembly(typeof(BindPrefabPath)); Type[] types = assembly.GetExportedTypes(); foreach (Type type in types) { foreach (Attribute attribute in Attribute.GetCustomAttributes(type, true)) { if (attribute is BindPrefabPath) { BindPrefabPath data = attribute as BindPrefabPath; BindUtil.Bind(data, type); } } } }