Fixed editor window display exception at unity2021

修复工具界面显示异常在Unity2021版本下。
pull/4/head
hevinci 2022-04-24 13:11:19 +08:00
parent a6e94acefb
commit cbf142dbf8
14 changed files with 90 additions and 47 deletions

View File

@ -58,7 +58,9 @@ namespace YooAsset.Editor
{ {
_debugReport = debugReport; _debugReport = debugReport;
_assetListView.Clear(); _assetListView.Clear();
_assetListView.ClearSelection();
_assetListView.itemsSource = FilterViewItems(debugReport, searchKeyWord); _assetListView.itemsSource = FilterViewItems(debugReport, searchKeyWord);
_assetListView.Rebuild();
} }
private List<DebugProviderInfo> FilterViewItems(DebugReport debugReport, string searchKeyWord) private List<DebugProviderInfo> FilterViewItems(DebugReport debugReport, string searchKeyWord)
{ {
@ -250,6 +252,7 @@ namespace YooAsset.Editor
_dependListView.Clear(); _dependListView.Clear();
_dependListView.ClearSelection(); _dependListView.ClearSelection();
_dependListView.itemsSource = providerInfo.BundleInfos; _dependListView.itemsSource = providerInfo.BundleInfos;
_dependListView.Rebuild();
} }
} }
} }

View File

@ -7,7 +7,7 @@
<uie:ToolbarButton text="Ref Count" display-tooltip-when-elided="true" name="TopBar4" style="width: 100px; -unity-text-align: middle-left; flex-grow: 0;" /> <uie:ToolbarButton text="Ref Count" display-tooltip-when-elided="true" name="TopBar4" style="width: 100px; -unity-text-align: middle-left; flex-grow: 0;" />
<uie:ToolbarButton text="Status" display-tooltip-when-elided="true" name="TopBar5" style="width: 120px; -unity-text-align: middle-left;" /> <uie:ToolbarButton text="Status" display-tooltip-when-elided="true" name="TopBar5" style="width: 120px; -unity-text-align: middle-left;" />
</uie:Toolbar> </uie:Toolbar>
<ui:ListView focusable="true" name="TopListView" item-height="18" style="flex-grow: 1;" /> <ui:ListView focusable="true" name="TopListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
</ui:VisualElement> </ui:VisualElement>
<ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex;"> <ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex;">
<uie:Toolbar name="BottomBar" style="height: 25px; margin-left: 1px; margin-right: 1px;"> <uie:Toolbar name="BottomBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
@ -15,6 +15,6 @@
<uie:ToolbarButton text="Ref Count" display-tooltip-when-elided="true" name="BottomBar3" style="width: 100px; -unity-text-align: middle-left;" /> <uie:ToolbarButton text="Ref Count" display-tooltip-when-elided="true" name="BottomBar3" style="width: 100px; -unity-text-align: middle-left;" />
<uie:ToolbarButton text="Status" display-tooltip-when-elided="true" name="BottomBar4" style="width: 120px; -unity-text-align: middle-left;" /> <uie:ToolbarButton text="Status" display-tooltip-when-elided="true" name="BottomBar4" style="width: 120px; -unity-text-align: middle-left;" />
</uie:Toolbar> </uie:Toolbar>
<ui:ListView focusable="true" name="BottomListView" item-height="18" style="flex-grow: 1;" /> <ui:ListView focusable="true" name="BottomListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
</ui:VisualElement> </ui:VisualElement>
</ui:UXML> </ui:UXML>

View File

