From eed3c9768bb780cf503a9b23d4964524bbc05774 Mon Sep 17 00:00:00 2001 From: hevinci Date: Thu, 16 Feb 2023 20:10:50 +0800 Subject: [PATCH 1/9] Update document --- Docs/Image/Samples-img3.jpg | Bin 0 -> 28638 bytes Docs/Samples.md | 6 ++++++ Docs/ShaderVariantCollector.md | 2 ++ 3 files changed, 8 insertions(+) create mode 100644 Docs/Image/Samples-img3.jpg diff --git a/Docs/Image/Samples-img3.jpg b/Docs/Image/Samples-img3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e44bf671664c1f701b45a054a507cea39c86e3cf GIT binary patch literal 28638 zcmeFa1zcRqmM*>t7F>b`4elhtB}fu1ga9G92A4nwcNz&0+yW#73+@DW2s9Q5?v2y9 zH`+i0|2}tS?mc&Y^XC8F%$fV%n|GS7&2D;2Rqa))R(PFfe&^0_Z`2C|^~Su5iHU)MiHnVmbr&BOA0H1F508M5l$d~!gb)vpn1Yz( z9vL|~IX)336$Kd;DH%E0Zx=yBN1cO#iGzuWLq>o{K=!}82?_~|h>D3n zdoCxhps4ghqnvx}>nyN9P&(1+lV(2rr^@d=+2lafDwNy*C2 z$<50zC@iY1s;;T6t8ZxRfOK|s_w@ek8yy>;n4FrPfiADWR@c@yHn+CnN5?0pXXl8E z%ir3C2B7~_v;Nw$f7LD$RJ-nAV4!1Q|JE+FJMO50PJ)5?;1L$7tUC5v$9qhV1MZSN zjr&&7j>9bQ`jFhzX#|&oMR1uF{#(=j(z5@#h6VnITK3n5{jFV403RI<_3+S10BPU? zazjc)03J@r1uqt~A?6tlV?FF{KBRHqT+7`8-8)~(J+2e{h-{4S`6v}`-(LmWj=2PX zj1Y*eQd|q)XS^OJUUl!?i}eNVz0^MDM`B5@dbZ6>I}F_dcaksC^=|HdEQ2528$Qt|js6 zC*DhDgS1Zk;yS4`?$ww`dQ8=jHj>kFA~^vAeQ0kfe&oXi{Y+QvIV>O@k$t5>j_kh$ z&|)sI&)jILZh;@UHx|E=tz2088V=6Z} zJ2ntW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iZwb*Xz6Lq(4dn`}@9+_*wMU zKk9hwk-j6>bMfXqQ-ib4n(pXV-LPOoq==#9fs^ah{|VRs*tYqH_Z#Q$yAEaD&k;)C z-LNGt?(F`z>6UMM%7M+MH+zIXY9Fo>?|1*mRAC4l+Y;?f+_m+p6nA!~$lOV1IeIpm z`yNaQxbcMN`qcYzo-5+~OZD!XRZ4~5GB7thdEo7}E)6EBVbK0D+Jm%h5g0E2Zvp^C CfJx{8 literal 0 HcmV?d00001 diff --git a/Docs/Samples.md b/Docs/Samples.md index d6759e9..f3686de 100644 --- a/Docs/Samples.md +++ b/Docs/Samples.md @@ -17,3 +17,9 @@ 1. Space Shooter在导入完成后,打开YooAsset->AssetBundle Collector窗口。 1. 点击修复按钮,然后点击Save按钮保存配置,最后关闭窗口。 3. 找到Boot.scene场景启动游戏。 + +#### 太空战机项目 + +首次需要在项目里手动添加Tags才可以保证真机演示正常运行。 + +![image](./Image/Samples-img3.jpg) diff --git a/Docs/ShaderVariantCollector.md b/Docs/ShaderVariantCollector.md index f77256e..1e8de9a 100644 --- a/Docs/ShaderVariantCollector.md +++ b/Docs/ShaderVariantCollector.md @@ -4,6 +4,8 @@ 点击搜集变种按钮开始收集,请耐心等待结束。 +**注意:在收集完成之后,需要将生成的shadervariants文件配置到收集界面(AssetBundle Collector)。** + ### Jenkins支持 ```c# From c4875d4f8049a0cc4052e7789e43152c89d8789b Mon Sep 17 00:00:00 2001 From: hevinci Date: Fri, 17 Feb 2023 18:41:27 +0800 Subject: [PATCH 2/9] optimize pack rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 接口变动:IPackRule --- .../AssetBundleBuilder/BuildAssetInfo.cs | 78 ++++-------- .../AssetBundleBuilder/BuildMapContext.cs | 7 +- .../AssetBundleBuilder/BuildMapCreater.cs | 34 +++--- .../BuildTasks/TaskBuilding_SBP.cs | 3 +- .../BuildTasks/TaskCreatePatchManifest.cs | 8 +- .../BuildTasks/TaskUpdateBuildInfo.cs | 3 +- .../AssetBundleCollector.cs | 81 ++++++++---- .../AssetBundleCollectorSetting.cs | 8 +- .../AssetBundleCollectorWindow.cs | 2 +- .../AssetBundleCollector/CollectAssetInfo.cs | 16 +-- .../AssetBundleCollector/CollectCommand.cs | 14 ++- .../AssetBundleCollector/CollectResult.cs | 23 ++-- .../AssetBundleCollector/DefaultFilterRule.cs | 8 ++ .../AssetBundleCollector/DefaultPackRule.cs | 115 +++++++++++++----- .../Editor/AssetBundleCollector/IPackRule.cs | 51 +++++++- 15 files changed, 288 insertions(+), 163 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildAssetInfo.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildAssetInfo.cs index e34abce..7999f92 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildAssetInfo.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildAssetInfo.cs @@ -7,8 +7,6 @@ namespace YooAsset.Editor { public class BuildAssetInfo { - private string _mainBundleName; - private string _shareBundleName; private bool _isAddAssetTags = false; private readonly HashSet _referenceBundleNames = new HashSet(); @@ -17,6 +15,11 @@ namespace YooAsset.Editor /// public ECollectorType CollectorType { private set; get; } + /// + /// 资源包完整名称 + /// + public string BundleName { private set; get; } + /// /// 可寻址地址 /// @@ -54,10 +57,10 @@ namespace YooAsset.Editor public List AllDependAssetInfos { private set; get; } - public BuildAssetInfo(ECollectorType collectorType, string mainBundleName, string address, string assetPath, bool isRawAsset) + public BuildAssetInfo(ECollectorType collectorType, string bundleName, string address, string assetPath, bool isRawAsset) { - _mainBundleName = mainBundleName; CollectorType = collectorType; + BundleName = bundleName; Address = address; AssetPath = assetPath; IsRawAsset = isRawAsset; @@ -133,24 +136,12 @@ namespace YooAsset.Editor /// public bool HasBundleName() { - string bundleName = GetBundleName(); - if (string.IsNullOrEmpty(bundleName)) + if (string.IsNullOrEmpty(BundleName)) return false; else return true; } - /// - /// 获取资源包名称 - /// - public string GetBundleName() - { - if (CollectorType == ECollectorType.None) - return _shareBundleName; - else - return _mainBundleName; - } - /// /// 添加关联的资源包名称 /// @@ -164,53 +155,32 @@ namespace YooAsset.Editor } /// - /// 计算主资源或共享资源的完整包名 + /// 计算共享资源包的完整包名 /// - public void CalculateFullBundleName(bool uniqueBundleName, string packageName) + public void CalculateShareBundleName(bool uniqueBundleName, string packageName, string shadersBundleName) { - if (CollectorType == ECollectorType.None) + if (CollectorType != ECollectorType.None) + return; + + if (IsRawAsset) + throw new Exception("Should never get here !"); + + if (IsShaderAsset) { - if (IsRawAsset) - throw new Exception("Should never get here !"); - - if (IsShaderAsset) - { - _shareBundleName = YooAssetSettingsData.GetUnityShadersBundleFullName(uniqueBundleName, packageName); - } - else - { - if (_referenceBundleNames.Count > 1) - { - IPackRule packRule = PackDirectory.StaticPackRule; - var bundleName = packRule.GetBundleName(new PackRuleData(AssetPath)); - if (YooAssetSettingsData.Setting.RegularBundleName) - bundleName = EditorTools.GetRegularPath(bundleName).Replace('/', '_').Replace('.', '_').ToLower(); - else - bundleName = EditorTools.GetRegularPath(bundleName).ToLower(); - - if (uniqueBundleName) - _shareBundleName = $"{packageName.ToLower()}_share_{bundleName}.{YooAssetSettingsData.Setting.AssetBundleFileVariant}"; - else - _shareBundleName = $"share_{bundleName}.{YooAssetSettingsData.Setting.AssetBundleFileVariant}"; - } - } + BundleName = shadersBundleName; } else { - if (IsRawAsset) + if (_referenceBundleNames.Count > 1) { - string mainBundleName = $"{_mainBundleName}.{YooAssetSettingsData.Setting.RawBundleFileVariant}"; - _mainBundleName = mainBundleName.ToLower(); + IPackRule packRule = PackDirectory.StaticPackRule; + PackRuleResult packRuleResult = packRule.GetPackRuleResult(new PackRuleData(AssetPath)); + BundleName = packRuleResult.GetShareBundleName(packageName, uniqueBundleName); } else { - string mainBundleName = $"{_mainBundleName}.{YooAssetSettingsData.Setting.AssetBundleFileVariant}"; - _mainBundleName = mainBundleName.ToLower(); ; - } - - if (uniqueBundleName) - { - _mainBundleName = $"{packageName.ToLower()}_{_mainBundleName}"; + // 注意:被引用次数小于1的资源不需要设置资源包名称 + BundleName = string.Empty; } } } diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapContext.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapContext.cs index effc561..f05ee17 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapContext.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapContext.cs @@ -24,6 +24,11 @@ namespace YooAsset.Editor /// public bool UniqueBundleName; + /// + /// 着色器统一的全名称 + /// + public string ShadersBundleName; + /// /// 资源包列表 /// @@ -35,7 +40,7 @@ namespace YooAsset.Editor /// public void PackAsset(BuildAssetInfo assetInfo) { - string bundleName = assetInfo.GetBundleName(); + string bundleName = assetInfo.BundleName; if (string.IsNullOrEmpty(bundleName)) throw new Exception("Should never get here !"); diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapCreater.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapCreater.cs index bf783d3..46417ce 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapCreater.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapCreater.cs @@ -11,8 +11,7 @@ namespace YooAsset.Editor /// 执行资源构建上下文 /// public static BuildMapContext CreateBuildMap(EBuildMode buildMode, string packageName) - { - BuildMapContext context = new BuildMapContext(); + { Dictionary buildAssetDic = new Dictionary(1000); // 1. 检测配置合法性 @@ -22,7 +21,7 @@ namespace YooAsset.Editor var buildResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(buildMode, packageName); List allCollectAssets = buildResult.CollectAssets; - // 3. 剔除未被引用的依赖资源 + // 3. 剔除未被引用的依赖项资源 List removeDependList = new List(); foreach (var collectAssetInfo in allCollectAssets) { @@ -42,7 +41,8 @@ namespace YooAsset.Editor { if (buildAssetDic.ContainsKey(collectAssetInfo.AssetPath) == false) { - var buildAssetInfo = new BuildAssetInfo(collectAssetInfo.CollectorType, collectAssetInfo.BundleName, + var buildAssetInfo = new BuildAssetInfo( + collectAssetInfo.CollectorType, collectAssetInfo.BundleName, collectAssetInfo.Address, collectAssetInfo.AssetPath, collectAssetInfo.IsRawAsset); buildAssetInfo.AddAssetTags(collectAssetInfo.AssetTags); buildAssetInfo.AddBundleTags(collectAssetInfo.AssetTags); @@ -54,32 +54,28 @@ namespace YooAsset.Editor } } - // 5. 录入相关依赖的资源 + // 5. 录入所有收集资源的依赖资源 foreach (var collectAssetInfo in allCollectAssets) { + string collectAssetBundleName = collectAssetInfo.BundleName; foreach (var dependAssetPath in collectAssetInfo.DependAssets) { if (buildAssetDic.ContainsKey(dependAssetPath)) { buildAssetDic[dependAssetPath].AddBundleTags(collectAssetInfo.AssetTags); - buildAssetDic[dependAssetPath].AddReferenceBundleName(collectAssetInfo.BundleName); + buildAssetDic[dependAssetPath].AddReferenceBundleName(collectAssetBundleName); } else { var buildAssetInfo = new BuildAssetInfo(dependAssetPath); buildAssetInfo.AddBundleTags(collectAssetInfo.AssetTags); - buildAssetInfo.AddReferenceBundleName(collectAssetInfo.BundleName); + buildAssetInfo.AddReferenceBundleName(collectAssetBundleName); buildAssetDic.Add(dependAssetPath, buildAssetInfo); } } } - // 6. 记录关键信息 - context.AssetFileCount = buildAssetDic.Count; - context.EnableAddressable = buildResult.EnableAddressable; - context.UniqueBundleName = buildResult.UniqueBundleName; - - // 7. 填充主动收集资源的依赖列表 + // 6. 填充所有收集资源的依赖列表 foreach (var collectAssetInfo in allCollectAssets) { var dependAssetInfos = new List(collectAssetInfo.DependAssets.Count); @@ -93,10 +89,18 @@ namespace YooAsset.Editor buildAssetDic[collectAssetInfo.AssetPath].SetAllDependAssetInfos(dependAssetInfos); } - // 8. 计算完整的资源包名 + // 7. 记录关键信息 + BuildMapContext context = new BuildMapContext(); + context.AssetFileCount = buildAssetDic.Count; + context.EnableAddressable = buildResult.Command.EnableAddressable; + context.UniqueBundleName = buildResult.Command.UniqueBundleName; + context.ShadersBundleName = buildResult.ShadersBundleName; + + // 8. 计算共享的资源包名 + var command = buildResult.Command; foreach (KeyValuePair pair in buildAssetDic) { - pair.Value.CalculateFullBundleName(buildResult.UniqueBundleName, buildResult.PackageName); + pair.Value.CalculateShareBundleName(command.UniqueBundleName, command.PackageName, buildResult.ShadersBundleName); } // 9. 移除不参与构建的资源 diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding_SBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding_SBP.cs index d17ee14..6c7ae23 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding_SBP.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskBuilding_SBP.cs @@ -33,8 +33,7 @@ namespace YooAsset.Editor // 开始构建 IBundleBuildResults buildResults; var buildParameters = buildParametersContext.GetSBPBuildParameters(); - var shadersBunldeName = YooAssetSettingsData.GetUnityShadersBundleFullName(buildMapContext.UniqueBundleName, buildParametersContext.Parameters.PackageName); - var taskList = SBPBuildTasks.Create(shadersBunldeName); + var taskList = SBPBuildTasks.Create(buildMapContext.ShadersBundleName); ReturnCode exitCode = ContentPipeline.BuildAssetBundles(buildParameters, buildContent, out buildResults, taskList); if (exitCode < 0) { diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs index 2982c84..2754b7a 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs @@ -42,13 +42,12 @@ namespace YooAsset.Editor patchManifest.AssetList = GetAllPatchAsset(context, patchManifest); // 更新Unity内置资源包的引用关系 - string shadersBunldeName = YooAssetSettingsData.GetUnityShadersBundleFullName(buildMapContext.UniqueBundleName, buildParameters.PackageName); if (buildParameters.BuildPipeline == EBuildPipeline.ScriptableBuildPipeline) { if (buildParameters.BuildMode == EBuildMode.IncrementalBuild) { var buildResultContext = context.GetContextObject(); - UpdateBuiltInBundleReference(patchManifest, buildResultContext.Results, shadersBunldeName); + UpdateBuiltInBundleReference(patchManifest, buildResultContext.Results, buildMapContext.ShadersBundleName); } } @@ -98,7 +97,6 @@ namespace YooAsset.Editor private List GetAllPatchBundle(BuildContext context) { var buildMapContext = context.GetContextObject(); - var buildParametersContext = context.GetContextObject(); List result = new List(1000); foreach (var bundleInfo in buildMapContext.BundleInfos) @@ -129,7 +127,7 @@ namespace YooAsset.Editor patchAsset.Address = string.Empty; patchAsset.AssetPath = assetInfo.AssetPath; patchAsset.AssetTags = assetInfo.AssetTags.ToArray(); - patchAsset.BundleID = GetAssetBundleID(assetInfo.GetBundleName(), patchManifest); + patchAsset.BundleID = GetAssetBundleID(assetInfo.BundleName, patchManifest); patchAsset.DependIDs = GetAssetBundleDependIDs(patchAsset.BundleID, assetInfo, patchManifest); result.Add(patchAsset); } @@ -143,7 +141,7 @@ namespace YooAsset.Editor { if (dependAssetInfo.HasBundleName()) { - int bundleID = GetAssetBundleID(dependAssetInfo.GetBundleName(), patchManifest); + int bundleID = GetAssetBundleID(dependAssetInfo.BundleName, patchManifest); if (mainBundleID != bundleID) { if (result.Contains(bundleID) == false) diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskUpdateBuildInfo.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskUpdateBuildInfo.cs index 8c6f6fd..64dca4d 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskUpdateBuildInfo.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskUpdateBuildInfo.cs @@ -48,7 +48,8 @@ namespace YooAsset.Editor // 4.更新补丁包输出的文件路径 foreach (var bundleInfo in buildMapContext.BundleInfos) { - string patchFileName = PatchManifestTools.CreateBundleFileName(outputNameStyle, bundleInfo.BundleName, bundleInfo.PatchInfo.PatchFileHash, bundleInfo.IsRawFile); + string patchFileExtension = PatchManifestTools.GetRemoteBundleFileExtension(bundleInfo.BundleName); + string patchFileName = PatchManifestTools.GetRemoteBundleFileName(outputNameStyle, bundleInfo.BundleName, patchFileExtension, bundleInfo.PatchInfo.PatchFileHash); bundleInfo.PatchInfo.PatchOutputFilePath = $"{packageOutputDirectory}/{patchFileName}"; } } diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs index 8449b7c..2a9208b 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs @@ -142,11 +142,14 @@ namespace YooAsset.Editor } Dictionary result = new Dictionary(1000); - bool isRawAsset = PackRuleName == nameof(PackRawFile); + + // 检测是否为原生资源打包规则 + IPackRule packRuleInstance = AssetBundleCollectorSettingData.GetPackRuleInstance(PackRuleName); + bool isRawFilePackRule = packRuleInstance.IsRawFilePackRule(); // 检测原生资源包的收集器类型 - if (isRawAsset && CollectorType != ECollectorType.MainAssetCollector) - throw new Exception($"The raw file must be set to {nameof(ECollectorType)}.{ECollectorType.MainAssetCollector} : {CollectPath}"); + if (isRawFilePackRule && CollectorType != ECollectorType.MainAssetCollector) + throw new Exception($"The raw file pack rule must be set to {nameof(ECollectorType)}.{ECollectorType.MainAssetCollector} : {CollectPath}"); if (string.IsNullOrEmpty(CollectPath)) throw new Exception($"The collect path is null or empty in group : {group.GroupName}"); @@ -158,11 +161,11 @@ namespace YooAsset.Editor string[] findAssets = EditorTools.FindAssets(EAssetSearchType.All, collectDirectory); foreach (string assetPath in findAssets) { - if (IsValidateAsset(assetPath) && IsCollectAsset(assetPath)) + if (IsValidateAsset(assetPath, isRawFilePackRule) && IsCollectAsset(assetPath)) { if (result.ContainsKey(assetPath) == false) { - var collectAssetInfo = CreateCollectAssetInfo(command, group, assetPath, isRawAsset); + var collectAssetInfo = CreateCollectAssetInfo(command, group, assetPath, isRawFilePackRule); result.Add(assetPath, collectAssetInfo); } else @@ -175,9 +178,9 @@ namespace YooAsset.Editor else { string assetPath = CollectPath; - if (IsValidateAsset(assetPath) && IsCollectAsset(assetPath)) + if (IsValidateAsset(assetPath, isRawFilePackRule) && IsCollectAsset(assetPath)) { - var collectAssetInfo = CreateCollectAssetInfo(command, group, assetPath, isRawAsset); + var collectAssetInfo = CreateCollectAssetInfo(command, group, assetPath, isRawFilePackRule); result.Add(assetPath, collectAssetInfo); } else @@ -207,22 +210,22 @@ namespace YooAsset.Editor return result.Values.ToList(); } - private CollectAssetInfo CreateCollectAssetInfo(CollectCommand command, AssetBundleCollectorGroup group, string assetPath, bool isRawAsset) + private CollectAssetInfo CreateCollectAssetInfo(CollectCommand command, AssetBundleCollectorGroup group, string assetPath, bool isRawFilePackRule) { string address = GetAddress(group, assetPath); - string bundleName = GetBundleName(group, assetPath); + string bundleName = GetBundleName(command, group, assetPath); List assetTags = GetAssetTags(group); - CollectAssetInfo collectAssetInfo = new CollectAssetInfo(CollectorType, bundleName, address, assetPath, assetTags, isRawAsset); + CollectAssetInfo collectAssetInfo = new CollectAssetInfo(CollectorType, bundleName, address, assetPath, isRawFilePackRule, assetTags); // 注意:模拟构建模式下不需要收集依赖资源 if (command.BuildMode == EBuildMode.SimulateBuild) collectAssetInfo.DependAssets = new List(); else - collectAssetInfo.DependAssets = GetAllDependencies(assetPath); + collectAssetInfo.DependAssets = GetAllDependencies(assetPath, isRawFilePackRule); return collectAssetInfo; } - private bool IsValidateAsset(string assetPath) + private bool IsValidateAsset(string assetPath, bool isRawFilePackRule) { if (assetPath.StartsWith("Assets/") == false && assetPath.StartsWith("Packages/") == false) { @@ -239,10 +242,31 @@ namespace YooAsset.Editor if (type == typeof(LightingDataAsset)) return false; - // 忽略Unity无法识别的无效文件 - // 注意:只对非原生文件收集器处理 - if(PackRuleName != nameof(PackRawFile)) + // 检测原生文件是否合规 + if (isRawFilePackRule) { + string extension = StringUtility.RemoveFirstChar(System.IO.Path.GetExtension(assetPath)); + if (extension == EAssetFileExtension.unity.ToString() || extension == EAssetFileExtension.prefab.ToString() || + extension == EAssetFileExtension.mat.ToString() || extension == EAssetFileExtension.controller.ToString() || + extension == EAssetFileExtension.fbx.ToString() || extension == EAssetFileExtension.anim.ToString() || + extension == EAssetFileExtension.shader.ToString()) + { + UnityEngine.Debug.LogWarning($"Raw file pack rule can not support file estension : {extension}"); + return false; + } + + // 注意:原生文件只支持无依赖关系的资源 + string[] depends = AssetDatabase.GetDependencies(assetPath, true); + if (depends.Length != 1) + { + UnityEngine.Debug.LogWarning($"Raw file pack rule can not support estension : {extension}"); + return false; + } + } + else + { + // 忽略Unity无法识别的无效文件 + // 注意:只对非原生文件收集器处理 if (type == typeof(UnityEditor.DefaultAsset)) { UnityEngine.Debug.LogWarning($"Cannot pack default asset : {assetPath}"); @@ -258,7 +282,7 @@ namespace YooAsset.Editor } private bool IsIgnoreFile(string fileExtension) { - foreach (var extension in YooAssetSettings.IgnoreFileExtensions) + foreach (var extension in DefaultFilterRule.IgnoreFileExtensions) { if (extension == fileExtension) return true; @@ -284,19 +308,22 @@ namespace YooAsset.Editor string adressValue = addressRuleInstance.GetAssetAddress(new AddressRuleData(assetPath, CollectPath, group.GroupName)); return adressValue; } - private string GetBundleName(AssetBundleCollectorGroup group, string assetPath) + private string GetBundleName(CollectCommand command, AssetBundleCollectorGroup group, string assetPath) { System.Type assetType = AssetDatabase.GetMainAssetTypeAtPath(assetPath); if (assetType == typeof(UnityEngine.Shader) || assetType == typeof(UnityEngine.ShaderVariantCollection)) - return EditorTools.GetRegularPath(YooAssetSettings.UnityShadersBundleName).ToLower(); - - // 根据规则设置获取资源包名称 - IPackRule packRuleInstance = AssetBundleCollectorSettingData.GetPackRuleInstance(PackRuleName); - string bundleName = packRuleInstance.GetBundleName(new PackRuleData(assetPath, CollectPath, group.GroupName)); - if(YooAssetSettingsData.Setting.RegularBundleName) - return EditorTools.GetRegularPath(bundleName).Replace('/', '_').Replace('.', '_').ToLower(); + { + // 获取着色器打包规则结果 + PackRuleResult packRuleResult = DefaultPackRule.CreateShadersPackRuleResult(); + return packRuleResult.GetMainBundleName(command.PackageName, command.UniqueBundleName); + } else - return EditorTools.GetRegularPath(bundleName).ToLower(); + { + // 获取其它资源打包规则结果 + IPackRule packRuleInstance = AssetBundleCollectorSettingData.GetPackRuleInstance(PackRuleName); + PackRuleResult packRuleResult = packRuleInstance.GetPackRuleResult(new PackRuleData(assetPath, CollectPath, group.GroupName)); + return packRuleResult.GetMainBundleName(command.PackageName, command.UniqueBundleName); + } } private List GetAssetTags(AssetBundleCollectorGroup group) { @@ -305,13 +332,13 @@ namespace YooAsset.Editor tags.AddRange(temper); return tags; } - private List GetAllDependencies(string mainAssetPath) + private List GetAllDependencies(string mainAssetPath, bool isRawFilePackRule) { List result = new List(); string[] depends = AssetDatabase.GetDependencies(mainAssetPath, true); foreach (string assetPath in depends) { - if (IsValidateAsset(assetPath)) + if (IsValidateAsset(assetPath, isRawFilePackRule)) { // 注意:排除主资源对象 if (assetPath != mainAssetPath) diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs index bfcc7d8..1480c9a 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs @@ -100,8 +100,8 @@ namespace YooAsset.Editor { if (package.PackageName == packageName) { - CollectCommand command = new CollectCommand(buildMode, EnableAddressable); - CollectResult collectResult = new CollectResult(package.PackageName, EnableAddressable, UniqueBundleName); + CollectCommand command = new CollectCommand(buildMode, package.PackageName, EnableAddressable, UniqueBundleName); + CollectResult collectResult = new CollectResult(command); collectResult.SetCollectAssets(package.GetAllCollectAssets(command)); return collectResult; } @@ -118,8 +118,8 @@ namespace YooAsset.Editor List collectResultList = new List(1000); foreach (var package in Packages) { - CollectCommand command = new CollectCommand(buildMode, EnableAddressable); - CollectResult collectResult = new CollectResult(package.PackageName, EnableAddressable, UniqueBundleName); + CollectCommand command = new CollectCommand(buildMode, package.PackageName, EnableAddressable, UniqueBundleName); + CollectResult collectResult = new CollectResult(command); collectResult.SetCollectAssets(package.GetAllCollectAssets(command)); collectResultList.Add(collectResult); } diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs index 486ce7e..9ec9366 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs @@ -776,7 +776,7 @@ namespace YooAsset.Editor try { - CollectCommand command = new CollectCommand(EBuildMode.DryRunBuild, _enableAddressableToogle.value); + CollectCommand command = new CollectCommand(EBuildMode.DryRunBuild, _packageNameTxt.value, _enableAddressableToogle.value, _uniqueBundleNameToogle.value); collectAssetInfos = collector.GetAllCollectAssets(command, group); } catch (System.Exception e) diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/CollectAssetInfo.cs b/Assets/YooAsset/Editor/AssetBundleCollector/CollectAssetInfo.cs index fc9c41b..6d12c35 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/CollectAssetInfo.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/CollectAssetInfo.cs @@ -14,7 +14,7 @@ namespace YooAsset.Editor /// 资源包名称 /// public string BundleName { private set; get; } - + /// /// 可寻址地址 /// @@ -25,30 +25,30 @@ namespace YooAsset.Editor /// public string AssetPath { private set; get; } - /// - /// 资源分类标签 - /// - public List AssetTags { private set; get; } - /// /// 是否为原生资源 /// public bool IsRawAsset { private set; get; } + /// + /// 资源分类标签 + /// + public List AssetTags { private set; get; } + /// /// 依赖的资源列表 /// public List DependAssets = new List(); - public CollectAssetInfo(ECollectorType collectorType, string bundleName, string address, string assetPath, List assetTags, bool isRawAsset) + public CollectAssetInfo(ECollectorType collectorType, string bundleName, string address, string assetPath, bool isRawAsset, List assetTags) { CollectorType = collectorType; BundleName = bundleName; Address = address; AssetPath = assetPath; - AssetTags = assetTags; IsRawAsset = isRawAsset; + AssetTags = assetTags; } } } \ No newline at end of file diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/CollectCommand.cs b/Assets/YooAsset/Editor/AssetBundleCollector/CollectCommand.cs index 0501a37..2f6d3bb 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/CollectCommand.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/CollectCommand.cs @@ -8,15 +8,27 @@ namespace YooAsset.Editor /// public EBuildMode BuildMode { private set; get; } + /// + /// 包裹名称 + /// + public string PackageName { private set; get; } + /// /// 是否启用可寻址资源定位 /// public bool EnableAddressable { private set; get; } - public CollectCommand(EBuildMode buildMode, bool enableAddressable) + /// + /// 资源包名唯一化 + /// + public bool UniqueBundleName { private set; get; } + + public CollectCommand(EBuildMode buildMode, string packageName, bool enableAddressable, bool uniqueBundleName) { BuildMode = buildMode; + PackageName = packageName; EnableAddressable = enableAddressable; + UniqueBundleName = uniqueBundleName; } } } \ No newline at end of file diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/CollectResult.cs b/Assets/YooAsset/Editor/AssetBundleCollector/CollectResult.cs index 5eca265..3cbd1cf 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/CollectResult.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/CollectResult.cs @@ -6,19 +6,14 @@ namespace YooAsset.Editor public class CollectResult { /// - /// 包裹名称 + /// 收集命令 /// - public string PackageName { private set; get; } + public CollectCommand Command { private set; get; } /// - /// 是否启用可寻址资源定位 + /// 着色器统一全名称 /// - public bool EnableAddressable { private set; get; } - - /// - /// 资源包名唯一化 - /// - public bool UniqueBundleName { private set; get; } + public string ShadersBundleName { private set; get; } /// /// 收集的资源信息列表 @@ -26,11 +21,13 @@ namespace YooAsset.Editor public List CollectAssets { private set; get; } - public CollectResult(string packageName, bool enableAddressable, bool uniqueBundleName) + public CollectResult(CollectCommand command) { - PackageName = packageName; - EnableAddressable = enableAddressable; - UniqueBundleName = uniqueBundleName; + Command = command; + + // 着色器统一全名称 + var packRuleResult = DefaultPackRule.CreateShadersPackRuleResult(); + ShadersBundleName = packRuleResult.GetMainBundleName(command.PackageName, command.UniqueBundleName); } public void SetCollectAssets(List collectAssets) diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/DefaultFilterRule.cs b/Assets/YooAsset/Editor/AssetBundleCollector/DefaultFilterRule.cs index eba9b87..b24b0b2 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/DefaultFilterRule.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/DefaultFilterRule.cs @@ -4,6 +4,14 @@ using System.IO; namespace YooAsset.Editor { + public class DefaultFilterRule + { + /// + /// 忽略的文件类型 + /// + public static readonly string[] IgnoreFileExtensions = { "", ".so", ".dll", ".cs", ".js", ".boo", ".meta", ".cginc", ".hlsl" }; + } + [DisplayName("收集所有资源")] public class CollectAll : IFilterRule { diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/DefaultPackRule.cs b/Assets/YooAsset/Editor/AssetBundleCollector/DefaultPackRule.cs index 3dbc7c9..4d9d582 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/DefaultPackRule.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/DefaultPackRule.cs @@ -4,6 +4,31 @@ using UnityEditor; namespace YooAsset.Editor { + public class DefaultPackRule + { + /// + /// AssetBundle文件的后缀名 + /// + public const string AssetBundleFileExtension = "bundle"; + + /// + /// 原生文件的后缀名 + /// + public const string RawFileExtension = "rawfile"; + + /// + /// Unity着色器资源包名称 + /// + public const string ShadersBundleName = "unityshaders"; + + + public static PackRuleResult CreateShadersPackRuleResult() + { + PackRuleResult result = new PackRuleResult(ShadersBundleName, AssetBundleFileExtension); + return result; + } + } + /// /// 以文件路径作为资源包名 /// 注意:每个文件独自打资源包 @@ -13,9 +38,16 @@ namespace YooAsset.Editor [DisplayName("以文件路径作为资源包名")] public class PackSeparately : IPackRule { - string IPackRule.GetBundleName(PackRuleData data) + PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data) { - return StringUtility.RemoveExtension(data.AssetPath); + string bundleName = StringUtility.RemoveExtension(data.AssetPath); + PackRuleResult result = new PackRuleResult(bundleName, DefaultPackRule.AssetBundleFileExtension); + return result; + } + + bool IPackRule.IsRawFilePackRule() + { + return false; } } @@ -30,9 +62,16 @@ namespace YooAsset.Editor { public static PackDirectory StaticPackRule = new PackDirectory(); - string IPackRule.GetBundleName(PackRuleData data) + PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data) { - return Path.GetDirectoryName(data.AssetPath); + string bundleName = Path.GetDirectoryName(data.AssetPath); + PackRuleResult result = new PackRuleResult(bundleName, DefaultPackRule.AssetBundleFileExtension); + return result; + } + + bool IPackRule.IsRawFilePackRule() + { + return false; } } @@ -46,7 +85,7 @@ namespace YooAsset.Editor [DisplayName("以收集器路径下顶级文件夹为资源包名")] public class PackTopDirectory : IPackRule { - string IPackRule.GetBundleName(PackRuleData data) + PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data) { string assetPath = data.AssetPath.Replace(data.CollectPath, string.Empty); assetPath = assetPath.TrimStart('/'); @@ -56,13 +95,19 @@ namespace YooAsset.Editor if (Path.HasExtension(splits[0])) throw new Exception($"Not found root directory : {assetPath}"); string bundleName = $"{data.CollectPath}/{splits[0]}"; - return bundleName; + PackRuleResult result = new PackRuleResult(bundleName, DefaultPackRule.AssetBundleFileExtension); + return result; } else { throw new Exception($"Not found root directory : {assetPath}"); } } + + bool IPackRule.IsRawFilePackRule() + { + return false; + } } /// @@ -72,17 +117,26 @@ namespace YooAsset.Editor [DisplayName("以收集器路径作为资源包名")] public class PackCollector : IPackRule { - string IPackRule.GetBundleName(PackRuleData data) + PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data) { + string bundleName; string collectPath = data.CollectPath; if (AssetDatabase.IsValidFolder(collectPath)) { - return collectPath; + bundleName = collectPath; } else { - return StringUtility.RemoveExtension(collectPath); + bundleName = StringUtility.RemoveExtension(collectPath); } + + PackRuleResult result = new PackRuleResult(bundleName, DefaultPackRule.AssetBundleFileExtension); + return result; + } + + bool IPackRule.IsRawFilePackRule() + { + return false; } } @@ -93,9 +147,16 @@ namespace YooAsset.Editor [DisplayName("以分组名称作为资源包名")] public class PackGroup : IPackRule { - string IPackRule.GetBundleName(PackRuleData data) + PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data) { - return data.GroupName; + string bundleName = data.GroupName; + PackRuleResult result = new PackRuleResult(bundleName, DefaultPackRule.AssetBundleFileExtension); + return result; + } + + bool IPackRule.IsRawFilePackRule() + { + return false; } } @@ -106,23 +167,16 @@ namespace YooAsset.Editor [DisplayName("打包原生文件")] public class PackRawFile : IPackRule { - string IPackRule.GetBundleName(PackRuleData data) + PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data) { - string extension = StringUtility.RemoveFirstChar(Path.GetExtension(data.AssetPath)); - if (extension == EAssetFileExtension.unity.ToString() || extension == EAssetFileExtension.prefab.ToString() || - extension == EAssetFileExtension.mat.ToString() || extension == EAssetFileExtension.controller.ToString() || - extension == EAssetFileExtension.fbx.ToString() || extension == EAssetFileExtension.anim.ToString() || - extension == EAssetFileExtension.shader.ToString()) - { - throw new Exception($"{nameof(PackRawFile)} is not support file estension : {extension}"); - } + string bundleName = data.AssetPath; + PackRuleResult result = new PackRuleResult(bundleName, DefaultPackRule.RawFileExtension); + return result; + } - // 注意:原生文件只支持无依赖关系的资源 - string[] depends = AssetDatabase.GetDependencies(data.AssetPath, true); - if (depends.Length != 1) - throw new Exception($"{nameof(PackRawFile)} is not support estension : {extension}"); - - return data.AssetPath; + bool IPackRule.IsRawFilePackRule() + { + return true; } } @@ -132,9 +186,14 @@ namespace YooAsset.Editor [DisplayName("打包着色器变种集合")] public class PackShaderVariants : IPackRule { - public string GetBundleName(PackRuleData data) + public PackRuleResult GetPackRuleResult(PackRuleData data) { - return YooAssetSettings.UnityShadersBundleName; + return DefaultPackRule.CreateShadersPackRuleResult(); + } + + bool IPackRule.IsRawFilePackRule() + { + return false; } } } \ No newline at end of file diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/IPackRule.cs b/Assets/YooAsset/Editor/AssetBundleCollector/IPackRule.cs index c719002..7593baa 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/IPackRule.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/IPackRule.cs @@ -3,7 +3,7 @@ namespace YooAsset.Editor { public struct PackRuleData { - public string AssetPath; + public string AssetPath; public string CollectPath; public string GroupName; @@ -21,14 +21,59 @@ namespace YooAsset.Editor } } + public struct PackRuleResult + { + private readonly string _bundleName; + private readonly string _bundleExtension; + + public PackRuleResult(string bundleName, string bundleExtension) + { + _bundleName = bundleName; + _bundleExtension = bundleExtension; + } + + /// + /// 获取主资源包全名称 + /// + public string GetMainBundleName(string packageName, bool uniqueBundleName) + { + string fullName; + string bundleName = EditorTools.GetRegularPath(_bundleName).Replace('/', '_').Replace('.', '_').ToLower(); + if (uniqueBundleName) + fullName = $"{packageName}_{bundleName}.{_bundleExtension}"; + else + fullName = $"{bundleName}.{_bundleExtension}"; + return fullName.ToLower(); + } + + /// + /// 获取共享资源包全名称 + /// + public string GetShareBundleName(string packageName, bool uniqueBundleName) + { + string fullName; + string bundleName = EditorTools.GetRegularPath(_bundleName).Replace('/', '_').Replace('.', '_').ToLower(); + if (uniqueBundleName) + fullName = $"{packageName}_share_{bundleName}.{_bundleExtension}"; + else + fullName = $"share_{bundleName}.{_bundleExtension}"; + return fullName.ToLower(); + } + } + /// /// 资源打包规则接口 /// public interface IPackRule { /// - /// 获取资源打包所属的资源包名称 + /// 获取打包规则结果 /// - string GetBundleName(PackRuleData data); + PackRuleResult GetPackRuleResult(PackRuleData data); + + /// + /// 是否为原生文件打包规则 + /// + bool IsRawFilePackRule(); } } \ No newline at end of file From 69c7a51215c385ed2b87640e0b99f92eacee9978 Mon Sep 17 00:00:00 2001 From: hevinci Date: Fri, 17 Feb 2023 18:43:39 +0800 Subject: [PATCH 3/9] update runtime logic --- .../Runtime/PatchSystem/PatchBundle.cs | 19 +++++++++++-- .../Runtime/PatchSystem/PatchManifestTools.cs | 16 +++++------ .../Runtime/Settings/YooAssetSettings.cs | 28 +------------------ .../Runtime/Settings/YooAssetSettingsData.cs | 13 --------- 4 files changed, 26 insertions(+), 50 deletions(-) diff --git a/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs b/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs index fb017fe..7e5e018 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PatchBundle.cs @@ -122,7 +122,7 @@ namespace YooAsset } /// - /// 文件名称(远端文件名和内置文件名) + /// 文件名称 /// private string _fileName; public string FileName @@ -135,6 +135,20 @@ namespace YooAsset } } + /// + /// 文件后缀名 + /// + private string _fileExtension; + public string FileExtension + { + get + { + if (string.IsNullOrEmpty(_fileExtension)) + throw new Exception("Should never get here !"); + return _fileExtension; + } + } + public PatchBundle() { @@ -146,7 +160,8 @@ namespace YooAsset public void ParseBundle(string packageName, int nameStype) { PackageName = packageName; - _fileName = PatchManifestTools.CreateBundleFileName(nameStype, BundleName, FileHash, IsRawFile); + _fileExtension = PatchManifestTools.GetRemoteBundleFileExtension(BundleName); + _fileName = PatchManifestTools.GetRemoteBundleFileName(nameStype, BundleName, _fileExtension, FileHash); } /// diff --git a/Assets/YooAsset/Runtime/PatchSystem/PatchManifestTools.cs b/Assets/YooAsset/Runtime/PatchSystem/PatchManifestTools.cs index 3ca72ec..10d93e7 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PatchManifestTools.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PatchManifestTools.cs @@ -155,21 +155,21 @@ namespace YooAsset } #endif - /// - /// 生成Bundle文件的正式名称 - /// - public static string CreateBundleFileName(int nameStyle, string bundleName, string fileHash, bool isRawFile) + public static string GetRemoteBundleFileExtension(string bundleName) + { + string fileExtension = Path.GetExtension(bundleName); + return fileExtension; + } + public static string GetRemoteBundleFileName(int nameStyle, string bundleName, string fileExtension, string fileHash) { if (nameStyle == 1) //HashName { - string fileExtension = isRawFile ? YooAssetSettingsData.Setting.RawBundleFileVariant : YooAssetSettingsData.Setting.AssetBundleFileVariant; - return StringUtility.Format("{0}.{1}", fileHash, fileExtension); + return StringUtility.Format("{0}{1}", fileHash, fileExtension); } else if (nameStyle == 4) //BundleName_HashName { string fileName = bundleName.Remove(bundleName.LastIndexOf('.')); - string fileExtension = isRawFile ? YooAssetSettingsData.Setting.RawBundleFileVariant : YooAssetSettingsData.Setting.AssetBundleFileVariant; - return StringUtility.Format("{0}_{1}.{2}", fileName, fileHash, fileExtension); + return StringUtility.Format("{0}_{1}{2}", fileName, fileHash, fileExtension); } else { diff --git a/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs b/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs index 3dbcdb1..dac7ac6 100644 --- a/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs +++ b/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs @@ -5,26 +5,11 @@ namespace YooAsset [CreateAssetMenu(fileName = "YooAssetSettings", menuName = "YooAsset/Create Settings")] internal class YooAssetSettings : ScriptableObject { - /// - /// AssetBundle文件的后缀名 - /// - public string AssetBundleFileVariant = "bundle"; - - /// - /// 原生文件的后缀名 - /// - public string RawBundleFileVariant = "rawfile"; - /// /// 清单文件名称 /// public string PatchManifestFileName = "PatchManifest"; - /// - /// 资源包名正规化(移除路径分隔符) - /// - public bool RegularBundleName = true; - /// /// 清单文件头标记 @@ -41,7 +26,7 @@ namespace YooAsset /// public const string PatchManifestFileVersion = "1.4.0"; - + /// /// 缓存的数据文件名称 /// @@ -63,20 +48,9 @@ namespace YooAsset /// public const string ReportFileName = "BuildReport"; - /// - /// Unity着色器资源包名称 - /// - public const string UnityShadersBundleName = "unityshaders"; - /// /// 内置资源目录名称 /// public const string StreamingAssetsBuildinFolder = "BuildinFiles"; - - - /// - /// 忽略的文件类型 - /// - public static readonly string[] IgnoreFileExtensions = { "", ".so", ".dll", ".cs", ".js", ".boo", ".meta", ".cginc", ".hlsl" }; } } \ No newline at end of file diff --git a/Assets/YooAsset/Runtime/Settings/YooAssetSettingsData.cs b/Assets/YooAsset/Runtime/Settings/YooAssetSettingsData.cs index 05cbf2a..f30b5b9 100644 --- a/Assets/YooAsset/Runtime/Settings/YooAssetSettingsData.cs +++ b/Assets/YooAsset/Runtime/Settings/YooAssetSettingsData.cs @@ -71,18 +71,5 @@ namespace YooAsset { return $"{Setting.PatchManifestFileName}_{packageName}.version"; } - - /// - /// 获取着色器资源包全名称(包含后缀名) - /// - public static string GetUnityShadersBundleFullName(bool uniqueBundleName, string packageName) - { - string shareBundleName; - if (uniqueBundleName) - shareBundleName = $"{packageName.ToLower()}_{YooAssetSettings.UnityShadersBundleName}.{Setting.AssetBundleFileVariant}"; - else - shareBundleName = $"{YooAssetSettings.UnityShadersBundleName}.{Setting.AssetBundleFileVariant}"; - return shareBundleName.ToLower(); - } } } \ No newline at end of file From 145ca936e7c45e4b336bd4869f8621e55a0ee3af Mon Sep 17 00:00:00 2001 From: hevinci Date: Fri, 17 Feb 2023 18:44:19 +0800 Subject: [PATCH 4/9] update sample --- .../Scripts/Editor/CustomPackRule.cs | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/Assets/YooAsset/Samples~/Extension Sample/Scripts/Editor/CustomPackRule.cs b/Assets/YooAsset/Samples~/Extension Sample/Scripts/Editor/CustomPackRule.cs index 653df5a..ebd7a3c 100644 --- a/Assets/YooAsset/Samples~/Extension Sample/Scripts/Editor/CustomPackRule.cs +++ b/Assets/YooAsset/Samples~/Extension Sample/Scripts/Editor/CustomPackRule.cs @@ -10,7 +10,7 @@ public class PackEffectTexture : IPackRule { private const string PackDirectory = "Assets/Effect/Textures/"; - string IPackRule.GetBundleName(PackRuleData data) + PackRuleResult IPackRule.GetPackRuleResult(PackRuleData data) { string assetPath = data.AssetPath; if (assetPath.StartsWith(PackDirectory) == false) @@ -18,6 +18,43 @@ public class PackEffectTexture : IPackRule string assetName = Path.GetFileName(assetPath).ToLower(); string firstChar = assetName.Substring(0, 1); - return $"{PackDirectory}effect_texture_{firstChar}"; + string bundleName = $"{PackDirectory}effect_texture_{firstChar}"; + var packRuleResult = new PackRuleResult(bundleName, DefaultPackRule.AssetBundleFileExtension); + return packRuleResult; + } + + bool IPackRule.IsRawFilePackRule() + { + return false; + } +} + +[DisplayName("打包视频(自定义)")] +public class PackVideo : IPackRule +{ + public PackRuleResult GetPackRuleResult(PackRuleData data) + { + string bundleName = RemoveExtension(data.AssetPath); + string fileExtension = Path.GetExtension(data.AssetPath); + fileExtension = fileExtension.Remove(0, 1); + PackRuleResult result = new PackRuleResult(bundleName, fileExtension); + return result; + } + + bool IPackRule.IsRawFilePackRule() + { + return true; + } + + private string RemoveExtension(string str) + { + if (string.IsNullOrEmpty(str)) + return str; + + int index = str.LastIndexOf("."); + if (index == -1) + return str; + else + return str.Remove(index); //"assets/config/test.unity3d" --> "assets/config/test" } } \ No newline at end of file From e887bf1fd7d291b44ad3fb246f5fffc7faba2e2e Mon Sep 17 00:00:00 2001 From: hevinci Date: Fri, 17 Feb 2023 19:07:10 +0800 Subject: [PATCH 5/9] fix #67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复报告查看界面2021.3兼容性问题 --- .../VisualViewers/ReporterAssetListViewer.uxml | 4 ++-- .../VisualViewers/ReporterBundleListViewer.uxml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.uxml b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.uxml index 18391ae..a957c06 100644 --- a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.uxml +++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.uxml @@ -1,10 +1,10 @@ - + - + diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.uxml b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.uxml index 73f0c86..d7434a8 100644 --- a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.uxml +++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.uxml @@ -1,4 +1,4 @@ - + @@ -8,7 +8,7 @@ - + From d8e7892ab7c2aa8e1c3141cd8a2f4c8eec0ca4c1 Mon Sep 17 00:00:00 2001 From: hevinci Date: Fri, 17 Feb 2023 19:15:22 +0800 Subject: [PATCH 6/9] Update package.json --- Assets/YooAsset/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/YooAsset/package.json b/Assets/YooAsset/package.json index eda5570..03ceb65 100644 --- a/Assets/YooAsset/package.json +++ b/Assets/YooAsset/package.json @@ -1,7 +1,7 @@ { "name": "com.tuyoogame.yooasset", "displayName": "YooAsset", - "version": "1.4.4-preview", + "version": "1.4.5-preview", "unity": "2019.4", "description": "unity3d resources management system.", "author": { From acca74dce7f6e57ff53dec22af90e5252d11f359 Mon Sep 17 00:00:00 2001 From: hevinci Date: Fri, 17 Feb 2023 19:15:34 +0800 Subject: [PATCH 7/9] Update CHANGELOG.md --- Assets/YooAsset/CHANGELOG.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Assets/YooAsset/CHANGELOG.md b/Assets/YooAsset/CHANGELOG.md index 8ddf58b..6b7b62a 100644 --- a/Assets/YooAsset/CHANGELOG.md +++ b/Assets/YooAsset/CHANGELOG.md @@ -2,6 +2,35 @@ All notable changes to this package will be documented in this file. +## [1.4.5-preview] - 2023-02-17 + +### Fixed + +- (#67)修复了报告查看界面在Unity2021.3上的兼容性问题。 +- (#66)修复了在Unity2021.3上编辑器模拟模式运行报错的问题。 + +### Changed + +- 接口变更:IPackRule + + ````c# + /// + /// 资源打包规则接口 + /// + public interface IPackRule + { + /// + /// 获取打包规则结果 + /// + PackRuleResult GetPackRuleResult(PackRuleData data); + + /// + /// 是否为原生文件打包规则 + /// + bool IsRawFilePackRule(); + } + ```` + ## [1.4.4-preview] - 2023-02-14 ### Fixed From 70465a49d78fec58d7df23a56aeab93af01bac26 Mon Sep 17 00:00:00 2001 From: hevinci Date: Mon, 20 Feb 2023 14:58:28 +0800 Subject: [PATCH 8/9] Update document --- Docs/AssetBundleDeployer.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Docs/AssetBundleDeployer.md b/Docs/AssetBundleDeployer.md index 96f53ce..f356a5a 100644 --- a/Docs/AssetBundleDeployer.md +++ b/Docs/AssetBundleDeployer.md @@ -20,3 +20,6 @@ CDN └─v2.0 ```` +**游戏版本说明** + +v1.0 代表的是游戏版本,不是资源版本。在没有更换安装包的前提下,不需要递增这个游戏版本。每次生成的补丁包只需要覆盖掉当前游戏版本目录下即可。 From 7d21da76fbf9170820691ac76cc08fa759bc897a Mon Sep 17 00:00:00 2001 From: hevinci Date: Mon, 20 Feb 2023 15:54:22 +0800 Subject: [PATCH 9/9] update sample --- .../GameScript/Editor/Encryption.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/Encryption.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/Encryption.cs index b69a63f..1b39c2f 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/Encryption.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/Encryption.cs @@ -42,7 +42,8 @@ public class FileStreamEncryption : IEncryptionServices { public EncryptResult Encrypt(EncryptFileInfo fileInfo) { - if (fileInfo.BundleName.Contains("gameres_music")) + // LoadFromStream + if (fileInfo.BundleName.Contains("_gameres_audio")) { var fileData = File.ReadAllBytes(fileInfo.FilePath); for (int i = 0; i < fileData.Length; i++) @@ -55,7 +56,22 @@ public class FileStreamEncryption : IEncryptionServices result.EncryptedData = fileData; return result; } - else + + // LoadFromFileOffset + if (fileInfo.BundleName.Contains("_gameres_uiimage")) + { + var fileData = File.ReadAllBytes(fileInfo.FilePath); + int offset = 32; + var temper = new byte[fileData.Length + offset]; + Buffer.BlockCopy(fileData, 0, temper, offset, fileData.Length); + + EncryptResult result = new EncryptResult(); + result.LoadMethod = EBundleLoadMethod.LoadFromFileOffset; + result.EncryptedData = temper; + return result; + } + + // Normal { EncryptResult result = new EncryptResult(); result.LoadMethod = EBundleLoadMethod.Normal;