update editor window localization

This commit is contained in:
hevinci
2023-10-17 12:03:11 +08:00
parent 0c70f27560
commit f63fcf1227
14 changed files with 279 additions and 54 deletions

View File

@@ -174,7 +174,7 @@ namespace YooAsset.Editor
AssetBundleCollectorSettingData.Setting.UniqueBundleName = uniqueBundleName;
AssetBundleCollectorSettingData.Setting.Packages.AddRange(packages);
AssetBundleCollectorSettingData.SaveFile();
Debug.Log($"导入配置完毕");
Debug.Log($"Asset bundle collector config import complete");
}
/// <summary>
@@ -245,7 +245,7 @@ namespace YooAsset.Editor
// 生成配置文件
xmlDoc.Save(savePath);
Debug.Log($"导出配置完毕");
Debug.Log($"Asset bundle collector config export complete");
}
/// <summary>

View File

@@ -265,7 +265,7 @@ namespace YooAsset.Editor
}
else
{
throw new Exception($"{nameof(IActiveRule)}类型无效{ruleName}");
throw new Exception($"{nameof(IActiveRule)} is invalid{ruleName}");
}
}
public static IAddressRule GetAddressRuleInstance(string ruleName)
@@ -282,7 +282,7 @@ namespace YooAsset.Editor
}
else
{
throw new Exception($"{nameof(IAddressRule)}类型无效{ruleName}");
throw new Exception($"{nameof(IAddressRule)} is invalid{ruleName}");
}
}
public static IPackRule GetPackRuleInstance(string ruleName)
@@ -299,7 +299,7 @@ namespace YooAsset.Editor
}
else
{
throw new Exception($"{nameof(IPackRule)}类型无效{ruleName}");
throw new Exception($"{nameof(IPackRule)} is invalid{ruleName}");
}
}
public static IFilterRule GetFilterRuleInstance(string ruleName)
@@ -316,7 +316,7 @@ namespace YooAsset.Editor
}
else
{
throw new Exception($"{nameof(IFilterRule)}类型无效{ruleName}");
throw new Exception($"{nameof(IFilterRule)} is invalid{ruleName}");
}
}

View File