@ -58,7 +58,9 @@ namespace YooAsset.Editor
{ {
_debugReport = debugReport; _debugReport = debugReport;
_bundleListView.Clear(); _bundleListView.Clear();
_bundleListView.ClearSelection();
_bundleListView.itemsSource = FilterViewItems(debugReport, searchKeyWord); _bundleListView.itemsSource = FilterViewItems(debugReport, searchKeyWord);
_bundleListView.Rebuild();
} }
private List<DebugBundleInfo> FilterViewItems(DebugReport debugReport, string searchKeyWord) private List<DebugBundleInfo> FilterViewItems(DebugReport debugReport, string searchKeyWord)
{ {
@ -250,10 +252,7 @@ namespace YooAsset.Editor
label5.text = providerInfo.Status.ToString(); label5.text = providerInfo.Status.ToString();
} }
private void FillUsingListView(string bundleName) private void FillUsingListView(string bundleName)
{ {
_usingListView.Clear();
_usingListView.ClearSelection();
List<DebugProviderInfo> source = new List<DebugProviderInfo>(); List<DebugProviderInfo> source = new List<DebugProviderInfo>();
foreach (var providerInfo in _debugReport.ProviderInfos) foreach (var providerInfo in _debugReport.ProviderInfos)
{ {
@ -266,7 +265,11 @@ namespace YooAsset.Editor
} }
} }
} }
_usingListView.Clear();
_usingListView.ClearSelection();
_usingListView.itemsSource = source; _usingListView.itemsSource = source;
_usingListView.Rebuild();
} }
} }
} }

View File

@ -5,7 +5,7 @@
<uie:ToolbarButton text="Ref Count" display-tooltip-when-elided="true" name="TopBar3" style="width: 100px; -unity-text-align: middle-left;" /> <uie:ToolbarButton text="Ref Count" display-tooltip-when-elided="true" name="TopBar3" style="width: 100px; -unity-text-align: middle-left;" />
<uie:ToolbarButton text="Status" display-tooltip-when-elided="true" name="TopBar4" style="width: 120px; -unity-text-align: middle-left;" /> <uie:ToolbarButton text="Status" display-tooltip-when-elided="true" name="TopBar4" style="width: 120px; -unity-text-align: middle-left;" />
</uie:Toolbar> </uie:Toolbar>
<ui:ListView focusable="true" name="TopListView" item-height="18" style="flex-grow: 1;" /> <ui:ListView focusable="true" name="TopListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
</ui:VisualElement> </ui:VisualElement>
<ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex;"> <ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex;">
<uie:Toolbar name="BottomBar" style="height: 25px; margin-left: 1px; margin-right: 1px;"> <uie:Toolbar name="BottomBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
@ -15,6 +15,6 @@
<uie:ToolbarButton text="Ref Count" display-tooltip-when-elided="true" name="BottomBar4" style="width: 100px; -unity-text-align: middle-left;" /> <uie:ToolbarButton text="Ref Count" display-tooltip-when-elided="true" name="BottomBar4" style="width: 100px; -unity-text-align: middle-left;" />
<uie:ToolbarButton text="Status" display-tooltip-when-elided="true" name="BottomBar5" style="width: 120px; -unity-text-align: middle-left;" /> <uie:ToolbarButton text="Status" display-tooltip-when-elided="true" name="BottomBar5" style="width: 120px; -unity-text-align: middle-left;" />
</uie:Toolbar> </uie:Toolbar>
<ui:ListView focusable="true" name="BottomListView" item-height="18" style="flex-grow: 1;" /> <ui:ListView focusable="true" name="BottomListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
</ui:VisualElement> </ui:VisualElement>
</ui:UXML> </ui:UXML>

View File

@ -34,6 +34,9 @@ namespace YooAsset.Editor
/// </summary> /// </summary>
public string AssetTags = string.Empty; public string AssetTags = string.Empty;
[NonSerialized]
public object UserData;
/// <summary> /// <summary>
/// 检测配置错误 /// 检测配置错误

View File

