/// <summary> /// 收集磁盘映射 /// </summary> void OnCollectAssetDiskMaping() { #if UNITY_EDITOR string editorABPN = typeof(IAssetBundleFileParameter).Name; string editorManifestN = typeof(AssetBundleManifest).Name; string editorXLSN = typeof(XLS_Config_View_AssetDiskMaping).Name; System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); watch.Start(); #endif if (mAssetBundleManifest != null) { string[] names = mAssetBundleManifest.GetAllAssetBundles(); if (names != null && names.Length > 0) { foreach (string n in names) { IAssetBundleFileParameter abmp = new AssetBundleFileParameter(n); if (!mAssetBundlePathParameterMaping.ContainsKey(abmp.assetBundleId)) { mAssetBundlePathParameterMaping.Add(abmp.assetBundleId, abmp); } } } #if UNITY_EDITOR watch.Stop(); Debug.LogFormat("Collection {0} from 【Manifest =>{1}】,Time:{2}", editorABPN, mAssetBundlePathParameterMaping.Count, watch.Elapsed); watch.Reset(); #endif } #if UNITY_EDITOR int beforeCollectXlsConfigABMPC = mAssetBundlePathParameterMaping.Count; watch.Start(); #endif IAssetBundleFileParameter tempAbp = null; mXLS_Config_View_AssetDiskMaping.Clear(); StrayFogConfigHelper.AddLoadViewFromXLS(StrayFogSQLiteEntityHelper_OnEventHandlerLoadViewFromXLS <XLS_Config_View_AssetDiskMaping>); List <XLS_Config_View_AssetDiskMaping> mapings = StrayFogConfigHelper.Select <XLS_Config_View_AssetDiskMaping>(); if (mapings.Count > 0) { foreach (XLS_Config_View_AssetDiskMaping v in mapings) { if (!mXLS_Config_View_AssetDiskMaping.ContainsKey(v.folderId)) { mXLS_Config_View_AssetDiskMaping.Add(v.folderId, new Dictionary <int, XLS_Config_View_AssetDiskMaping>()); } if (!mXLS_Config_View_AssetDiskMaping[v.folderId].ContainsKey(v.fileId)) { mXLS_Config_View_AssetDiskMaping[v.folderId].Add(v.fileId, v); } if (!mXLSToManifestMaping.ContainsKey(v.folderId)) { mXLSToManifestMaping.Add(v.folderId, new Dictionary <int, int>()); } if (!mXLSToManifestMaping[v.folderId].ContainsKey(v.fileId)) { mXLSToManifestMaping[v.folderId].Add(v.fileId, 0); } if (StrayFogGamePools.setting.isUseAssetBundle) { tempAbp = new AssetBundleFileParameter(v.outAssetPath); } else { tempAbp = new AssetBundleFileParameter(v.inAssetPath); } if (!mAssetBundlePathParameterMaping.ContainsKey(tempAbp.assetBundleId)) { mAssetBundlePathParameterMaping.Add(tempAbp.assetBundleId, tempAbp); } #if UNITY_EDITOR if (mXLSToManifestMaping[v.folderId][v.fileId] != 0 && mXLSToManifestMaping[v.folderId][v.fileId] != tempAbp.assetBundleId) { Debug.LogErrorFormat("Asset 【{0}】【{1}_{2}】has the two assetId 【{3}_{4}】【{5}_{6}】", v.inAssetPath, v.folderId, v.fileId, mAssetBundlePathParameterMaping[mXLSToManifestMaping[v.folderId][v.fileId]].assetBundleId, mAssetBundlePathParameterMaping[mXLSToManifestMaping[v.folderId][v.fileId]].assetBundlePath, tempAbp.assetBundleId, tempAbp.assetBundlePath ); } #endif mXLSToManifestMaping[v.folderId][v.fileId] = tempAbp.assetBundleId; } } StrayFogConfigHelper.RemoveLoadViewFromXLS(StrayFogSQLiteEntityHelper_OnEventHandlerLoadViewFromXLS <XLS_Config_View_AssetDiskMaping>); #if UNITY_EDITOR watch.Stop(); Debug.LogFormat("Collection {0} from 【{1}=> {2}】,Time: {3}", editorABPN, editorXLSN, mapings.Count, watch.Elapsed); Debug.LogFormat("Collection {0} between {1} and {2} different【{3}】,Time:{4}", editorABPN, editorManifestN, editorXLSN, mAssetBundlePathParameterMaping.Count - beforeCollectXlsConfigABMPC, watch.Elapsed); watch.Reset(); #endif }