Exemplo n.º 1
0
        public bool AddRes(string path)
        {
            var key = AssetUtility.GetAssetNameFromPath(path);

            if (content.ContainsKey(key))
            {
                throw new ArgumentException("Duplicate Named Resources:" + key);
            }
            else
            {
                Shader s = AssetUtility.LoadAssetAtFullPath <Shader>(path);
                if (s)
                {
                    content.Add(key, s.name);
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        public void SearchAll()
        {
            var resDirs = new List <DirectoryInfo>();

            foreach (var path in SearchPaths)
            {
                resDirs.Add(new DirectoryInfo(path));
            }
            foreach (var e in resDirs)
            {
                var files = e.GetFiles("*", SearchOption.AllDirectories)
                            .Where(file => !file.Name.EndsWith(".meta"));
                foreach (var f in files)
                {
                    for (var i = 0; i < generators.Count; ++i)
                    {
                        if (generators[i].Belong(f.FullName))
                        {
                            try
                            {
                                generators[i].AddRes(f.FullName);
                            }
                            catch (Exception ex)
                            {
                                Debug.LogError("Auto generate class R failed in: " + f.FullName, AssetUtility.LoadAssetAtFullPath <UnityEngine.Object>(f.FullName));
                                Debug.LogException(ex);
                            }
                        }
                    }
                }
            }
        }