Exemple #1
0
        /// <summary>
        /// 通过XML生成BuildMap
        /// </summary>
        private void CollectABBuildMap()
        {
            //收集所有AssetBundle文件夹
            var abInfo = new AssetBundleBuild[AssetBundleRawInfoList.Count];
            Dictionary <string, List <string> > assetBundleDict = new Dictionary <string, List <string> >();

            for (int i = 0; i < abInfo.Length; i++)
            {
                var xmlInfo = AssetBundleRawInfoList[i];

                if (IsOpenProgressUI)
                {
                    EditorUtility.DisplayProgressBar("Loading", xmlInfo.assetFullName, (float)i / abInfo.Length);
                }

                ////先刷新Import
                ////修改bundle名
                //AssetImporter ai = AssetImporter.GetAtPath(xmlInfo.assetFullName);
                //
                //ai.assetBundleName = xmlInfo.bundleName;
                //
                //if (xmlInfo.HasOtherLanguage) { ai.assetBundleVariant = AssetI8NHelper.GetLangBundleVariantStr(xmlInfo.Language); }
                //else
                //{
                //    ai.assetBundleVariant = null;
                //}
                var info = new AssetBundleBuild();
                info.assetBundleName = xmlInfo.bundleMD5Struct.GetMD5Str(!xmlInfo.isComplexName);
                if (xmlInfo.HasOtherLanguage)
                {
                    info.assetBundleVariant = AssetI8NHelper.GetLangBundleVariantStr(xmlInfo.Language);
                }
                else
                {
                    info.assetBundleVariant = null;
                }
                info.addressableNames = new string[] { xmlInfo.resPath.ToLower() };
                info.assetNames       = new string[] { xmlInfo.assetFullName };

                abInfo[i] = info;
            }

            this.BuildMap = abInfo;
        }