@ -22,7 +22,7 @@ namespace YooAsset.Editor
private List<string> _packRuleList; private List<string> _packRuleList;
private List<string> _filterRuleList; private List<string> _filterRuleList;
private ListView _grouperListView; private ListView _grouperListView;
private ListView _collectorListView; private ScrollView _collectorScrollView;
private Toggle _autoCollectShaderToogle; private Toggle _autoCollectShaderToogle;
private TextField _shaderBundleNameTxt; private TextField _shaderBundleNameTxt;
private TextField _grouperNameTxt; private TextField _grouperNameTxt;
@ -61,7 +61,7 @@ namespace YooAsset.Editor
_autoCollectShaderToogle.RegisterValueChangedCallback(evt => _autoCollectShaderToogle.RegisterValueChangedCallback(evt =>
{ {
AssetBundleGrouperSettingData.ModifyShader(evt.newValue, _shaderBundleNameTxt.value); AssetBundleGrouperSettingData.ModifyShader(evt.newValue, _shaderBundleNameTxt.value);
_shaderBundleNameTxt.SetEnabled(evt.newValue); _shaderBundleNameTxt.SetEnabled(evt.newValue);
}); });
_shaderBundleNameTxt = root.Q<TextField>("ShaderBundleName"); _shaderBundleNameTxt = root.Q<TextField>("ShaderBundleName");
_shaderBundleNameTxt.RegisterValueChangedCallback(evt => _shaderBundleNameTxt.RegisterValueChangedCallback(evt =>
@ -126,22 +126,15 @@ namespace YooAsset.Editor
}); });
// 收集列表相关 // 收集列表相关
_collectorListView = root.Q<ListView>("CollectorListView"); _collectorScrollView = root.Q<ScrollView>("CollectorScrollView");
_collectorListView.makeItem = MakeCollectorListViewItem; _collectorScrollView.style.height = new Length(100, LengthUnit.Percent);
_collectorListView.bindItem = BindCollectorListViewItem; _collectorScrollView.viewDataKey = "scrollView";
#if UNITY_2020_1_OR_NEWER
_collectorListView.onSelectionChange += CollectorListView_onSelectionChange;
#else
_collectorListView.onSelectionChanged += CollectorListView_onSelectionChange;
#endif
// 收集添加删除按钮 // 收集器创建按钮
var collectorAddContainer = root.Q("CollectorAddContainer"); var collectorAddContainer = root.Q("CollectorAddContainer");
{ {
var addBtn = collectorAddContainer.Q<Button>("AddBtn"); var addBtn = collectorAddContainer.Q<Button>("AddBtn");
addBtn.clicked += AddCollectorBtn_clicked; addBtn.clicked += AddCollectorBtn_clicked;
var removeBtn = collectorAddContainer.Q<Button>("RemoveBtn");
removeBtn.clicked += RemoveCollectorBtn_clicked;
} }
// 刷新窗体 // 刷新窗体
@ -194,6 +187,7 @@ namespace YooAsset.Editor
_grouperListView.Clear(); _grouperListView.Clear();
_grouperListView.ClearSelection(); _grouperListView.ClearSelection();
_grouperListView.itemsSource = AssetBundleGrouperSettingData.Setting.Groupers; _grouperListView.itemsSource = AssetBundleGrouperSettingData.Setting.Groupers;
_grouperListView.Rebuild();
} }
private VisualElement MakeGrouperListViewItem() private VisualElement MakeGrouperListViewItem()
{ {
@ -251,13 +245,20 @@ namespace YooAsset.Editor
} }
_grouperContainer.visible = true; _grouperContainer.visible = true;
_collectorListView.Clear();
_collectorListView.ClearSelection();
_collectorListView.itemsSource = selectGrouper.Collectors;
_grouperNameTxt.SetValueWithoutNotify(selectGrouper.GrouperName); _grouperNameTxt.SetValueWithoutNotify(selectGrouper.GrouperName);
_grouperDescTxt.SetValueWithoutNotify(selectGrouper.GrouperDesc); _grouperDescTxt.SetValueWithoutNotify(selectGrouper.GrouperDesc);
_grouperAssetTagsTxt.SetValueWithoutNotify(selectGrouper.AssetTags); _grouperAssetTagsTxt.SetValueWithoutNotify(selectGrouper.AssetTags);
// 填充数据
_collectorScrollView.Clear();
for (int i = 0; i < selectGrouper.Collectors.Count; i++)
{
var collector = selectGrouper.Collectors[i];
VisualElement element = MakeCollectorListViewItem();
collector.UserData = element;
BindCollectorListViewItem(element, i);
_collectorScrollView.Add(element);
}
} }
private VisualElement MakeCollectorListViewItem() private VisualElement MakeCollectorListViewItem()
{ {
@ -271,11 +272,15 @@ namespace YooAsset.Editor
elementBottom.style.flexDirection = FlexDirection.Row; elementBottom.style.flexDirection = FlexDirection.Row;
element.Add(elementBottom); element.Add(elementBottom);
VisualElement elementFold = new VisualElement();
elementFold.style.flexDirection = FlexDirection.Row;
element.Add(elementFold);
// Top VisualElement // Top VisualElement
{ {
var objectField = new ObjectField(); var objectField = new ObjectField();
objectField.name = "ObjectField1"; objectField.name = "ObjectField1";
objectField.label = "Collect Path"; objectField.label = "Collecter";
objectField.objectType = typeof(UnityEngine.Object); objectField.objectType = typeof(UnityEngine.Object);
objectField.style.unityTextAlign = TextAnchor.MiddleLeft; objectField.style.unityTextAlign = TextAnchor.MiddleLeft;
objectField.style.flexGrow = 1f; objectField.style.flexGrow = 1f;
@ -283,6 +288,14 @@ namespace YooAsset.Editor
var label = objectField.Q<Label>(); var label = objectField.Q<Label>();
label.style.minWidth = 80; label.style.minWidth = 80;
} }
{
var button = new Button();
button.name = "Button1";
button.text = "[ - ]";
button.style.unityTextAlign = TextAnchor.MiddleCenter;
button.style.flexGrow = 0f;
elementTop.Add(button);
}
// Bottom VisualElement // Bottom VisualElement
{ {
@ -336,6 +349,8 @@ namespace YooAsset.Editor
return; return;
var collector = selectGrouper.Collectors[index]; var collector = selectGrouper.Collectors[index];
collector.UserData = element;
var collectObject = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(collector.CollectPath); var collectObject = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(collector.CollectPath);
if (collectObject != null) if (collectObject != null)
collectObject.name = collector.CollectPath; collectObject.name = collector.CollectPath;
@ -350,6 +365,13 @@ namespace YooAsset.Editor
AssetBundleGrouperSettingData.ModifyCollector(selectGrouper, collector); AssetBundleGrouperSettingData.ModifyCollector(selectGrouper, collector);
}); });
// Remove Button
var removeBtn = element.Q<Button>("Button1");
removeBtn.clicked += ()=>
{
RemoveCollectorBtn_clicked(collector);
};
// Pack Rule // Pack Rule
var popupField1 = element.Q<PopupField<string>>("PopupField1"); var popupField1 = element.Q<PopupField<string>>("PopupField1");
popupField1.index = GetPackRuleIndex(collector.PackRuleName); popupField1.index = GetPackRuleIndex(collector.PackRuleName);
@ -386,9 +408,6 @@ namespace YooAsset.Editor
AssetBundleGrouperSettingData.ModifyCollector(selectGrouper, collector); AssetBundleGrouperSettingData.ModifyCollector(selectGrouper, collector);
}); });
} }
private void CollectorListView_onSelectionChange(IEnumerable<object> objs)
{
}
private void AddCollectorBtn_clicked() private void AddCollectorBtn_clicked()
{ {
var selectGrouper = _grouperListView.selectedItem as AssetBundleGrouper; var selectGrouper = _grouperListView.selectedItem as AssetBundleGrouper;
@ -398,16 +417,13 @@ namespace YooAsset.Editor
AssetBundleGrouperSettingData.CreateCollector(selectGrouper, string.Empty, nameof(PackDirectory), nameof(CollectAll), false); AssetBundleGrouperSettingData.CreateCollector(selectGrouper, string.Empty, nameof(PackDirectory), nameof(CollectAll), false);
FillCollectorViewData(); FillCollectorViewData();
} }
private void RemoveCollectorBtn_clicked() private void RemoveCollectorBtn_clicked(AssetBundleCollector selectCollector)
{ {
var selectGrouper = _grouperListView.selectedItem as AssetBundleGrouper; var selectGrouper = _grouperListView.selectedItem as AssetBundleGrouper;
if (selectGrouper == null) if (selectGrouper == null)
return; return;
var selectCollector = _collectorListView.selectedItem as AssetBundleCollector;
if (selectCollector == null) if (selectCollector == null)
return; return;
AssetBundleGrouperSettingData.RemoveCollector(selectGrouper, selectCollector); AssetBundleGrouperSettingData.RemoveCollector(selectGrouper, selectCollector);
FillCollectorViewData(); FillCollectorViewData();
} }

