示例#1
0
        public LocalAssetCResourceLocator()
        {
            m_Locations = new Dictionary <int, IResourceLocation>();
            IEnumerable <string> paths = Directory.GetFiles(ConstValue.m_PackPath, "*.*", SearchOption.AllDirectories).Where(
                p => p.EndsWith(".meta") == false && p.EndsWith(".cs") == false
                );

            foreach (var wholeFilePath in paths)
            {
                string      assetPath = CRUtlity.FullPathToAssetPath(wholeFilePath);
                string      guid      = UnityEditor.AssetDatabase.AssetPathToGUID(assetPath);
                System.Type type      = UnityEditor.AssetDatabase.GetMainAssetTypeAtPath(assetPath);
                int         location  = Lcation(AssetPathToLoadPath(assetPath), type);

                m_Locations.Add(location, new LocalAssetCResourceLocation(assetPath, (typeof(LocalAssetCResourceProvider)).FullName));
            }
        }
示例#2
0
        public static string AssetPathToLoadPath(string assetPath)
        {
            string noExtPath = CRUtlity.DeleteExtension(assetPath);

            return(noExtPath.ToLower().Replace(ConstValue.m_PackPath + "/", ""));
        }