public static string GetBundleName(string path, string folder = "")
    {
        if (string.IsNullOrEmpty(path))
        {
            return("");
        }

        // Shader统一打包;
        string extension = BuildCommon.GetExtension(path);

        if (BuildCommon.IsShaderAsset(path, extension))
        {
            return(ResourceConst.bundleShader);
        }

        string bundleName = path.ToLower();
        string fileName   = Path.GetFileNameWithoutExtension(bundleName);

        if (!string.IsNullOrEmpty(folder))
        {
            bundleName = string.Format("{0}/{1}{2}", folder, fileName, ResourceConst.BundleExtensions);

            return(bundleName);
        }

        if (bundleName.StartsWith(ResourceConst.AssetResourceName.ToLower()))
        {
            bundleName = bundleName.Substring(ResourceConst.AssetResourceName.Length);
        }

        string bundleExtension = Path.GetExtension(bundleName);

        bundleName = bundleName.Trim();
        bundleName = bundleName.Replace('\\', '/');
        bundleName = bundleName.Replace(" ", "_");
        bundleName = bundleName.Replace("#", "_");
        bundleName = bundleName.Replace(bundleExtension, ResourceConst.BundleExtensions);

        if (BuildCommon.IsTextureAsset(path, extension))
        {
            bundleName = bundleName.Replace("_rgb", "_texture");
            bundleName = bundleName.Replace("_alpha", "_texture");
        }

        //if ( path.Contains("bg_2.jpg") )
        //{
        //    Debug.LogErrorFormat("{0} -------------> {1}", path, bundleName);
        //}

        return(bundleName);
    }
    public static bool IsFilterSceneRes(string dep, string file)
    {
        if (string.IsNullOrEmpty(dep) || string.Equals(dep, file))
        {
            return(true);
        }

        // 只记录贴图、动作、音效资源;
        string extension = BuildCommon.GetExtension(dep);

        if (BuildCommon.IsTextureAsset(dep, extension) ||
            BuildCommon.IsAudioAsset(dep, extension) ||
            BuildCommon.IsShaderAsset(dep, extension)
            //|| BuildCommon.IsBigModelAsset(dep,extension)
            )
        {
            return(false);
        }

        return(true);
    }
示例#3
0
    public void DisposeFbx()
    {
        fbxList.Clear();
        AssetDatabase.Refresh();
        foreach (AssetBundleBuildEx ab in mBundleDictionary.Values)
        {
            foreach (string dep in ab.assetNames)
            {
                string extension = BuildCommon.GetExtension(dep);
                if (!BuildCommon.IsModelAsset(dep, extension))
                {
                    continue;
                }

                if (fbxList.Contains(dep))
                {
                    continue;
                }

                fbxList.Add(dep);
            }
        }
        DisposeAllFbx();
    }
示例#4
0
    public static List <string> GetDepTextures(string filePath)
    {
        List <string> depList = new List <string>();

        if (string.IsNullOrEmpty(filePath))
        {
            return(depList);
        }

        string[] ass  = { filePath };
        string[] deps = AssetDatabase.GetDependencies(ass);

        foreach (string dep in deps)
        {
            if (!BuildCommon.IsTextureAsset(dep, BuildCommon.GetExtension(dep)))
            {
                continue;
            }

            depList.Add(dep);
        }

        return(depList);
    }