mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-25 10:11:51 +00:00
build #621
This commit is contained in:
@@ -139,13 +139,6 @@ namespace YooAsset.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public List<CollectAssetInfo> GetAllCollectAssets(CollectCommand command, AssetBundleCollectorGroup group)
|
public List<CollectAssetInfo> GetAllCollectAssets(CollectCommand command, AssetBundleCollectorGroup group)
|
||||||
{
|
{
|
||||||
// 注意:模拟构建模式下只收集主资源
|
|
||||||
if (command.SimulateBuild)
|
|
||||||
{
|
|
||||||
if (CollectorType != ECollectorType.MainAssetCollector)
|
|
||||||
return new List<CollectAssetInfo>();
|
|
||||||
}
|
|
||||||
|
|
||||||
Dictionary<string, CollectAssetInfo> result = new Dictionary<string, CollectAssetInfo>(1000);
|
Dictionary<string, CollectAssetInfo> result = new Dictionary<string, CollectAssetInfo>(1000);
|
||||||
|
|
||||||
// 收集打包资源路径
|
// 收集打包资源路径
|
||||||
|
|||||||
@@ -831,7 +831,7 @@ namespace YooAsset.Editor
|
|||||||
var foldout = new Foldout();
|
var foldout = new Foldout();
|
||||||
foldout.name = "Foldout1";
|
foldout.name = "Foldout1";
|
||||||
foldout.value = false;
|
foldout.value = false;
|
||||||
foldout.text = "Main Assets";
|
foldout.text = "Assets";
|
||||||
elementFoldout.Add(foldout);
|
elementFoldout.Add(foldout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -864,11 +864,9 @@ namespace YooAsset.Editor
|
|||||||
var foldout = element.Q<Foldout>("Foldout1");
|
var foldout = element.Q<Foldout>("Foldout1");
|
||||||
foldout.RegisterValueChangedCallback(evt =>
|
foldout.RegisterValueChangedCallback(evt =>
|
||||||
{
|
{
|
||||||
if (evt.newValue)
|
RefreshFoldoutContent(foldout, selectGroup, collector);
|
||||||
RefreshFoldout(foldout, selectGroup, collector);
|
|
||||||
else
|
|
||||||
foldout.Clear();
|
|
||||||
});
|
});
|
||||||
|
RefreshFoldoutName(foldout, collector.CollectorType);
|
||||||
|
|
||||||
// Remove Button
|
// Remove Button
|
||||||
var removeBtn = element.Q<Button>("Button1");
|
var removeBtn = element.Q<Button>("Button1");
|
||||||
@@ -885,10 +883,7 @@ namespace YooAsset.Editor
|
|||||||
collector.CollectPath = AssetDatabase.GetAssetPath(evt.newValue);
|
collector.CollectPath = AssetDatabase.GetAssetPath(evt.newValue);
|
||||||
collector.CollectorGUID = AssetDatabase.AssetPathToGUID(collector.CollectPath);
|
collector.CollectorGUID = AssetDatabase.AssetPathToGUID(collector.CollectPath);
|
||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
if (foldout.value)
|
RefreshFoldoutContent(foldout, selectGroup, collector);
|
||||||
{
|
|
||||||
RefreshFoldout(foldout, selectGroup, collector);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
UIElementsTools.RefreshObjectFieldShowPath(objectField1);
|
UIElementsTools.RefreshObjectFieldShowPath(objectField1);
|
||||||
|
|
||||||
@@ -899,10 +894,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
collector.CollectorType = EditorTools.NameToEnum<ECollectorType>(evt.newValue);
|
collector.CollectorType = EditorTools.NameToEnum<ECollectorType>(evt.newValue);
|
||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
if (foldout.value)
|
RefreshFoldoutContent(foldout, selectGroup, collector);
|
||||||
{
|
|
||||||
RefreshFoldout(foldout, selectGroup, collector);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (collector.CollectorType == ECollectorType.MainAssetCollector)
|
if (collector.CollectorType == ECollectorType.MainAssetCollector)
|
||||||
textTags.SetEnabled(true);
|
textTags.SetEnabled(true);
|
||||||
@@ -921,10 +913,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
collector.AddressRuleName = evt.newValue.ClassName;
|
collector.AddressRuleName = evt.newValue.ClassName;
|
||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
if (foldout.value)
|
RefreshFoldoutContent(foldout, selectGroup, collector);
|
||||||
{
|
|
||||||
RefreshFoldout(foldout, selectGroup, collector);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -937,10 +926,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
collector.PackRuleName = evt.newValue.ClassName;
|
collector.PackRuleName = evt.newValue.ClassName;
|
||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
if (foldout.value)
|
RefreshFoldoutContent(foldout, selectGroup, collector);
|
||||||
{
|
|
||||||
RefreshFoldout(foldout, selectGroup, collector);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Filter Rule
|
// Filter Rule
|
||||||
@@ -952,10 +938,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
collector.FilterRuleName = evt.newValue.ClassName;
|
collector.FilterRuleName = evt.newValue.ClassName;
|
||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
if (foldout.value)
|
RefreshFoldoutContent(foldout, selectGroup, collector);
|
||||||
{
|
|
||||||
RefreshFoldout(foldout, selectGroup, collector);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// UserData
|
// UserData
|
||||||
@@ -976,61 +959,101 @@ namespace YooAsset.Editor
|
|||||||
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private void RefreshFoldout(Foldout foldout, AssetBundleCollectorGroup group, AssetBundleCollector collector)
|
private void RefreshFoldoutName(Foldout foldout, ECollectorType collectorType, int elementNumber = -1)
|
||||||
{
|
{
|
||||||
|
if (collectorType == ECollectorType.MainAssetCollector)
|
||||||
|
{
|
||||||
|
if (elementNumber >= 0)
|
||||||
|
foldout.text = $"Main Assets ({elementNumber})";
|
||||||
|
else
|
||||||
|
foldout.text = $"Main Assets";
|
||||||
|
}
|
||||||
|
else if (collectorType == ECollectorType.StaticAssetCollector)
|
||||||
|
{
|
||||||
|
if (elementNumber >= 0)
|
||||||
|
foldout.text = $"Static Assets ({elementNumber})";
|
||||||
|
else
|
||||||
|
foldout.text = $"Static Assets";
|
||||||
|
}
|
||||||
|
else if (collectorType == ECollectorType.DependAssetCollector)
|
||||||
|
{
|
||||||
|
if (elementNumber >= 0)
|
||||||
|
foldout.text = $"Depend Assets ({elementNumber})";
|
||||||
|
else
|
||||||
|
foldout.text = $"Depend Assets";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException(collectorType.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void RefreshFoldoutContent(Foldout foldout, AssetBundleCollectorGroup group, AssetBundleCollector collector)
|
||||||
|
{
|
||||||
|
RefreshFoldoutName(foldout, collector.CollectorType);
|
||||||
|
|
||||||
|
// 折叠栏不可见
|
||||||
|
if (foldout.value == false)
|
||||||
|
{
|
||||||
|
foldout.Clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 清空旧元素
|
// 清空旧元素
|
||||||
foldout.Clear();
|
foldout.Clear();
|
||||||
|
|
||||||
|
// 检测配置是否有效
|
||||||
if (collector.IsValid() == false)
|
if (collector.IsValid() == false)
|
||||||
{
|
{
|
||||||
collector.CheckConfigError();
|
collector.CheckConfigError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (collector.CollectorType == ECollectorType.MainAssetCollector || collector.CollectorType == ECollectorType.StaticAssetCollector)
|
List<CollectAssetInfo> collectAssetInfos = null;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
List<CollectAssetInfo> collectAssetInfos = null;
|
IIgnoreRule ignoreRule = AssetBundleCollectorSettingData.GetIgnoreRuleInstance(_ignoreRulePopupField.value.ClassName);
|
||||||
|
string packageName = _packageNameTxt.value;
|
||||||
|
var command = new CollectCommand(packageName, ignoreRule);
|
||||||
|
command.SimulateBuild = true;
|
||||||
|
command.UniqueBundleName = _uniqueBundleNameToogle.value;
|
||||||
|
command.UseAssetDependencyDB = true;
|
||||||
|
command.EnableAddressable = _enableAddressableToogle.value;
|
||||||
|
command.LocationToLower = _locationToLowerToogle.value;
|
||||||
|
command.IncludeAssetGUID = _includeAssetGUIDToogle.value;
|
||||||
|
command.AutoCollectShaders = _autoCollectShadersToogle.value;
|
||||||
|
|
||||||
try
|
collector.CheckConfigError();
|
||||||
|
collectAssetInfos = collector.GetAllCollectAssets(command, group);
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError(e.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (collectAssetInfos != null)
|
||||||
|
{
|
||||||
|
bool showAdress = false;
|
||||||
|
if (_enableAddressableToogle.value && collector.CollectorType == ECollectorType.MainAssetCollector)
|
||||||
|
showAdress = true;
|
||||||
|
|
||||||
|
RefreshFoldoutName(foldout, collector.CollectorType, collectAssetInfos.Count);
|
||||||
|
foreach (var collectAsset in collectAssetInfos)
|
||||||
{
|
{
|
||||||
IIgnoreRule ignoreRule = AssetBundleCollectorSettingData.GetIgnoreRuleInstance(_ignoreRulePopupField.value.ClassName);
|
VisualElement elementRow = new VisualElement();
|
||||||
string packageName = _packageNameTxt.value;
|
elementRow.style.flexDirection = FlexDirection.Row;
|
||||||
var command = new CollectCommand(packageName, ignoreRule);
|
foldout.Add(elementRow);
|
||||||
command.SimulateBuild = true;
|
|
||||||
command.UniqueBundleName = _uniqueBundleNameToogle.value;
|
|
||||||
command.UseAssetDependencyDB = true;
|
|
||||||
command.EnableAddressable = _enableAddressableToogle.value;
|
|
||||||
command.LocationToLower = _locationToLowerToogle.value;
|
|
||||||
command.IncludeAssetGUID = _includeAssetGUIDToogle.value;
|
|
||||||
command.AutoCollectShaders = _autoCollectShadersToogle.value;
|
|
||||||
|
|
||||||
collector.CheckConfigError();
|
string showInfo = collectAsset.AssetInfo.AssetPath;
|
||||||
collectAssetInfos = collector.GetAllCollectAssets(command, group);
|
if (showAdress)
|
||||||
}
|
showInfo = $"[{collectAsset.Address}] {collectAsset.AssetInfo.AssetPath}";
|
||||||
catch (System.Exception e)
|
|
||||||
{
|
|
||||||
Debug.LogError(e.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (collectAssetInfos != null)
|
var label = new Label();
|
||||||
{
|
label.text = showInfo;
|
||||||
foreach (var collectAsset in collectAssetInfos)
|
label.style.width = 300;
|
||||||
{
|
label.style.marginLeft = 0;
|
||||||
VisualElement elementRow = new VisualElement();
|
label.style.flexGrow = 1;
|
||||||
elementRow.style.flexDirection = FlexDirection.Row;
|
elementRow.Add(label);
|
||||||
foldout.Add(elementRow);
|
|
||||||
|
|
||||||
string showInfo = collectAsset.AssetInfo.AssetPath;
|
|
||||||
if (_enableAddressableToogle.value)
|
|
||||||
showInfo = $"[{collectAsset.Address}] {collectAsset.AssetInfo.AssetPath}";
|
|
||||||
|
|
||||||
var label = new Label();
|
|
||||||
label.text = showInfo;
|
|
||||||
label.style.width = 300;
|
|
||||||
label.style.marginLeft = 0;
|
|
||||||
label.style.flexGrow = 1;
|
|
||||||
elementRow.Add(label);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user