Exemplo n.º 1
0
 /// <summary>
 /// 显示资源的最终AB名字结论
 /// </summary>
 /// <param name="pa"></param>
 private void showAssetABNameUI(PackageAsset pa)
 {
     GUILayout.BeginHorizontal();
     GUILayout.Label(string.Format("Asset path : {0}", pa.AssetPath), GUILayout.Width(700.0f));
     GUILayout.Label(string.Format("Asset BuildRule : {0}", pa.AssetAssetBundleBuildRule), GUILayout.Width(200.0f));
     GUILayout.Label(string.Format("AssetBundleName : {0}", pa.getPackageAssetABName()), GUILayout.Width(400.0f));
     GUILayout.EndHorizontal();
 }
    /// <summary>
    /// 根据打包规则获取PackageAsset的最终打包的AB名字
    /// </summary>
    /// <returns></returns>
    public string getPackageAssetABName()
    {
        if (mAssetObject != null)
        {
            var abname = string.Empty;
            // Shader默认都打包到同一个AB里,这里给个默认的打包名是为了避免Shader被打包到其他AB里
            // 真正的Shader AB是根据shaderlist.txt里记录的信息打包得到的
            if (mPackageAssetType == AssetPackageType.E_SHADER)
            {
                abname = ABHelper.Singleton.ShaderABName;
            }
            else
            {
                switch (mAssetAssetBundleBuildRule)
                {
                case AssetABBuildRule.E_SHARE:
                case AssetABBuildRule.E_ENTIRE:
                    abname = mAssetObject.name;
                    break;

                case AssetABBuildRule.E_MUTILPLE:
                    abname = Utilities.getFileFolderName(mAssetPath);
                    break;

                case AssetABBuildRule.E_NORMAL:
                    // 递归判定出最底层Asset最终Normal规则打包的AB名字
                    abname = mDependentPackageAsset.getPackageAssetABName();
                    break;

                default:
                    break;
                }
            }
            return(abname);
        }
        else
        {
            return(string.Empty);
        }
    }