mirror of https://github.com/tuyoogame/YooAsset
update editor window localization
parent
0c70f27560
commit
f63fcf1227
|
@ -80,7 +80,7 @@ namespace YooAsset.Editor
|
|||
{
|
||||
return result;
|
||||
}
|
||||
throw new Exception($"Not found bundle : {bundleName}");
|
||||
throw new Exception($"Should never get here ! Not found bundle : {bundleName}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace YooAsset.Editor
|
|||
|
||||
// 首包文件拷贝参数
|
||||
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
||||
_copyBuildinFileTagsField = Root.Q<TextField>("CopyBuildinFileTags");
|
||||
_copyBuildinFileTagsField = Root.Q<TextField>("CopyBuildinFileParam");
|
||||
_copyBuildinFileTagsField.SetValueWithoutNotify(buildinFileCopyParams);
|
||||
_copyBuildinFileTagsField.RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<uie:EnumField label="ABB_Compression" value="Center" name="Compression" />
|
||||
<uie:EnumField label="ABB_FileNameStyle" value="Center" name="FileNameStyle" />
|
||||
<uie:EnumField label="ABB_CopyBuildinFileOption" value="Center" name="CopyBuildinFileOption" />
|
||||
<ui:TextField picking-mode="Ignore" label="ABB_CopyBuildinFileTags" name="CopyBuildinFileTags" />
|
||||
<ui:TextField picking-mode="Ignore" label="ABB_CopyBuildinFileParam" name="CopyBuildinFileParam" />
|
||||
<ui:VisualElement name="ExtensionContainer" />
|
||||
<ui:Button text="ABB_ClickBuild" display-tooltip-when-elided="true" name="Build" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
|
||||
</ui:VisualElement>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -15,10 +15,41 @@ namespace YooAsset.Editor
|
|||
ABB_Compression,
|
||||
ABB_FileNameStyle,
|
||||
ABB_CopyBuildinFileOption,
|
||||
ABB_CopyBuildinFileTags,
|
||||
ABB_CopyBuildinFileParam,
|
||||
ABB_ClickBuild,
|
||||
|
||||
// AssetBundleCollector
|
||||
ABC_WindowTitle,
|
||||
ABC_GlobalSettings,
|
||||
ABC_PackageSettings,
|
||||
ABC_ShowPackages,
|
||||
ABC_ShowRuleAlias,
|
||||
ABC_UniqueBundleName,
|
||||
ABC_EnableAddressable,
|
||||
ABC_LocationToLower,
|
||||
ABC_IncludeAssetGUID,
|
||||
ABC_IgnoreDefaultType,
|
||||
ABC_AutoCollectShaders,
|
||||
|
||||
ABC_Fix,
|
||||
ABC_Import,
|
||||
ABC_Export,
|
||||
ABC_Save,
|
||||
|
||||
ABC_Packages,
|
||||
ABC_PackageName,
|
||||
ABC_PackageDesc,
|
||||
ABC_Groups,
|
||||
ABC_ActiveRule,
|
||||
ABC_GroupName,
|
||||
ABC_GroupDesc,
|
||||
ABC_GroupTags,
|
||||
ABC_Collectors,
|
||||
ABC_Collector,
|
||||
ABC_UserData,
|
||||
ABC_Tags,
|
||||
|
||||
ABC_HelpBox1,
|
||||
ABC_HelpBox2,
|
||||
}
|
||||
}
|
|
@ -22,10 +22,42 @@ namespace YooAsset.Editor
|
|||
case ELanguageKey.ABB_Compression: return "压缩方式";
|
||||
case ELanguageKey.ABB_FileNameStyle: return "文件命名方式";
|
||||
case ELanguageKey.ABB_CopyBuildinFileOption: return "内置文件拷贝选项";
|
||||
case ELanguageKey.ABB_CopyBuildinFileTags: return "内置文件拷贝参数";
|
||||
case ELanguageKey.ABB_CopyBuildinFileParam: return "内置文件拷贝参数";
|
||||
case ELanguageKey.ABB_ClickBuild: return "开始构建";
|
||||
|
||||
// AssetBundleCollector
|
||||
case ELanguageKey.ABC_WindowTitle: return "资源包收集工具";
|
||||
case ELanguageKey.ABC_GlobalSettings: return "全局设置";
|
||||
case ELanguageKey.ABC_PackageSettings: return "包裹设置";
|
||||
case ELanguageKey.ABC_ShowPackages: return "显示包裹栏";
|
||||
case ELanguageKey.ABC_ShowRuleAlias: return "显示规则昵称";
|
||||
case ELanguageKey.ABC_UniqueBundleName: return "资源包名唯一化";
|
||||
case ELanguageKey.ABC_EnableAddressable: return "启用可寻址模式";
|
||||
case ELanguageKey.ABC_LocationToLower: return "资源定位地址大小写不敏感";
|
||||
case ELanguageKey.ABC_IncludeAssetGUID: return "包含资源GUID";
|
||||
case ELanguageKey.ABC_IgnoreDefaultType: return "忽略引擎无法识别的类型";
|
||||
case ELanguageKey.ABC_AutoCollectShaders: return "自动收集着色器";
|
||||
|
||||
case ELanguageKey.ABC_Fix: return "修复";
|
||||
case ELanguageKey.ABC_Import: return "导入";
|
||||
case ELanguageKey.ABC_Export: return "导出";
|
||||
case ELanguageKey.ABC_Save: return "保存";
|
||||
|
||||
case ELanguageKey.ABC_Packages: return "包裹列表";
|
||||
case ELanguageKey.ABC_PackageName: return "包裹名称";
|
||||
case ELanguageKey.ABC_PackageDesc: return "包裹介绍";
|
||||
case ELanguageKey.ABC_Groups: return "分组列表";
|
||||
case ELanguageKey.ABC_ActiveRule: return "激活规则";
|
||||
case ELanguageKey.ABC_GroupName: return "分组名称";
|
||||
case ELanguageKey.ABC_GroupDesc: return "分组介绍";
|
||||
case ELanguageKey.ABC_GroupTags: return "资源标签";
|
||||
case ELanguageKey.ABC_Collectors: return "收集器列表";
|
||||
case ELanguageKey.ABC_Collector: return "收集器";
|
||||
case ELanguageKey.ABC_UserData: return "用户数据";
|
||||
case ELanguageKey.ABC_Tags: return "资源标签";
|
||||
|
||||
case ELanguageKey.ABC_HelpBox1: return "无法同时开启[Enable Addressable]选项和[Location To Lower]选项";
|
||||
case ELanguageKey.ABC_HelpBox2: return "检测到当前配置存在多个Package,建议开启[Unique Bundle Name]选项";
|
||||
|
||||
default:
|
||||
{
|
||||
|
|
|
@ -4,4 +4,67 @@ using UnityEngine;
|
|||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
public class English : ILocalization
|
||||
{
|
||||
public string GetLanguage(ELanguageKey key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case ELanguageKey.None: return "Invalid language";
|
||||
|
||||
// AssetBundleBuilder
|
||||
case ELanguageKey.ABB_WindowTitle: return "Asset Bundle Builder";
|
||||
case ELanguageKey.AAB_NoPackageTips: return "Not found nny package";
|
||||
case ELanguageKey.ABB_BuildOutput: return "Build Output";
|
||||
case ELanguageKey.ABB_BuildVersion: return "Build Version";
|
||||
case ELanguageKey.ABB_BuildMode: return "Build Mode";
|
||||
case ELanguageKey.ABB_Encryption: return "Encryption";
|
||||
case ELanguageKey.ABB_Compression: return "Compression";
|
||||
case ELanguageKey.ABB_FileNameStyle: return "File Name Style";
|
||||
case ELanguageKey.ABB_CopyBuildinFileOption: return "Copy Buildin File Option";
|
||||
case ELanguageKey.ABB_CopyBuildinFileParam: return "Copy Buildin File Param";
|
||||
case ELanguageKey.ABB_ClickBuild: return "Build";
|
||||
|
||||
// AssetBundleCollector
|
||||
case ELanguageKey.ABC_WindowTitle: return "Asset Bundle Collector";
|
||||
case ELanguageKey.ABC_GlobalSettings: return "Global Settings";
|
||||
case ELanguageKey.ABC_PackageSettings: return "Package Settings";
|
||||
case ELanguageKey.ABC_ShowPackages: return "Show Packages";
|
||||
case ELanguageKey.ABC_ShowRuleAlias: return "Show Rule Alias";
|
||||
case ELanguageKey.ABC_UniqueBundleName: return "Unique Bundle Name";
|
||||
case ELanguageKey.ABC_EnableAddressable: return "Enable Addressable";
|
||||
case ELanguageKey.ABC_LocationToLower: return "Location To Lower";
|
||||
case ELanguageKey.ABC_IncludeAssetGUID: return "Include Asset GUID";
|
||||
case ELanguageKey.ABC_IgnoreDefaultType: return "Ignore Default Type";
|
||||
case ELanguageKey.ABC_AutoCollectShaders: return "Auto Collect Shaders";
|
||||
|
||||
case ELanguageKey.ABC_Fix: return "Fix";
|
||||
case ELanguageKey.ABC_Import: return "Import";
|
||||
case ELanguageKey.ABC_Export: return "Export";
|
||||
case ELanguageKey.ABC_Save: return "Save";
|
||||
|
||||
case ELanguageKey.ABC_Packages: return "Packages";
|
||||
case ELanguageKey.ABC_PackageName: return "Package Name";
|
||||
case ELanguageKey.ABC_PackageDesc: return "Package Desc";
|
||||
case ELanguageKey.ABC_Groups: return "Groups";
|
||||
case ELanguageKey.ABC_ActiveRule: return "Active Rule";
|
||||
case ELanguageKey.ABC_GroupName: return "Group Name";
|
||||
case ELanguageKey.ABC_GroupDesc: return "Group Desc";
|
||||
case ELanguageKey.ABC_GroupTags: return "Asset Tags";
|
||||
case ELanguageKey.ABC_Collectors: return "Collectors";
|
||||
case ELanguageKey.ABC_Collector: return "Collector";
|
||||
case ELanguageKey.ABC_UserData: return "User Data";
|
||||
case ELanguageKey.ABC_Tags: return "Asset Tags";
|
||||
|
||||
case ELanguageKey.ABC_HelpBox1: return "The [Enable Addressable] option and [Location To Lower] option cannot be enabled at the same time.";
|
||||
case ELanguageKey.ABC_HelpBox2: return "There are multiple Packages in the current config, Recommended to enable the [Unique Bundle Name] option.";
|
||||
|
||||
default:
|
||||
{
|
||||
Debug.LogError($"Not found language : {key}");
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,17 +5,60 @@ using UnityEngine;
|
|||
namespace YooAsset.Editor
|
||||
{
|
||||
[InitializeOnLoad]
|
||||
internal static class Localization
|
||||
public static class Localization
|
||||
{
|
||||
private static readonly string EditorPrefsLanguageKey;
|
||||
private static ILocalization _localization;
|
||||
|
||||
static Localization()
|
||||
{
|
||||
var types = EditorTools.GetAssignableTypes(typeof(ILocalization));
|
||||
_localization = (ILocalization)Activator.CreateInstance(types[0]);
|
||||
EditorPrefsLanguageKey = $"{Application.productName}_yoo_language";
|
||||
|
||||
// 创建本地化实例类
|
||||
var classType = GetDefaultLocaleType();
|
||||
_localization = (ILocalization)Activator.CreateInstance(classType);
|
||||
|
||||
// 检测本地化配置
|
||||
CheckContent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 改变本地化语言
|
||||
/// </summary>
|
||||
/// <param name="classType">适配的本地化类</param>
|
||||
public static void ChangeDefaultLocale(System.Type classType)
|
||||
{
|
||||
var localization = (ILocalization)Activator.CreateInstance(classType);
|
||||
if (localization == null)
|
||||
{
|
||||
Debug.LogWarning($"Failed to create {nameof(ILocalization)} instance : {classType.FullName}");
|
||||
return;
|
||||
}
|
||||
|
||||
EditorPrefs.SetString(EditorPrefsLanguageKey, classType.FullName);
|
||||
_localization = localization;
|
||||
|
||||
// 检测本地化配置
|
||||
CheckContent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取默认的本地化类
|
||||
/// </summary>
|
||||
private static System.Type GetDefaultLocaleType()
|
||||
{
|
||||
Type englishType = typeof(English);
|
||||
string defaultClassName = EditorPrefs.GetString(EditorPrefsLanguageKey, englishType.FullName);
|
||||
var classTypes = EditorTools.GetAssignableTypes(typeof(ILocalization));
|
||||
Type defaultType = classTypes.Find(x => x.FullName.Equals(defaultClassName));
|
||||
if (defaultType == null)
|
||||
{
|
||||
Debug.LogWarning($"Invalid {nameof(ILocalization)} type : {defaultType}");
|
||||
return englishType;
|
||||
}
|
||||
return defaultType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检测多语言是否配置完整
|
||||
/// </summary>
|
||||
|
@ -30,7 +73,7 @@ namespace YooAsset.Editor
|
|||
/// <summary>
|
||||
/// 字符串转换为枚举类型
|
||||
/// </summary>
|
||||
public static ELanguageKey Convert(string enumName)
|
||||
internal static ELanguageKey Convert(string enumName)
|
||||
{
|
||||
return (ELanguageKey)Enum.Parse(typeof(ELanguageKey), enumName);
|
||||
}
|
||||
|
@ -38,7 +81,7 @@ namespace YooAsset.Editor
|
|||
/// <summary>
|
||||
/// 获取多语言内容
|
||||
/// </summary>
|
||||
public static string Language(ELanguageKey key, params object[] args)
|
||||
internal static string Language(ELanguageKey key, params object[] args)
|
||||
{
|
||||
string content = _localization.GetLanguage(key);
|
||||
if (args.Length > 0)
|
||||
|
|
|
@ -9,6 +9,12 @@ namespace YooAsset.Editor
|
|||
{
|
||||
public static class UIElementsLocalize
|
||||
{
|
||||
public static void Localize(Label element)
|
||||
{
|
||||
ELanguageKey key = Localization.Convert(element.text);
|
||||
element.text = Localization.Language(key);
|
||||
}
|
||||
|
||||
public static void Localize(TextField element)
|
||||
{
|
||||
ELanguageKey key = Localization.Convert(element.label);
|
||||
|
@ -38,6 +44,18 @@ namespace YooAsset.Editor
|
|||
ELanguageKey key = Localization.Convert(element.label);
|
||||
element.label = Localization.Language(key);
|
||||
}
|
||||
|
||||
public static void Localize(PopupField<RuleDisplayName> element)
|
||||
{
|
||||
ELanguageKey key = Localization.Convert(element.label);
|
||||
element.label = Localization.Language(key);
|
||||
}
|
||||
|
||||
public static void Localize(Toggle element)
|
||||
{
|
||||
ELanguageKey key = Localization.Convert(element.label);
|
||||
element.label = Localization.Language(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue