/// <summary> /// 获取资源信息 /// </summary> public static AssetBundleInfo GetAssetBundleInfo(string location) { if (_isInitialize == false) { throw new Exception($"{nameof(AssetSystem)} is not initialize."); } if (SimulationOnEditor) { #if UNITY_EDITOR string assetPath = AssetPathHelper.FindDatabaseAssetPath(location); AssetBundleInfo bundleInfo = new AssetBundleInfo(assetPath, assetPath); return(bundleInfo); #else throw new Exception($"AssetSystem simulation only support unity editor."); #endif } else { if (BundleServices == null) { throw new Exception($"{nameof(BundleServices)} is null. Use {nameof(AssetSystem.Initialize)}"); } string assetPath = $"{LocationRoot}/{location}".ToLower(); string bundleName = BundleServices.GetAssetBundleName(assetPath); return(BundleServices.GetAssetBundleInfo(bundleName)); } }
/// <summary> /// 获取资源信息 /// </summary> public static AssetBundleInfo GetAssetBundleInfo(string location, string variant) { if (_isInitialize == false) { throw new Exception($"{nameof(AssetSystem)} is not initialize."); } if (SimulationOnEditor) { #if UNITY_EDITOR string localPath = AssetPathHelper.FindDatabaseAssetPath(location); string manifestPath = AssetPathHelper.ConvertLocationToManifestPath(location, variant); AssetBundleInfo bundleInfo = new AssetBundleInfo(manifestPath, localPath); return(bundleInfo); #else throw new Exception($"AssetSystem simulation only support unity editor."); #endif } else { if (BundleServices == null) { throw new Exception($"{nameof(BundleServices)} is null. Use {nameof(AssetSystem.Initialize)}"); } string manifestPath = AssetPathHelper.ConvertLocationToManifestPath(location, variant); return(BundleServices.GetAssetBundleInfo(manifestPath)); } }
/// <summary> /// 创建资源文件加载器 /// </summary> public static AssetLoaderBase CreateLoader(string location, string variant) { if (_isInitialize == false) { throw new Exception($"{nameof(AssetSystem)} is not initialize."); } if (SimulationOnEditor) { #if UNITY_EDITOR string loadPath = AssetPathHelper.FindDatabaseAssetPath(location); return(CreateLoaderInternal(loadPath, null)); #else throw new Exception("AssetSystem virtual simulation only support unity editor."); #endif } else { if (BundleServices == null) { throw new Exception($"{nameof(AssetSystem.BundleServices)} is null. Use {nameof(AssetSystem.Initialize)}"); } string manifestPath = BundleServices.ConvertLocationToManifestPath(location, variant); string loadPath = BundleServices.GetAssetBundleLoadPath(manifestPath); return(CreateLoaderInternal(loadPath, manifestPath)); } }