View File

@ -6,7 +6,7 @@
</uie:Toolbar> </uie:Toolbar>
<ui:VisualElement name="ContentContainer" style="flex-grow: 1; flex-direction: row;"> <ui:VisualElement name="ContentContainer" style="flex-grow: 1; flex-direction: row;">
<ui:VisualElement name="LeftContainer" style="width: 200px; flex-grow: 0; background-color: rgb(67, 67, 67); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;"> <ui:VisualElement name="LeftContainer" style="width: 200px; flex-grow: 0; background-color: rgb(67, 67, 67); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
<ui:ListView focusable="true" name="GrouperListView" item-height="20" style="flex-grow: 1;" /> <ui:ListView focusable="true" name="GrouperListView" item-height="20" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
<ui:VisualElement name="GrouperAddContainer" style="height: 20px; flex-direction: row; justify-content: center;"> <ui:VisualElement name="GrouperAddContainer" style="height: 20px; flex-direction: row; justify-content: center;">
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" /> <ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" /> <ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />
@ -22,10 +22,9 @@
<ui:TextField picking-mode="Ignore" label="Grouper Desc" name="GrouperDesc" /> <ui:TextField picking-mode="Ignore" label="Grouper Desc" name="GrouperDesc" />
<ui:TextField picking-mode="Ignore" label="Grouper Asset Tags" name="GrouperAssetTags" /> <ui:TextField picking-mode="Ignore" label="Grouper Asset Tags" name="GrouperAssetTags" />
<ui:VisualElement name="CollectorAddContainer" style="height: 20px; flex-direction: row-reverse;"> <ui:VisualElement name="CollectorAddContainer" style="height: 20px; flex-direction: row-reverse;">
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" /> <ui:Button text="[ + ]" display-tooltip-when-elided="true" name="AddBtn" />
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />
</ui:VisualElement> </ui:VisualElement>
<ui:ListView focusable="true" name="CollectorListView" item-height="50" style="flex-grow: 1;" /> <ui:ScrollView name="CollectorScrollView" style="flex-grow: 1;" />
</ui:VisualElement> </ui:VisualElement>
</ui:VisualElement> </ui:VisualElement>
</ui:VisualElement> </ui:VisualElement>

