From 84f9d1985e429c53db47b2b293e8f435fee87d92 Mon Sep 17 00:00:00 2001 From: hevinci Date: Tue, 27 Jun 2023 11:00:01 +0800 Subject: [PATCH] update editor code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. IShareAssetPackRule重命名为ISharedPackRule 2. DefaultShareAssetPackRule重命名为DefaultSharedPackRule --- .../AssetBundleBuilder/AssetBundleBuilderWindow.cs | 2 +- .../Editor/AssetBundleBuilder/BuildAssetInfo.cs | 2 +- .../Editor/AssetBundleBuilder/BuildParameters.cs | 2 +- .../AssetBundleBuilder/BuildReport/ReportSummary.cs | 4 ++-- .../AssetBundleBuilder/BuildTasks/TaskCreateReport.cs | 4 ++-- .../AssetBundleBuilder/BuildTasks/TaskGetBuildMap.cs | 10 +++++----- .../AssetBundleBuilder/BuildTasks/TaskPrepare.cs | 2 +- .../{IShareAssetPackRule.cs => ISharedPackRule.cs} | 2 +- ...reAssetPackRule.cs.meta => ISharedPackRule.cs.meta} | 0 ...tShareAssetPackRule.cs => DefaultSharedPackRule.cs} | 5 ++++- ...tPackRule.cs.meta => DefaultSharedPackRule.cs.meta} | 0 .../VisualViewers/ReporterSummaryViewer.cs | 5 +++-- 12 files changed, 21 insertions(+), 17 deletions(-) rename Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/{IShareAssetPackRule.cs => ISharedPackRule.cs} (84%) rename Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/{IShareAssetPackRule.cs.meta => ISharedPackRule.cs.meta} (100%) rename Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/{DefaultShareAssetPackRule.cs => DefaultSharedPackRule.cs} (72%) rename Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/{DefaultShareAssetPackRule.cs.meta => DefaultSharedPackRule.cs.meta} (100%) diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs index 7bd858a..1eb80f9 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs @@ -276,7 +276,7 @@ namespace YooAsset.Editor buildParameters.PackageVersion = _buildVersionField.value; buildParameters.VerifyBuildingResult = true; buildParameters.AutoAnalyzeRedundancy = true; - buildParameters.ShareAssetPackRule = new DefaultShareAssetPackRule(); + buildParameters.SharedPackRule = new DefaultSharedPackRule(); buildParameters.EncryptionServices = CreateEncryptionServicesInstance(); buildParameters.CompressOption = AssetBundleBuilderSettingData.Setting.CompressOption; buildParameters.OutputNameStyle = AssetBundleBuilderSettingData.Setting.OutputNameStyle; diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildAssetInfo.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildAssetInfo.cs index edcd282..d75bc5e 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildAssetInfo.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildAssetInfo.cs @@ -164,7 +164,7 @@ namespace YooAsset.Editor /// /// 计算共享资源包的完整包名 /// - public void CalculateShareBundleName(IShareAssetPackRule packRule, bool uniqueBundleName, string packageName, string shadersBundleName) + public void CalculateShareBundleName(ISharedPackRule packRule, bool uniqueBundleName, string packageName, string shadersBundleName) { if (CollectorType != ECollectorType.None) return; diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs index 61cce7b..63f43ac 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs @@ -85,7 +85,7 @@ namespace YooAsset.Editor /// /// 共享资源的打包规则 /// - public IShareAssetPackRule ShareAssetPackRule = null; + public ISharedPackRule SharedPackRule = null; /// /// 资源的加密接口 diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportSummary.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportSummary.cs index 26def14..50ba002 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportSummary.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildReport/ReportSummary.cs @@ -79,9 +79,9 @@ namespace YooAsset.Editor public bool AutoAnalyzeRedundancy; /// - /// 共享资源的打包类名称 + /// 共享资源的打包规则类名 /// - public string ShareAssetPackRuleClassName; + public string SharedPackRuleClassName; /// /// 加密服务类名称 diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs index eab46a4..2a9e3c9 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreateReport.cs @@ -50,8 +50,8 @@ namespace YooAsset.Editor buildReport.Summary.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID; buildReport.Summary.UniqueBundleName = buildMapContext.Command.UniqueBundleName; buildReport.Summary.AutoAnalyzeRedundancy = buildParameters.AutoAnalyzeRedundancy; - buildReport.Summary.ShareAssetPackRuleClassName = buildParameters.ShareAssetPackRule == null ? - "null" : buildParameters.ShareAssetPackRule.GetType().FullName; + buildReport.Summary.SharedPackRuleClassName = buildParameters.SharedPackRule == null ? + "null" : buildParameters.SharedPackRule.GetType().FullName; buildReport.Summary.EncryptionServicesClassName = buildParameters.EncryptionServices == null ? "null" : buildParameters.EncryptionServices.GetType().FullName; diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskGetBuildMap.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskGetBuildMap.cs index 22cff99..fc558bf 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskGetBuildMap.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskGetBuildMap.cs @@ -26,10 +26,10 @@ namespace YooAsset.Editor /// public BuildMapContext CreateBuildMap(BuildParameters buildParameters) { - EBuildMode buildMode = buildParameters.BuildMode; - string packageName = buildParameters.PackageName; - IShareAssetPackRule sharePackRule = buildParameters.ShareAssetPackRule; - bool autoAnalyzeRedundancy = buildParameters.AutoAnalyzeRedundancy; + var buildMode = buildParameters.BuildMode; + var packageName = buildParameters.PackageName; + var sharedPackRule = buildParameters.SharedPackRule; + var autoAnalyzeRedundancy = buildParameters.AutoAnalyzeRedundancy; Dictionary allBuildAssetInfoDic = new Dictionary(1000); @@ -106,7 +106,7 @@ namespace YooAsset.Editor var command = collectResult.Command; foreach (var buildAssetInfo in allBuildAssetInfoDic.Values) { - buildAssetInfo.CalculateShareBundleName(sharePackRule, command.UniqueBundleName, command.PackageName, command.ShadersBundleName); + buildAssetInfo.CalculateShareBundleName(sharedPackRule, command.UniqueBundleName, command.PackageName, command.ShadersBundleName); } } else diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskPrepare.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskPrepare.cs index b8ed010..8a2b19f 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskPrepare.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskPrepare.cs @@ -48,7 +48,7 @@ namespace YooAsset.Editor } // 检测共享资源打包规则 - if (buildParameters.ShareAssetPackRule == null) + if (buildParameters.SharedPackRule == null) throw new Exception("共享资源打包规则不能为空!"); #if UNITY_WEBGL diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/IShareAssetPackRule.cs b/Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/ISharedPackRule.cs similarity index 84% rename from Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/IShareAssetPackRule.cs rename to Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/ISharedPackRule.cs index 548bc5e..66acd7d 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/IShareAssetPackRule.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/ISharedPackRule.cs @@ -4,7 +4,7 @@ namespace YooAsset.Editor /// /// 共享资源的打包规则 /// - public interface IShareAssetPackRule + public interface ISharedPackRule { /// /// 获取打包规则结果 diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/IShareAssetPackRule.cs.meta b/Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/ISharedPackRule.cs.meta similarity index 100% rename from Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/IShareAssetPackRule.cs.meta rename to Assets/YooAsset/Editor/AssetBundleCollector/CollectRules/ISharedPackRule.cs.meta diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultShareAssetPackRule.cs b/Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultSharedPackRule.cs similarity index 72% rename from Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultShareAssetPackRule.cs rename to Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultSharedPackRule.cs index c861e6f..6b4b2a4 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultShareAssetPackRule.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultSharedPackRule.cs @@ -4,7 +4,10 @@ using UnityEditor; namespace YooAsset.Editor { - public class DefaultShareAssetPackRule : IShareAssetPackRule + /// + /// 零冗余共享资源打包规则 + /// + public class DefaultSharedPackRule : ISharedPackRule { public PackRuleResult GetPackRuleResult(string assetPath) { diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultShareAssetPackRule.cs.meta b/Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultSharedPackRule.cs.meta similarity index 100% rename from Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultShareAssetPackRule.cs.meta rename to Assets/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultSharedPackRule.cs.meta diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterSummaryViewer.cs b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterSummaryViewer.cs index 6d9f19d..72b2482 100644 --- a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterSummaryViewer.cs +++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterSummaryViewer.cs @@ -66,13 +66,14 @@ namespace YooAsset.Editor _items.Add(new ItemWrapper("包裹名称", buildReport.Summary.BuildPackageName)); _items.Add(new ItemWrapper("包裹版本", buildReport.Summary.BuildPackageVersion)); + _items.Add(new ItemWrapper(string.Empty, string.Empty)); _items.Add(new ItemWrapper("启用可寻址资源定位", $"{buildReport.Summary.EnableAddressable}")); _items.Add(new ItemWrapper("资源定位地址大小写不敏感", $"{buildReport.Summary.LocationToLower}")); _items.Add(new ItemWrapper("包含资源GUID数据", $"{buildReport.Summary.IncludeAssetGUID}")); _items.Add(new ItemWrapper("资源包名唯一化", $"{buildReport.Summary.UniqueBundleName}")); _items.Add(new ItemWrapper("自动分析冗余资源", $"{buildReport.Summary.AutoAnalyzeRedundancy}")); - _items.Add(new ItemWrapper("共享资源的打包类名称", buildReport.Summary.ShareAssetPackRuleClassName)); - _items.Add(new ItemWrapper("加密服务类名称", buildReport.Summary.EncryptionServicesClassName)); + _items.Add(new ItemWrapper("共享资源打包规则", buildReport.Summary.SharedPackRuleClassName)); + _items.Add(new ItemWrapper("资源加密服务类", buildReport.Summary.EncryptionServicesClassName)); _items.Add(new ItemWrapper(string.Empty, string.Empty)); _items.Add(new ItemWrapper("构建参数", string.Empty));