Ejemplo n.º 1
0
 /// <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));
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
 /// <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));
 }
Ejemplo n.º 5
0
 public void Clear()
 {
     AssetBundleInfos.Clear();
 }
Ejemplo n.º 6
0
 public void Remove(int index)
 {
     AssetBundleInfos.RemoveAt(index);
 }
Ejemplo n.º 7
0
 public void Remove(AssetBundleInfo info)
 {
     AssetBundleInfos.Remove(info);
 }