View File

@ -77,7 +77,9 @@ namespace YooAsset.Editor
{ {
_buildReport = buildReport; _buildReport = buildReport;
_assetListView.Clear(); _assetListView.Clear();
_assetListView.ClearSelection();
_assetListView.itemsSource = FilterViewItems(buildReport, searchKeyWord); _assetListView.itemsSource = FilterViewItems(buildReport, searchKeyWord);
_assetListView.Rebuild();
_topBar1.text = $"Asset Path ({_assetListView.itemsSource.Count})"; _topBar1.text = $"Asset Path ({_assetListView.itemsSource.Count})";
} }
private List<ReportAssetInfo> FilterViewItems(BuildReport buildReport, string searchKeyWord) private List<ReportAssetInfo> FilterViewItems(BuildReport buildReport, string searchKeyWord)
@ -201,6 +203,7 @@ namespace YooAsset.Editor
_dependListView.Clear(); _dependListView.Clear();
_dependListView.ClearSelection(); _dependListView.ClearSelection();
_dependListView.itemsSource = bundles; _dependListView.itemsSource = bundles;
_dependListView.Rebuild();
_bottomBar1.text = $"Depend Bundles ({bundles.Count})"; _bottomBar1.text = $"Depend Bundles ({bundles.Count})";
} }
private VisualElement MakeDependListViewItem() private VisualElement MakeDependListViewItem()

View File

