Skip to content

Commit

Permalink
Update AssetBundleCollector
Browse files Browse the repository at this point in the history
增加配置保存按钮。
  • Loading branch information
gmhevinci committed Jul 18, 2022
1 parent c656765 commit 669339d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static void ShowExample()
window.minSize = new Vector2(800, 600);
}

private Button _saveButton;
private List<string> _collectorTypeList;
private List<string> _activeRuleList;
private List<string> _addressRuleList;
Expand Down Expand Up @@ -69,6 +70,10 @@ public void CreateGUI()
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 =>
Expand Down Expand Up @@ -193,6 +198,22 @@ public void OnDestroy()
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()
{
Expand Down Expand Up @@ -221,6 +242,10 @@ private void ImportBtn_clicked()
RefreshWindow();
}
}
private void SaveBtn_clicked()
{
AssetBundleCollectorSettingData.SaveFile();
}

// 分组列表相关
private void FillGroupViewData()
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Expand Down

0 comments on commit 669339d

Please sign in to comment.