private static ABAssetInfo ColloectDependecies(string prefabPath, string fileName = "") { prefabPath = prefabPath.ToLower(); string[] depends = AssetDatabase.GetDependencies(prefabPath, false); //场景比较特殊是因为场景ab不能包含其他的资源,场景自己一个ab,所以得把场景引用的资源挪到scenemodle_ab中去 if (prefabPath.EndsWith(".unity")) { if (fileName.Contains(".")) { fileName = fileName.Substring(0, fileName.IndexOf(".")); } m_curretBundleID = new BundleID(m_currentCache.firstVersion, EnumAB.scene_ab, fileName); if (!m_abbuildDic.ContainsKey(m_curretBundleID)) { ABBundleInfo buildInfo = new ABBundleInfo(); buildInfo.bundleId = m_curretBundleID; buildInfo.firstVersion = m_currentCache.firstVersion; m_abbuildDic.Add(m_curretBundleID, buildInfo); } } ABAssetInfo parentAssetInfo = null; if (!m_dependsDic.ContainsKey(prefabPath)) { parentAssetInfo = LoadAssetData(prefabPath); m_dependsDic.Add(prefabPath, parentAssetInfo); if (depends != null) { for (int i = 0; i < depends.Length; i++) { depends[i] = depends[i].ToLower().Replace("\\", "/"); if (!depends[i].EndsWith("dll") && !depends[i].EndsWith("cs") && !depends[i].EndsWith("js")) { //场景比较特殊是因为场景ab不能包含其他的资源,场景自己一个ab,所以得把场景引用的资源挪到scenemodle_ab中去 if (prefabPath.EndsWith(".unity")) { m_curretBundleID = new BundleID(m_currentCache.firstVersion, EnumAB.scenemodle_ab); } var childAssetInfo = ColloectDependecies(depends[i]); parentAssetInfo.AddChild(childAssetInfo); } } } } else { parentAssetInfo = m_dependsDic[prefabPath]; } return(parentAssetInfo); }
private static ABAssetInfo ColloectDependecies_Report(string prefabPath, string fileName = "") { prefabPath = prefabPath.ToLower(); string[] depends = AssetDatabase.GetDependencies(prefabPath, false); if (prefabPath.EndsWith(".unity")) { if (fileName.Contains(".")) { fileName = fileName.Substring(0, fileName.IndexOf(".")); } } ABAssetInfo parentAssetInfo = null; if (!m_dependsDic.ContainsKey(prefabPath)) { parentAssetInfo = X2AssetsBundleEditor.LoadAssetData(prefabPath); m_dependsDic.Add(prefabPath, parentAssetInfo); if (depends != null) { for (int i = 0; i < depends.Length; i++) { depends[i] = depends[i].ToLower().Replace("\\", "/"); if (!depends[i].EndsWith("dll") && !depends[i].EndsWith("cs") && !depends[i].EndsWith("js")) { var childAssetInfo = ColloectDependecies_Report(depends[i]); parentAssetInfo.AddChild(childAssetInfo); } } } } else { parentAssetInfo = m_dependsDic[prefabPath]; } return(parentAssetInfo); }