@@ -14,7 +14,8 @@ namespace YooAsset.Editor
[MenuItem("YooAsset/AssetBundle Collector", false, 101)]
public static void OpenWindow()
{
AssetBundleCollectorWindow window = GetWindow<AssetBundleCollectorWindow>("资源包收集工具", true, WindowsDefine.DockedWindowTypes);
string windowTitle = Localization.Language(ELanguageKey.ABC_WindowTitle);
AssetBundleCollectorWindow window = GetWindow<AssetBundleCollectorWindow>(windowTitle, true, WindowsDefine.DockedWindowTypes);
window.minSize = new Vector2(800, 600);
}
@@ -51,7 +52,7 @@ namespace YooAsset.Editor
private ListView _groupListView;
private TextField _groupNameTxt;
private TextField _groupDescTxt;
private TextField _groupAssetTagsTxt;
private TextField _groupTagsTxt;
private VisualElement _collectorContainer;
private ScrollView _collectorScrollView;
@@ -106,7 +107,7 @@ namespace YooAsset.Editor
AssetBundleCollectorSettingData.ModifyShowPackageView(evt.newValue);
RefreshWindow();
});
_showEditorAliasToggle = root.Q<Toggle>("ShowEditorAlias");
_showEditorAliasToggle = root.Q<Toggle>("ShowRuleAlias");
_showEditorAliasToggle.RegisterValueChangedCallback(evt =>
{
AssetBundleCollectorSettingData.ModifyShowEditorAlias(evt.newValue);
@@ -290,8 +291,8 @@ namespace YooAsset.Editor
});
// 分组的资源标签
_groupAssetTagsTxt = root.Q<TextField>("GroupAssetTags");
_groupAssetTagsTxt.RegisterValueChangedCallback(evt =>
_groupTagsTxt = root.Q<TextField>("GroupTags");
_groupTagsTxt.RegisterValueChangedCallback(evt =>
{
var selectPackage = _packageListView.selectedItem as AssetBundleCollectorPackage;
var selectGroup = _groupListView.selectedItem as AssetBundleCollectorGroup;
@@ -320,7 +321,7 @@ namespace YooAsset.Editor
// 分组激活规则
var activeRuleContainer = root.Q("ActiveRuleContainer");
{
_activeRulePopupField = new PopupField<RuleDisplayName>("Active Rule", _activeRuleList, 0);
_activeRulePopupField = new PopupField<RuleDisplayName>("ABC_ActiveRule", _activeRuleList, 0);
_activeRulePopupField.name = "ActiveRuleMaskField";
_activeRulePopupField.style.unityTextAlign = TextAnchor.MiddleLeft;
_activeRulePopupField.formatListItemCallback = FormatListItemCallback;
@@ -339,6 +340,40 @@ 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();
}
@@ -463,8 +498,9 @@ namespace YooAsset.Editor
var selectPackage = _packageListView.selectedItem as AssetBundleCollectorPackage;
if (selectPackage != null)
{
string packageSettingName = Localization.Language(ELanguageKey.ABC_PackageSettings);
_packageSettingsButton.SetEnabled(true);
_packageSettingsButton.text = $"Package Setting ({selectPackage.PackageName})";
_packageSettingsButton.text = $"{packageSettingName} ({selectPackage.PackageName})";
_enableAddressableToogle.SetValueWithoutNotify(selectPackage.EnableAddressable);
_locationToLowerToogle.SetValueWithoutNotify(selectPackage.LocationToLower);
_includeAssetGUIDToogle.SetValueWithoutNotify(selectPackage.IncludeAssetGUID);
@@ -496,13 +532,15 @@ namespace YooAsset.Editor
if (_enableAddressableToogle.value && _locationToLowerToogle.value)
{
var helpBox = new HelpBox("无法同时开启[Enable Addressable]选项和[Location To Lower]选项", HelpBoxMessageType.Error);
string tips = Localization.Language(ELanguageKey.ABC_HelpBox1);
var helpBox = new HelpBox(tips, HelpBoxMessageType.Error);
_helpBoxContainer.Add(helpBox);
}
if (AssetBundleCollectorSettingData.Setting.Packages.Count > 1 && _uniqueBundleNameToogle.value == false)
{
var helpBox = new HelpBox("检测到当前配置存在多个Package建议开启[Unique Bundle Name]选项", HelpBoxMessageType.Warning);
string tips = Localization.Language(ELanguageKey.ABC_HelpBox2);
var helpBox = new HelpBox(tips, HelpBoxMessageType.Warning);
_helpBoxContainer.Add(helpBox);
}
@@ -654,7 +692,7 @@ namespace YooAsset.Editor
_activeRulePopupField.SetValueWithoutNotify(GetActiveRuleIndex(selectGroup.ActiveRuleName));
_groupNameTxt.SetValueWithoutNotify(selectGroup.GroupName);
_groupDescTxt.SetValueWithoutNotify(selectGroup.GroupDesc);
_groupAssetTagsTxt.SetValueWithoutNotify(selectGroup.AssetTags);
_groupTagsTxt.SetValueWithoutNotify(selectGroup.AssetTags);
FillCollectorViewData();
}
@@ -731,7 +769,7 @@ namespace YooAsset.Editor
{
var objectField = new ObjectField();
objectField.name = "ObjectField1";
objectField.label = "Collector";
objectField.label = Localization.Language(ELanguageKey.ABC_Collector);
objectField.objectType = typeof(UnityEngine.Object);
objectField.style.unityTextAlign = TextAnchor.MiddleLeft;
objectField.style.flexGrow = 1f;
@@ -778,7 +816,7 @@ namespace YooAsset.Editor
{
var textField = new TextField();
textField.name = "TextField0";
textField.label = "UserData";
textField.label = Localization.Language(ELanguageKey.ABC_UserData);
textField.style.width = 200;
elementBottom.Add(textField);
var label = textField.Q<Label>();
@@ -787,7 +825,7 @@ namespace YooAsset.Editor
{
var textField = new TextField();
textField.name = "TextField1";
textField.label = "Tags";
textField.label = Localization.Language(ELanguageKey.ABC_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="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);" />
<ui:Button text="修复" display-tooltip-when-elided="true" name="FixButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
<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);" />
</uie:Toolbar>
<ui:VisualElement name="PublicContainer" style="background-color: rgb(79, 79, 79); flex-direction: column; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
<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="Global Settings" name="GlobalSettingsButton" />
<ui:VisualElement name="PublicContainer1" style="flex-direction: row; flex-wrap: nowrap; height: 28px;">
<ui:Toggle label="Show Packages" name="ShowPackages" style="width: 196px; -unity-text-align: middle-left;" />
<ui:Toggle label="Show Editor Alias" name="ShowEditorAlias" 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:Button text="ABC_GlobalSettings" 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:VisualElement>
</ui:VisualElement>
<ui:VisualElement name="PackageSettingsContainer">
<ui:Button text="Package Settings" display-tooltip-when-elided="true" name="PackageSettingsButton" />
<ui:VisualElement name="PublicContainer2" style="flex-direction: row; flex-wrap: nowrap; height: 28px;">
<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:Button text="ABC_PackageSettings" 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: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="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="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: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="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: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: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="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="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:VisualElement name="ActiveRuleContainer" style="height: 20px;" />
<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="Group Asset Tags" name="GroupAssetTags" />
<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:VisualElement name="CollectorAddContainer" style="height: 20px; flex-direction: row-reverse;">
<ui:Button text="[ + ]" display-tooltip-when-elided="true" name="AddBtn" />
</ui:VisualElement>