Update AssetBundleCollector

增加配置保存按钮。
pull/28/head
hevinci 2022-07-18 12:04:46 +08:00
parent c6567650fe
commit 669339d5b4
2 changed files with 26 additions and 0 deletions

View File

@ -18,6 +18,7 @@ namespace YooAsset.Editor
window.minSize = new Vector2(800, 600);
}
private Button _saveButton;
private List<string> _collectorTypeList;
private List<string> _activeRuleList;
private List<string> _addressRuleList;
@ -69,6 +70,10 @@ namespace YooAsset.Editor
var importBtn = root.Q<Button>("ImportButton");
importBtn.clicked += ImportBtn_clicked;
// 配置保存按钮
_saveButton = root.Q<Button>("SaveButton");
_saveButton.clicked += SaveBtn_clicked;
// 公共设置相关
_enableAddressableToogle = root.Q<Toggle>("EnableAddressable");
_enableAddressableToogle.RegisterValueChangedCallback(evt =>
@ -193,6 +198,22 @@ namespace YooAsset.Editor
if (AssetBundleCollectorSettingData.IsDirty)
AssetBundleCollectorSettingData.SaveFile();
}
public void Update()
{
if (_saveButton != null)
{
if (AssetBundleCollectorSettingData.IsDirty)
{
if (_saveButton.enabledSelf == false)
_saveButton.SetEnabled(true);
}
else
{
if (_saveButton.enabledSelf)
_saveButton.SetEnabled(false);
}
}
}
private void RefreshWindow()
{
@ -221,6 +242,10 @@ namespace YooAsset.Editor
RefreshWindow();
}
}
private void SaveBtn_clicked()
{
AssetBundleCollectorSettingData.SaveFile();
}
// 分组列表相关
private void FillGroupViewData()

View File

@ -1,5 +1,6 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" 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);" />
<ui:Button text="导入" display-tooltip-when-elided="true" name="ImportButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
</uie:Toolbar>