From 75bd310f4d9b3a701ef100948e7352bee70faf8a Mon Sep 17 00:00:00 2001 From: MichaelO Date: Thu, 24 Aug 2023 11:51:37 +0800 Subject: [PATCH] optimized MediaFrame --- .../BuildTasks/TaskGetBuildMap.cs | 2 +- .../AssetBundleCollector.cs | 8 +-- .../AssetBundleCollectorSetting.cs | 53 +++++++++++-------- .../AssetBundleCollectorSettingData.cs | 2 +- .../AssetBundleCollectorWindow.cs | 22 ++++++++ .../AssetBundleCollectorWindow.uxml | 3 +- .../VisualViewers/ReporterBundleListViewer.cs | 28 ++++++++++ .../ReporterBundleListViewer.cs.meta | 2 +- .../ReporterBundleListViewer.uxml | 1 + .../ReporterBundleListViewer.uxml.meta | 2 +- .../ShaderVariantCollectionManifest.cs | 12 +++-- Assets/OxGFrame/CHANGELOG.md | 4 ++ .../Runtime/Core/Implement/FrameManager.cs | 2 +- .../Runtime/Core/AudioFrame/AudioBase.cs | 2 +- .../Runtime/Core/Implement/MediaBase.cs | 7 ++- .../Runtime/Core/Implement/MediaManager.cs | 22 ++++++++ .../Runtime/Core/VideoFrame/VideoBase.cs | 2 +- Assets/OxGFrame/package.json | 2 +- 18 files changed, 134 insertions(+), 42 deletions(-) diff --git a/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskGetBuildMap.cs b/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskGetBuildMap.cs index 2c32d93d..b8554a64 100644 --- a/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskGetBuildMap.cs +++ b/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskGetBuildMap.cs @@ -33,7 +33,7 @@ public BuildMapContext CreateBuildMap(BuildParameters buildParameters) Dictionary allBuildAssetInfoDic = new Dictionary(1000); // 1. 检测配置合法性 - AssetBundleCollectorSettingData.Setting.CheckConfigError(); + AssetBundleCollectorSettingData.Setting.CheckPackageConfigError(packageName); // 2. 获取所有收集器收集的资源 var collectResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(buildMode, packageName); diff --git a/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs b/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs index e0b19ed5..813d7f1a 100644 --- a/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs +++ b/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollector.cs @@ -340,11 +340,13 @@ private List GetAllDependencies(string mainAssetPath) List result = new List(depends.Length); foreach (string assetPath in depends) { + // 注意:排除主资源对象 + if (assetPath == mainAssetPath) + continue; + if (IsValidateAsset(assetPath, false)) { - // 注意:排除主资源对象 - if (assetPath != mainAssetPath) - result.Add(assetPath); + result.Add(assetPath); } } return result; diff --git a/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs b/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs index b5718512..069f8707 100644 --- a/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs +++ b/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSetting.cs @@ -61,9 +61,18 @@ public void ClearAll() } /// - /// 检测配置错误 + /// 检测包裹配置错误 /// - public void CheckConfigError() + public void CheckPackageConfigError(string packageName) + { + var package = GetPackage(packageName); + package.CheckConfigError(); + } + + /// + /// 检测所有配置错误 + /// + public void CheckAllPackageConfigError() { foreach (var package in Packages) { @@ -72,9 +81,9 @@ public void CheckConfigError() } /// - /// 修复配置错误 + /// 修复所有配置错误 /// - public bool FixConfigError() + public bool FixAllPackageConfigError() { bool isFixed = false; foreach (var package in Packages) @@ -92,16 +101,8 @@ public bool FixConfigError() /// public List GetPackageAllTags(string packageName) { - foreach (var package in Packages) - { - if (package.PackageName == packageName) - { - return package.GetAllTags(); - } - } - - Debug.LogWarning($"Not found package : {packageName}"); - return new List(); + var package = GetPackage(packageName); + return package.GetAllTags(); } /// @@ -112,19 +113,25 @@ public CollectResult GetPackageAssets(EBuildMode buildMode, string packageName) if (string.IsNullOrEmpty(packageName)) throw new Exception("Build package name is null or mepty !"); + var package = GetPackage(packageName); + CollectCommand command = new CollectCommand(buildMode, packageName, + EnableAddressable, LocationToLower, IncludeAssetGUID, UniqueBundleName); + CollectResult collectResult = new CollectResult(command); + collectResult.SetCollectAssets(package.GetAllCollectAssets(command)); + return collectResult; + } + + /// + /// 获取包裹类 + /// + public AssetBundleCollectorPackage GetPackage(string packageName) + { foreach (var package in Packages) { if (package.PackageName == packageName) - { - CollectCommand command = new CollectCommand(buildMode, packageName, - EnableAddressable, LocationToLower, IncludeAssetGUID, UniqueBundleName); - CollectResult collectResult = new CollectResult(command); - collectResult.SetCollectAssets(package.GetAllCollectAssets(command)); - return collectResult; - } + return package; } - - throw new Exception($"Not found collector pacakge : {packageName}"); + throw new Exception($"Not found pacakge : {packageName}"); } } } \ No newline at end of file diff --git a/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs b/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs index 7c8d34ab..b29684c6 100644 --- a/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs +++ b/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorSettingData.cs @@ -161,7 +161,7 @@ public static void SaveFile() /// public static void FixFile() { - bool isFixed = Setting.FixConfigError(); + bool isFixed = Setting.FixAllPackageConfigError(); if (isFixed) { IsDirty = true; diff --git a/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs b/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs index b07c1525..7648054f 100644 --- a/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs +++ b/Assets/OxGFrame/AssetLoader/ThirdParty/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs @@ -26,6 +26,7 @@ public static void OpenWindow() private List _filterRuleList; private Button _settingsButton; + private VisualElement _helpBoxContainer; private VisualElement _setting1Container; private VisualElement _setting2Container; private Toggle _showPackageToogle; @@ -82,6 +83,9 @@ public void CreateGUI() visualAsset.CloneTree(root); + // 警示栏 + _helpBoxContainer = root.Q("HelpBoxContainer"); + // 公共设置相关 _settingsButton = root.Q