@ -5,7 +5,7 @@
<uie:ToolbarButton text="Size" display-tooltip-when-elided="true" name="TopBar2" style="width: 100px; -unity-text-align: middle-left; flex-grow: 0;" /> <uie:ToolbarButton text="Size" display-tooltip-when-elided="true" name="TopBar2" style="width: 100px; -unity-text-align: middle-left; flex-grow: 0;" />
<uie:ToolbarButton text="Main Bundle" display-tooltip-when-elided="true" name="TopBar3" style="width: 145px; -unity-text-align: middle-left; flex-grow: 1;" /> <uie:ToolbarButton text="Main Bundle" display-tooltip-when-elided="true" name="TopBar3" style="width: 145px; -unity-text-align: middle-left; flex-grow: 1;" />
</uie:Toolbar> </uie:Toolbar>
<ui:ListView focusable="true" name="TopListView" item-height="18" style="flex-grow: 1;" /> <ui:ListView focusable="true" name="TopListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
</ui:VisualElement> </ui:VisualElement>
<ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex;"> <ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex;">
<uie:Toolbar name="BottomBar" style="height: 25px; margin-left: 1px; margin-right: 1px;"> <uie:Toolbar name="BottomBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
@ -13,6 +13,6 @@
<uie:ToolbarButton text="Size" display-tooltip-when-elided="true" name="BottomBar2" style="width: 100px; -unity-text-align: middle-left; flex-grow: 0;" /> <uie:ToolbarButton text="Size" display-tooltip-when-elided="true" name="BottomBar2" style="width: 100px; -unity-text-align: middle-left; flex-grow: 0;" />
<uie:ToolbarButton text="Hash" display-tooltip-when-elided="true" name="BottomBar3" style="width: 280px; -unity-text-align: middle-left;" /> <uie:ToolbarButton text="Hash" display-tooltip-when-elided="true" name="BottomBar3" style="width: 280px; -unity-text-align: middle-left;" />
</uie:Toolbar> </uie:Toolbar>
<ui:ListView focusable="true" name="BottomListView" item-height="18" style="flex-grow: 1;" /> <ui:ListView focusable="true" name="BottomListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
</ui:VisualElement> </ui:VisualElement>
</ui:UXML> </ui:UXML>

View File

@ -78,7 +78,9 @@ namespace YooAsset.Editor
{ {
_buildReport = buildReport; _buildReport = buildReport;
_bundleListView.Clear(); _bundleListView.Clear();
_bundleListView.ClearSelection();
_bundleListView.itemsSource = FilterViewItems(buildReport, searchKeyWord); _bundleListView.itemsSource = FilterViewItems(buildReport, searchKeyWord);
_bundleListView.Rebuild();
_topBar1.text = $"Bundle Name ({_bundleListView.itemsSource.Count})"; _topBar1.text = $"Bundle Name ({_bundleListView.itemsSource.Count})";
} }
private List<ReportBundleInfo> FilterViewItems(BuildReport buildReport, string searchKeyWord) private List<ReportBundleInfo> FilterViewItems(BuildReport buildReport, string searchKeyWord)
@ -204,6 +206,7 @@ namespace YooAsset.Editor
_includeListView.Clear(); _includeListView.Clear();
_includeListView.ClearSelection(); _includeListView.ClearSelection();
_includeListView.itemsSource = containsList; _includeListView.itemsSource = containsList;
_includeListView.Rebuild();
_bottomBar1.text = $"Include Assets ({containsList.Count})"; _bottomBar1.text = $"Include Assets ({containsList.Count})";
} }
private VisualElement MakeIncludeListViewItem() private VisualElement MakeIncludeListViewItem()

View File

@ -7,7 +7,7 @@
<uie:ToolbarButton text="Hash" display-tooltip-when-elided="true" name="TopBar3" style="width: 280px; -unity-text-align: middle-left;" /> <uie:ToolbarButton text="Hash" display-tooltip-when-elided="true" name="TopBar3" style="width: 280px; -unity-text-align: middle-left;" />
<uie:ToolbarButton text="Tags" display-tooltip-when-elided="true" name="TopBar5" style="width: 80px; -unity-text-align: middle-left; flex-grow: 1;" /> <uie:ToolbarButton text="Tags" display-tooltip-when-elided="true" name="TopBar5" style="width: 80px; -unity-text-align: middle-left; flex-grow: 1;" />
</uie:Toolbar> </uie:Toolbar>
<ui:ListView focusable="true" name="TopListView" item-height="18" style="flex-grow: 1;" /> <ui:ListView focusable="true" name="TopListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
</ui:VisualElement> </ui:VisualElement>
<ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex;"> <ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex;">
<uie:Toolbar name="BottomBar" style="height: 25px; margin-left: 1px; margin-right: 1px;"> <uie:Toolbar name="BottomBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
@ -15,7 +15,7 @@
<uie:ToolbarButton text="Size" display-tooltip-when-elided="true" name="BottomBar2" style="width: 100px; -unity-text-align: middle-left;" /> <uie:ToolbarButton text="Size" display-tooltip-when-elided="true" name="BottomBar2" style="width: 100px; -unity-text-align: middle-left;" />
<uie:ToolbarButton text="GUID" display-tooltip-when-elided="true" name="BottomBar3" style="width: 280px; -unity-text-align: middle-left;" /> <uie:ToolbarButton text="GUID" display-tooltip-when-elided="true" name="BottomBar3" style="width: 280px; -unity-text-align: middle-left;" />
</uie:Toolbar> </uie:Toolbar>
<ui:ListView focusable="true" name="BottomListView" item-height="18" style="flex-grow: 1;" /> <ui:ListView focusable="true" name="BottomListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
</ui:VisualElement> </ui:VisualElement>
</ui:VisualElement> </ui:VisualElement>
</ui:UXML> </ui:UXML>

