Exemplo n.º 1
0
        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());
            }
        }
Exemplo n.º 2
0
        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);
                    }
                }
            }
        }