예제 #1
0
    static void ProcEnchantEffect_Dir(string dirPath, List <string> shdList)
    {
        Dictionary <string, string> assetMap = new Dictionary <string, string>();

        //获取所有模型
        List <string> prefabList = new List <string>();

        BuildAssetBundle.GetFiles(dirPath, "*.prefab", ref prefabList);

        foreach (string s in prefabList)
        {
            string sTemp = s.Replace('\\', '/');
            if (!sTemp.Contains(AssetBundlePath.EnchantEffectAssetPath))
            {
                continue;
            }
            string assetName = BuildAssetBundle.GetAssetName(s);
            if (assetMap.ContainsKey(assetName))
            {
                assetMap.Remove(assetName);
            }
            assetMap.Add(assetName, s);
        }

        //打包所有模型
        foreach (string assetName in assetMap.Keys)
        {
            string pathTemp   = assetMap[assetName].Replace('\\', '/');
            string parentPath = pathTemp.Substring(0, pathTemp.LastIndexOf('/') + 1);

            ProcEnchantEffect_File(parentPath, pathTemp, AssetBundlePath.EnchantEffectBundlePath, shdList);
        }
    }
예제 #2
0
    /// <summary>
    /// 打包所有贴图
    /// </summary>
    /// <param name="srcPath">源路径</param>
    /// <param name="destParentPath">生成文件父路径</param>
    static void ProcTextures(string srcPath, string destParentPath)
    {
        List <string> textureList = new List <string>();

        BuildAssetBundle.GetFiles(srcPath, "*.tga", ref textureList);

        if (!Directory.Exists(destParentPath + AssetBundleType.Texture.ToString()))
        {
            Directory.CreateDirectory(destParentPath + AssetBundleType.Texture.ToString());
        }
        foreach (string s in textureList)
        {
            Object obj        = AssetDatabase.LoadAssetAtPath(s, typeof(Object));
            string bundlePath = destParentPath + AssetBundleType.Texture.ToString() + "/" + BuildAssetBundle.GetAssetName(s) + "." + AssetBundleType.Texture.ToString().ToLower();
            BuildAssetBundle.Build(obj, null, bundlePath, true);
        }
    }