View File

@ -60,9 +60,8 @@ namespace YooAsset.Editor
public void FillViewData(BuildReport buildReport) public void FillViewData(BuildReport buildReport)
{ {
_buildReport = buildReport; _buildReport = buildReport;
_listView.Clear();
_items.Clear(); _items.Clear();
_items.Add(new ItemWrapper("引擎版本", buildReport.Summary.UnityVersion)); _items.Add(new ItemWrapper("引擎版本", buildReport.Summary.UnityVersion));
_items.Add(new ItemWrapper("构建时间", buildReport.Summary.BuildTime)); _items.Add(new ItemWrapper("构建时间", buildReport.Summary.BuildTime));
_items.Add(new ItemWrapper("构建耗时", $"{buildReport.Summary.BuildSeconds}秒")); _items.Add(new ItemWrapper("构建耗时", $"{buildReport.Summary.BuildSeconds}秒"));
@ -97,7 +96,10 @@ namespace YooAsset.Editor
_items.Add(new ItemWrapper("原生资源包总数", $"{buildReport.Summary.RawBundleTotalCount}")); _items.Add(new ItemWrapper("原生资源包总数", $"{buildReport.Summary.RawBundleTotalCount}"));
_items.Add(new ItemWrapper("原生资源包总大小", ConvertSize(buildReport.Summary.RawBundleTotalSize))); _items.Add(new ItemWrapper("原生资源包总大小", ConvertSize(buildReport.Summary.RawBundleTotalSize)));
_listView.Clear();
_listView.ClearSelection();
_listView.itemsSource = _items; _listView.itemsSource = _items;
_listView.Rebuild();
} }
/// <summary> /// <summary>

View File

@ -4,6 +4,6 @@
<uie:ToolbarButton text="概览" display-tooltip-when-elided="true" name="TopBar1" style="width: 200px; -unity-text-align: middle-left; flex-grow: 0;" /> <uie:ToolbarButton text="概览" display-tooltip-when-elided="true" name="TopBar1" style="width: 200px; -unity-text-align: middle-left; flex-grow: 0;" />
<uie:ToolbarButton text="参数" display-tooltip-when-elided="true" name="TopBar2" style="width: 150px; -unity-text-align: middle-left; flex-grow: 1;" /> <uie:ToolbarButton text="参数" display-tooltip-when-elided="true" name="TopBar2" style="width: 150px; -unity-text-align: middle-left; flex-grow: 1;" />
</uie:Toolbar> </uie:Toolbar>
<ui:ListView focusable="true" name="ListView" item-height="18" style="flex-grow: 1;" /> <ui:ListView focusable="true" name="ListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
</ui:VisualElement> </ui:VisualElement>
</ui:UXML> </ui:UXML>

View File

@ -1,6 +1,7 @@
#if UNITY_2019_4 
namespace YooAsset.Editor namespace YooAsset.Editor
{ {
#if UNITY_2019
public static partial class UnityEngine_UIElements_ListView_Extension public static partial class UnityEngine_UIElements_ListView_Extension
{ {
public static void ClearSelection(this UnityEngine.UIElements.ListView o) public static void ClearSelection(this UnityEngine.UIElements.ListView o)
@ -8,5 +9,15 @@ namespace YooAsset.Editor
o.selectedIndex = -1; o.selectedIndex = -1;
} }
} }
} #endif
#endif
#if UNITY_2019 || UNITY_2020
public static partial class UnityEngine_UIElements_ListView_Extension
{
public static void Rebuild(this UnityEngine.UIElements.ListView o)
{
o.Refresh();
}
}
#endif
}