mirror of https://github.com/tuyoogame/YooAsset
Compare commits
4 Commits
995b0c8050
...
44cb4168cf
Author | SHA1 | Date |
---|---|---|
|
44cb4168cf | |
|
559ed95999 | |
|
b766df1d31 | |
|
057ff6b22b |
|
@ -33,7 +33,7 @@ namespace YooAsset.Editor
|
|||
Dictionary<string, BuildAssetInfo> allBuildAssetInfoDic = new Dictionary<string, BuildAssetInfo>(1000);
|
||||
|
||||
// 1. 检测配置合法性
|
||||
AssetBundleCollectorSettingData.Setting.CheckConfigError();
|
||||
AssetBundleCollectorSettingData.Setting.CheckPackageConfigError(packageName);
|
||||
|
||||
// 2. 获取所有收集器收集的资源
|
||||
var collectResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(buildMode, packageName);
|
||||
|
|
|
@ -61,9 +61,18 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检测配置错误
|
||||
/// 检测包裹配置错误
|
||||
/// </summary>
|
||||
public void CheckConfigError()
|
||||
public void CheckPackageConfigError(string packageName)
|
||||
{
|
||||
var package = GetPackage(packageName);
|
||||
package.CheckConfigError();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检测所有配置错误
|
||||
/// </summary>
|
||||
public void CheckAllPackageConfigError()
|
||||
{
|
||||
foreach (var package in Packages)
|
||||
{
|
||||
|
@ -72,9 +81,9 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修复配置错误
|
||||
/// 修复所有配置错误
|
||||
/// </summary>
|
||||
public bool FixConfigError()
|
||||
public bool FixAllPackageConfigError()
|
||||
{
|
||||
bool isFixed = false;
|
||||
foreach (var package in Packages)
|
||||
|
@ -92,16 +101,8 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public List<string> GetPackageAllTags(string packageName)
|
||||
{
|
||||
foreach (var package in Packages)
|
||||
{
|
||||
if (package.PackageName == packageName)
|
||||
{
|
||||
return package.GetAllTags();
|
||||
}
|
||||
}
|
||||
|
||||
Debug.LogWarning($"Not found package : {packageName}");
|
||||
return new List<string>();
|
||||
var package = GetPackage(packageName);
|
||||
return package.GetAllTags();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -112,19 +113,25 @@ namespace YooAsset.Editor
|
|||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取包裹类
|
||||
/// </summary>
|
||||
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}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -161,7 +161,7 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public static void FixFile()
|
||||
{
|
||||
bool isFixed = Setting.FixConfigError();
|
||||
bool isFixed = Setting.FixAllPackageConfigError();
|
||||
if (isFixed)
|
||||
{
|
||||
IsDirty = true;
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace YooAsset.Editor
|
|||
private List<RuleDisplayName> _filterRuleList;
|
||||
|
||||
private Button _settingsButton;
|
||||
private VisualElement _helpBoxContainer;
|
||||
private VisualElement _setting1Container;
|
||||
private VisualElement _setting2Container;
|
||||
private Toggle _showPackageToogle;
|
||||
|
@ -82,6 +83,9 @@ namespace YooAsset.Editor
|
|||
|
||||
visualAsset.CloneTree(root);
|
||||
|
||||
// 警示栏
|
||||
_helpBoxContainer = root.Q("HelpBoxContainer");
|
||||
|
||||
// 公共设置相关
|
||||
_settingsButton = root.Q<Button>("SettingsButton");
|
||||
_settingsButton.clicked += SettingsBtn_clicked;
|
||||
|
@ -328,6 +332,24 @@ namespace YooAsset.Editor
|
|||
_uniqueBundleNameToogle.SetValueWithoutNotify(AssetBundleCollectorSettingData.Setting.UniqueBundleName);
|
||||
_showEditorAliasToggle.SetValueWithoutNotify(AssetBundleCollectorSettingData.Setting.ShowEditorAlias);
|
||||
|
||||
// 警示框
|
||||
_helpBoxContainer.Clear();
|
||||
if (_enableAddressableToogle.value && _locationToLowerToogle.value)
|
||||
{
|
||||
var helpBox = new HelpBox("无法同时开启[Enable Addressable]选项和[Location To Lower]选项", HelpBoxMessageType.Error);
|
||||
_helpBoxContainer.Add(helpBox);
|
||||
}
|
||||
if (AssetBundleCollectorSettingData.Setting.Packages.Count > 1 && _uniqueBundleNameToogle.value == false)
|
||||
{
|
||||
var helpBox = new HelpBox("检测到当前配置存在多个Package,建议开启[Unique Bundle Name]选项", HelpBoxMessageType.Warning);
|
||||
_helpBoxContainer.Add(helpBox);
|
||||
}
|
||||
if (_helpBoxContainer.childCount > 0)
|
||||
_helpBoxContainer.style.display = DisplayStyle.Flex;
|
||||
else
|
||||
_helpBoxContainer.style.display = DisplayStyle.None;
|
||||
|
||||
// 设置栏
|
||||
if (_showSettings)
|
||||
{
|
||||
_setting1Container.style.display = DisplayStyle.Flex;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="True">
|
||||
<uie:Toolbar name="Toolbar" style="display: flex; flex-direction: row-reverse;">
|
||||
<ui:Button text="Save" display-tooltip-when-elided="true" name="SaveButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
|
||||
<ui:Button text="导出" display-tooltip-when-elided="true" name="ExportButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
|
||||
|
@ -6,6 +6,7 @@
|
|||
<ui:Button text="修复" display-tooltip-when-elided="true" name="FixButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
|
||||
</uie:Toolbar>
|
||||
<ui:VisualElement name="PublicContainer" style="background-color: rgb(79, 79, 79); flex-direction: column; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
|
||||
<ui:VisualElement name="HelpBoxContainer" style="flex-grow: 1;" />
|
||||
<ui:Button text="Settings" display-tooltip-when-elided="true" name="SettingsButton" />
|
||||
<ui:VisualElement name="PublicContainer1" style="flex-direction: row; flex-wrap: nowrap; height: 28px;">
|
||||
<ui:Toggle label="Show Packages" name="ShowPackages" style="width: 196px; -unity-text-align: middle-left;" />
|
||||
|
|
|
@ -30,17 +30,22 @@ namespace YooAsset.Editor
|
|||
public class ShaderVariantInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Shader asset path in editor.
|
||||
/// 着色器资源路径.
|
||||
/// </summary>
|
||||
public string AssetPath;
|
||||
|
||||
/// <summary>
|
||||
/// Shader name.
|
||||
/// 着色器名称
|
||||
/// </summary>
|
||||
public string ShaderName;
|
||||
|
||||
/// <summary>
|
||||
/// Shader variants elements list.
|
||||
/// 着色器变种总数
|
||||
/// </summary>
|
||||
public int ShaderVariantCount = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 着色器变种列表
|
||||
/// </summary>
|
||||
public List<ShaderVariantElement> ShaderVariantElements = new List<ShaderVariantElement>(1000);
|
||||
}
|
||||
|
@ -71,6 +76,7 @@ namespace YooAsset.Editor
|
|||
element.PassType = passType;
|
||||
element.Keywords = keywords;
|
||||
info.ShaderVariantElements.Add(element);
|
||||
info.ShaderVariantCount++;
|
||||
}
|
||||
private ShaderVariantInfo GetOrCreateShaderVariantInfo(string assetPath, string shaderName)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue