update editor windows

This commit is contained in:
hevinci
2023-10-17 19:03:11 +08:00
parent f63fcf1227
commit d5d5063453
30 changed files with 92 additions and 589 deletions

View File

@@ -14,8 +14,7 @@ namespace YooAsset.Editor
[MenuItem("YooAsset/AssetBundle Collector", false, 101)]
public static void OpenWindow()
{
string windowTitle = Localization.Language(ELanguageKey.ABC_WindowTitle);
AssetBundleCollectorWindow window = GetWindow<AssetBundleCollectorWindow>(windowTitle, true, WindowsDefine.DockedWindowTypes);
AssetBundleCollectorWindow window = GetWindow<AssetBundleCollectorWindow>("AssetBundle Collector", true, WindowsDefine.DockedWindowTypes);
window.minSize = new Vector2(800, 600);
}
@@ -321,7 +320,7 @@ namespace YooAsset.Editor
// 分组激活规则
var activeRuleContainer = root.Q("ActiveRuleContainer");
{
_activeRulePopupField = new PopupField<RuleDisplayName>("ABC_ActiveRule", _activeRuleList, 0);
_activeRulePopupField = new PopupField<RuleDisplayName>("Group Active", _activeRuleList, 0);
_activeRulePopupField.name = "ActiveRuleMaskField";
_activeRulePopupField.style.unityTextAlign = TextAnchor.MiddleLeft;
_activeRulePopupField.formatListItemCallback = FormatListItemCallback;
@@ -340,40 +339,6 @@ namespace YooAsset.Editor
activeRuleContainer.Add(_activeRulePopupField);
}
// 本地化设置
{
UIElementsLocalize.Localize(_globalSettingsButton);
UIElementsLocalize.Localize(_packageSettingsButton);
UIElementsLocalize.Localize(_showPackageToogle);
UIElementsLocalize.Localize(_showEditorAliasToggle);
UIElementsLocalize.Localize(_uniqueBundleNameToogle);
UIElementsLocalize.Localize(_enableAddressableToogle);
UIElementsLocalize.Localize(_locationToLowerToogle);
UIElementsLocalize.Localize(_includeAssetGUIDToogle);
UIElementsLocalize.Localize(_ignoreDefaultTypeToogle);
UIElementsLocalize.Localize(_autoCollectShadersToogle);
}
{
UIElementsLocalize.Localize(fixBtn);
UIElementsLocalize.Localize(importBtn);
UIElementsLocalize.Localize(exportBtn);
UIElementsLocalize.Localize(_saveButton);
}
{
var packageTitle = root.Q<Label>("PackageTitle");
var groupTitle = root.Q<Label>("GroupTitle");
var collectorTitle = root.Q<Label>("CollectorTitle");
UIElementsLocalize.Localize(packageTitle);
UIElementsLocalize.Localize(_packageNameTxt);
UIElementsLocalize.Localize(_packageDescTxt);
UIElementsLocalize.Localize(groupTitle);
UIElementsLocalize.Localize(_groupNameTxt);
UIElementsLocalize.Localize(_groupDescTxt);
UIElementsLocalize.Localize(_groupTagsTxt);
UIElementsLocalize.Localize(collectorTitle);
UIElementsLocalize.Localize(_activeRulePopupField);
}
// 刷新窗体
RefreshWindow();
}
@@ -498,7 +463,7 @@ namespace YooAsset.Editor
var selectPackage = _packageListView.selectedItem as AssetBundleCollectorPackage;
if (selectPackage != null)
{
string packageSettingName = Localization.Language(ELanguageKey.ABC_PackageSettings);
string packageSettingName = "Package Settings";
_packageSettingsButton.SetEnabled(true);
_packageSettingsButton.text = $"{packageSettingName} ({selectPackage.PackageName})";
_enableAddressableToogle.SetValueWithoutNotify(selectPackage.EnableAddressable);
@@ -532,14 +497,14 @@ namespace YooAsset.Editor
if (_enableAddressableToogle.value && _locationToLowerToogle.value)
{
string tips = Localization.Language(ELanguageKey.ABC_HelpBox1);
string tips = "The [Enable Addressable] option and [Location To Lower] option cannot be enabled at the same time.";
var helpBox = new HelpBox(tips, HelpBoxMessageType.Error);
_helpBoxContainer.Add(helpBox);
}
if (AssetBundleCollectorSettingData.Setting.Packages.Count > 1 && _uniqueBundleNameToogle.value == false)
{
string tips = Localization.Language(ELanguageKey.ABC_HelpBox2);
string tips = "There are multiple Packages in the current config, Recommended to enable the [Unique Bundle Name] option.";
var helpBox = new HelpBox(tips, HelpBoxMessageType.Warning);
_helpBoxContainer.Add(helpBox);
}
@@ -769,7 +734,7 @@ namespace YooAsset.Editor
{
var objectField = new ObjectField();
objectField.name = "ObjectField1";
objectField.label = Localization.Language(ELanguageKey.ABC_Collector);
objectField.label = "Collector";
objectField.objectType = typeof(UnityEngine.Object);
objectField.style.unityTextAlign = TextAnchor.MiddleLeft;
objectField.style.flexGrow = 1f;
@@ -816,7 +781,7 @@ namespace YooAsset.Editor
{
var textField = new TextField();
textField.name = "TextField0";
textField.label = Localization.Language(ELanguageKey.ABC_UserData);
textField.label = "User Data";
textField.style.width = 200;
elementBottom.Add(textField);
var label = textField.Q<Label>();
@@ -825,7 +790,7 @@ namespace YooAsset.Editor
{
var textField = new TextField();
textField.name = "TextField1";
textField.label = Localization.Language(ELanguageKey.ABC_Tags);
textField.label = "Asset Tags";
textField.style.width = 100;
textField.style.marginLeft = 20;
textField.style.flexGrow = 1;

View File

@@ -1,34 +1,34 @@
<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="ABC_Save" display-tooltip-when-elided="true" name="SaveButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
<ui:Button text="ABC_Export" display-tooltip-when-elided="true" name="ExportButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
<ui:Button text="ABC_Import" display-tooltip-when-elided="true" name="ImportButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
<ui:Button text="ABC_Fix" display-tooltip-when-elided="true" name="FixButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
<ui:Button text="Save" display-tooltip-when-elided="true" name="SaveButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
<ui:Button text="Export" display-tooltip-when-elided="true" name="ExportButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
<ui:Button text="Import" display-tooltip-when-elided="true" name="ImportButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
<ui:Button text="Fix" 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); 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:VisualElement name="GlobalSettingsContainer">
<ui:Button text="ABC_GlobalSettings" name="GlobalSettingsButton" />
<ui:Button text="Global Settings" name="GlobalSettingsButton" />
<ui:VisualElement name="PublicContainer1">
<ui:Toggle label="ABC_ShowPackages" name="ShowPackages" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="ABC_ShowRuleAlias" name="ShowRuleAlias" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="ABC_UniqueBundleName" name="UniqueBundleName" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="Show Packages" name="ShowPackages" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="Show Rule Alias" name="ShowRuleAlias" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="Unique Bundle Name" name="UniqueBundleName" style="width: 196px; -unity-text-align: middle-left;" />
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement name="PackageSettingsContainer">
<ui:Button text="ABC_PackageSettings" display-tooltip-when-elided="true" name="PackageSettingsButton" />
<ui:Button text="Package Settings" display-tooltip-when-elided="true" name="PackageSettingsButton" />
<ui:VisualElement name="PublicContainer2">
<ui:Toggle label="ABC_EnableAddressable" name="EnableAddressable" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="ABC_LocationToLower" name="LocationToLower" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="ABC_IncludeAssetGUID" name="IncludeAssetGUID" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="ABC_IgnoreDefaultType" name="IgnoreDefaultType" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="ABC_AutoCollectShaders" name="AutoCollectShaders" value="true" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="Enable Addressable" name="EnableAddressable" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="Location To Lower" name="LocationToLower" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="Include Asset GUID" name="IncludeAssetGUID" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="Ignore Default Type" name="IgnoreDefaultType" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="Auto Collect Shaders" name="AutoCollectShaders" value="true" style="width: 196px; -unity-text-align: middle-left;" />
</ui:VisualElement>
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement name="ContentContainer" style="flex-grow: 1; flex-direction: row;">
<ui:VisualElement name="PackageContainer" 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:Label text="ABC_Packages" display-tooltip-when-elided="true" name="PackageTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
<ui:Label text="Packages" display-tooltip-when-elided="true" name="PackageTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
<ui:ListView focusable="true" name="PackageListView" item-height="20" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
<ui:VisualElement name="PackageAddContainer" style="height: 20px; flex-direction: row; justify-content: center;">
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
@@ -36,9 +36,9 @@
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement name="GroupContainer" 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:Label text="ABC_Groups" display-tooltip-when-elided="true" name="GroupTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
<ui:TextField picking-mode="Ignore" label="ABC_PackageName" value="filler text" name="PackageName" style="flex-direction: column;" />
<ui:TextField picking-mode="Ignore" label="ABC_PackageDesc" value="filler text" name="PackageDesc" style="flex-direction: column;" />
<ui:Label text="Groups" display-tooltip-when-elided="true" name="GroupTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
<ui:TextField picking-mode="Ignore" label="Package Name" value="filler text" name="PackageName" style="flex-direction: column;" />
<ui:TextField picking-mode="Ignore" label="Package Desc" value="filler text" name="PackageDesc" style="flex-direction: column;" />
<ui:ListView focusable="true" name="GroupListView" item-height="20" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
<ui:VisualElement name="GroupAddContainer" style="height: 20px; flex-direction: row; justify-content: center;">
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
@@ -46,11 +46,11 @@
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement name="CollectorContainer" style="flex-grow: 1; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
<ui:Label text="ABC_Collectors" display-tooltip-when-elided="true" name="CollectorTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
<ui:Label text="Collectors" display-tooltip-when-elided="true" name="CollectorTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
<ui:VisualElement name="ActiveRuleContainer" style="height: 20px;" />
<ui:TextField picking-mode="Ignore" label="ABC_GroupName" name="GroupName" />
<ui:TextField picking-mode="Ignore" label="ABC_GroupDesc" name="GroupDesc" />
<ui:TextField picking-mode="Ignore" label="ABC_GroupTags" name="GroupTags" />
<ui:TextField picking-mode="Ignore" label="Group Name" name="GroupName" />
<ui:TextField picking-mode="Ignore" label="Group Desc" name="GroupDesc" />
<ui:TextField picking-mode="Ignore" label="Asset Tags" name="GroupTags" />
<ui:VisualElement name="CollectorAddContainer" style="height: 20px; flex-direction: row-reverse;">
<ui:Button text="[ + ]" display-tooltip-when-elided="true" name="AddBtn" />
</ui:VisualElement>