Exemplo n.º 1
0
    public static void Bind(BindPrefab data, Type type)
    {
        var path = data.Path;

        if (!_prefabAndScriptMap.ContainsKey(path))
        {
            _prefabAndScriptMap.Add(path, new List <Type>());
        }

        if (!_prefabAndScriptMap[path].Contains(type))
        {
            _prefabAndScriptMap[path].Add(type);
            _prioritysMap.Add(type, data.Priority);
            _prefabAndScriptMap[path].Sort(new BindPriorityComparer());
        }
    }
Exemplo n.º 2
0
    public void Init()
    {
        System.Reflection.Assembly asm = System.Reflection.Assembly.GetAssembly(typeof(BindPrefab));
        System.Type[] types            = asm.GetExportedTypes();

        foreach (Type type in types)
        {
            foreach (Attribute attribute in Attribute.GetCustomAttributes(type, true))
            {
                if (attribute is BindPrefab)
                {
                    BindPrefab data = attribute as BindPrefab;
                    BindUtil.Bind(data.Path, type);
                }
            }
        }
    }