/// <summary> /// 获取某资源包信息 /// </summary> /// <param name="abFilePath">资源包相对路径</param> /// <returns>不存在返回null</returns> public AssetBundleInfo GetAssetBundleInfo(string abFilePath) { if (!HasAssetBundle(abFilePath)) { return(null); } abFilePath = GameFramework.Utility.Path.GetRegularPath(abFilePath); return(AssetBundleInfos.First(x => x.PackFullName == abFilePath)); }
public void AddOrUpdateAssetBundleInfo(AssetBundleInfo info) { var abInfo = GetAssetBundleInfo(info.PackFullName); if (abInfo != null) { abInfo.MD5 = info.MD5; abInfo.GroupTag = info.GroupTag; abInfo.Optional = info.Optional; return; } AssetBundleInfos.Add(info); }
private static void GenerateVersionConfig(string outputPath) { var abManifestFile = Path.Combine(outputPath, GetPlatformName()); var ab = AssetBundle.LoadFromFile(abManifestFile); var abMainfest = (AssetBundleManifest)ab.LoadAsset("AssetBundleManifest"); var allABNames = abMainfest.GetAllAssetBundles(); AssetBundleInfos.Clear(); foreach (var abName in allABNames) { var assetBundle = AssetBundle.LoadFromFile(Path.Combine(outputPath, abName)); var abInfo = new AssetBundleInfo(abName) { assets = assetBundle.GetAllAssetNames() }; AssetBundleInfos.Add(abInfo); assetBundle.Unload(true); } ab.Unload(true); AssetDatabase.Refresh(); if (ResKitEditorWindow.isEnableGenerateClass) { "Assets/QFrameworkData".CreateDirIfNotExists(); var path = Path.GetFullPath(Application.dataPath + Path.DirectorySeparatorChar + "QFrameworkData/QAssets.cs"); var writer = new StreamWriter(File.Open(path, FileMode.Create)); QBundleInfoGenerator.WriteClass(writer, "QAssetBundle", AssetBundleInfos); writer.Close(); AssetDatabase.Refresh(); } }
/// <summary> /// 是否存在该资源包 /// </summary> /// <param name="abFilePath">资源包相对路径</param> /// <returns></returns> public bool HasAssetBundle(string abFilePath) { abFilePath = GameFramework.Utility.Path.GetRegularPath(abFilePath); return(AssetBundleInfos.Any(x => x.PackFullName == abFilePath)); }
public void Clear() { AssetBundleInfos.Clear(); }
public void Remove(int index) { AssetBundleInfos.RemoveAt(index); }
public void Remove(AssetBundleInfo info) { AssetBundleInfos.Remove(info); }