update editor windows

pull/189/head
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 Builder", false, 102)]
public static void OpenWindow()
{
string windowName = Localization.Language(ELanguageKey.ABB_WindowTitle);
AssetBundleBuilderWindow window = GetWindow<AssetBundleBuilderWindow>(windowName, true, WindowsDefine.DockedWindowTypes);
AssetBundleBuilderWindow window = GetWindow<AssetBundleBuilderWindow>("AssetBundle Builder", true, WindowsDefine.DockedWindowTypes);
window.minSize = new Vector2(800, 600);
}
@ -48,7 +47,7 @@ namespace YooAsset.Editor
if (packageNames.Count == 0)
{
var label = new Label();
label.text = Localization.Language(ELanguageKey.AAB_NoPackageTips);
label.text = "Not found any package";
label.style.width = 100;
_toolbar.Add(label);
return;

View File

@ -85,7 +85,7 @@ namespace YooAsset.Editor
public void PackAsset(BuildAssetInfo assetInfo)
{
if (IsContainsAsset(assetInfo.AssetPath))
throw new System.Exception($"Asset is existed : {assetInfo.AssetPath}");
throw new System.Exception($"Should never get here ! Asset is existed : {assetInfo.AssetPath}");
MainAssets.Add(assetInfo);
}

View File

@ -31,11 +31,13 @@ namespace YooAsset.Editor
buildReport.Summary.BuildMode = buildParameters.BuildMode;
buildReport.Summary.BuildPackageName = buildParameters.PackageName;
buildReport.Summary.BuildPackageVersion = buildParameters.PackageVersion;
buildReport.Summary.UniqueBundleName = buildMapContext.Command.UniqueBundleName;
buildReport.Summary.EnableAddressable = buildMapContext.Command.EnableAddressable;
buildReport.Summary.LocationToLower = buildMapContext.Command.LocationToLower;
buildReport.Summary.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
buildReport.Summary.UniqueBundleName = buildMapContext.Command.UniqueBundleName;
buildReport.Summary.EncryptionServicesClassName = buildParameters.EncryptionServices == null ?
buildReport.Summary.IgnoreDefaultType = buildMapContext.Command.IgnoreDefaultType;
buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
buildReport.Summary.EncryptionClassName = buildParameters.EncryptionServices == null ?
"null" : buildParameters.EncryptionServices.GetType().FullName;
// 构建参数

View File

@ -66,7 +66,7 @@ namespace YooAsset.Editor
var buildModeList = GetSupportBuildModes();
int defaultIndex = buildModeList.FindIndex(x => x.Equals(buildMode));
_buildModeField = new PopupField<Enum>(buildModeList, defaultIndex);
_buildModeField.label = "ABB_BuildMode";
_buildModeField.label = "Build Mode";
_buildModeField.style.width = StyleWidth;
_buildModeField.RegisterValueChangedCallback(evt =>
{
@ -84,7 +84,7 @@ namespace YooAsset.Editor
var encyptionClassName = AssetBundleBuilderSetting.GetPackageEncyptionClassName(PackageName, BuildPipeline);
int defaultIndex = encryptionClassTypes.FindIndex(x => x.FullName.Equals(encyptionClassName));
_encryptionField = new PopupField<Type>(encryptionClassTypes, defaultIndex);
_encryptionField.label = "ABB_Encryption";
_encryptionField.label = "Encryption";
_encryptionField.style.width = StyleWidth;
_encryptionField.RegisterValueChangedCallback(evt =>
{
@ -95,7 +95,7 @@ namespace YooAsset.Editor
else
{
_encryptionField = new PopupField<Type>();
_encryptionField.label = "ABB_Encryption";
_encryptionField.label = "Encryption";
_encryptionField.style.width = StyleWidth;
encryptionContainer.Add(_encryptionField);
}
@ -147,17 +147,6 @@ namespace YooAsset.Editor
// 构建按钮
var buildButton = Root.Q<Button>("Build");
buildButton.clicked += BuildButton_clicked;
// 本地化设置
UIElementsLocalize.Localize(_buildOutputField);
UIElementsLocalize.Localize(_buildVersionField);
UIElementsLocalize.Localize(_buildModeField);
UIElementsLocalize.Localize(_encryptionField);
UIElementsLocalize.Localize(_compressionField);
UIElementsLocalize.Localize(_outputNameStyleField);
UIElementsLocalize.Localize(_copyBuildinFileOptionField);
UIElementsLocalize.Localize(_copyBuildinFileTagsField);
UIElementsLocalize.Localize(buildButton);
}
private void RefreshView()
{

View File

@ -1,14 +1,14 @@
<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">
<ui:VisualElement name="BuildContainer">
<ui:TextField picking-mode="Ignore" label="ABB_BuildOutput" name="BuildOutput" />
<ui:TextField picking-mode="Ignore" label="ABB_BuildVersion" name="BuildVersion" />
<ui:TextField picking-mode="Ignore" label="Build Output" name="BuildOutput" />
<ui:TextField picking-mode="Ignore" label="Build Version" name="BuildVersion" />
<ui:VisualElement name="BuildModeContainer" style="height: 24px;" />
<ui:VisualElement name="EncryptionContainer" style="height: 24px;" />
<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_CopyBuildinFileParam" name="CopyBuildinFileParam" />
<uie:EnumField label="Compression" value="Center" name="Compression" />
<uie:EnumField label="File Name Style" value="Center" name="FileNameStyle" />
<uie:EnumField label="Copy Buildin File Option" value="Center" name="CopyBuildinFileOption" />
<ui:TextField picking-mode="Ignore" label="Copy Buildin File Param" 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:Button text="Click Build" display-tooltip-when-elided="true" name="Build" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
</ui:VisualElement>
</ui:UXML>

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>

View File

@ -15,7 +15,7 @@ namespace YooAsset.Editor
[MenuItem("YooAsset/AssetBundle Debugger", false, 104)]
public static void OpenWindow()
{
AssetBundleDebuggerWindow wnd = GetWindow<AssetBundleDebuggerWindow>("资源包调试工具", true, WindowsDefine.DockedWindowTypes);
AssetBundleDebuggerWindow wnd = GetWindow<AssetBundleDebuggerWindow>("AssetBundle Debugger", true, WindowsDefine.DockedWindowTypes);
wnd.minSize = new Vector2(800, 600);
}

View File

@ -1,10 +1,10 @@
<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="TopToolbar" style="display: flex;">
<ui:Label text="Player" display-tooltip-when-elided="true" name="PlayerName" style="width: 200px; -unity-text-align: middle-left; padding-left: 5px;" />
<ui:Label text="Player" display-tooltip-when-elided="true" name="PlayerName" style="width: 200px; -unity-text-align: lower-left; padding-left: 5px;" />
<uie:ToolbarMenu display-tooltip-when-elided="true" name="ViewModeMenu" text="ViewMode" style="width: 100px; flex-grow: 0;" />
<uie:ToolbarSearchField focusable="true" name="SearchField" style="flex-grow: 1;" />
<uie:ToolbarButton text="刷新" display-tooltip-when-elided="true" name="SampleButton" style="width: 70px; background-color: rgb(15, 118, 31); -unity-text-align: middle-center; border-top-left-radius: 2px; border-bottom-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-left-width: 1px; border-right-width: 1px;" />
<uie:ToolbarButton text="导出" display-tooltip-when-elided="true" name="ExportButton" style="width: 70px; background-color: rgb(15, 118, 31); -unity-text-align: middle-center; border-top-left-radius: 2px; border-bottom-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-left-width: 1px; border-right-width: 1px;" />
<uie:ToolbarButton text="Refresh" display-tooltip-when-elided="true" name="SampleButton" style="width: 70px; background-color: rgb(15, 118, 31); -unity-text-align: middle-center; border-top-left-radius: 2px; border-bottom-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-left-width: 1px; border-right-width: 1px;" />
<uie:ToolbarButton text="Export" display-tooltip-when-elided="true" name="ExportButton" style="width: 70px; background-color: rgb(15, 118, 31); -unity-text-align: middle-center; border-top-left-radius: 2px; border-bottom-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-left-width: 1px; border-right-width: 1px;" />
</uie:Toolbar>
<uie:Toolbar name="FrameToolbar">
<ui:SliderInt picking-mode="Ignore" label="Frame:" value="42" high-value="100" name="FrameSlider" style="flex-grow: 1;" />

View File

@ -12,7 +12,7 @@ namespace YooAsset.Editor
[MenuItem("YooAsset/AssetBundle Reporter", false, 103)]
public static void OpenWindow()
{
AssetBundleReporterWindow window = GetWindow<AssetBundleReporterWindow>("资源包报告工具", true, WindowsDefine.DockedWindowTypes);
AssetBundleReporterWindow window = GetWindow<AssetBundleReporterWindow>("AssetBundle Reporter", true, WindowsDefine.DockedWindowTypes);
window.minSize = new Vector2(800, 600);
}

View File

@ -2,6 +2,6 @@
<uie:Toolbar name="Toolbar" style="display: flex;">
<uie:ToolbarMenu display-tooltip-when-elided="true" name="ViewModeMenu" text="ViewMode" style="width: 100px; flex-grow: 0;" />
<uie:ToolbarSearchField focusable="true" name="SearchField" style="width: 300px; flex-grow: 1;" />
<ui:Button text="导入" display-tooltip-when-elided="true" name="ImportButton" 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);" />
</uie:Toolbar>
</ui:UXML>

View File

@ -53,32 +53,16 @@ namespace YooAsset.Editor
/// </summary>
public string BuildPackageVersion;
/// <summary>
/// 启用可寻址资源定位
/// </summary>
public bool EnableAddressable;
/// <summary>
/// 资源定位地址大小写不敏感
/// </summary>
public bool LocationToLower;
/// <summary>
/// 包含资源GUID数据
/// </summary>
public bool IncludeAssetGUID;
/// <summary>
/// 资源包名唯一化
/// </summary>
// 收集器配置
public bool UniqueBundleName;
/// <summary>
/// 加密服务类名称
/// </summary>
public string EncryptionServicesClassName;
public bool EnableAddressable;
public bool LocationToLower;
public bool IncludeAssetGUID;
public bool IgnoreDefaultType;
public bool AutoCollectShaders;
// 构建参数
public string EncryptionClassName;
public EFileNameStyle FileNameStyle;
public ECompressOption CompressOption;
public bool DisableWriteTypeTree;

View File

@ -1,4 +1,4 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements">
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
<ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;">
<uie:Toolbar name="TopBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
<uie:ToolbarButton text="Asset Path" display-tooltip-when-elided="true" name="TopBar1" style="width: 280px; -unity-text-align: middle-left; flex-grow: 1;" />
@ -9,8 +9,8 @@
<ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex;">
<uie:Toolbar name="BottomBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
<uie:ToolbarButton text="Depend Bundles" display-tooltip-when-elided="true" name="BottomBar1" style="width: 280px; -unity-text-align: middle-left; flex-grow: 1;" />
<uie:ToolbarButton text="Size" display-tooltip-when-elided="true" name="BottomBar2" style="width: 100px; -unity-text-align: middle-left; flex-grow: 0;" />
<uie:ToolbarButton text="Hash" display-tooltip-when-elided="true" name="BottomBar3" style="width: 280px; -unity-text-align: middle-left;" />
<uie:ToolbarButton text="File Size" display-tooltip-when-elided="true" name="BottomBar2" style="width: 100px; -unity-text-align: middle-left; flex-grow: 0;" />
<uie:ToolbarButton text="File Hash" display-tooltip-when-elided="true" name="BottomBar3" style="width: 280px; -unity-text-align: middle-left;" />
</uie:Toolbar>
<ui:ListView focusable="true" name="BottomListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
</ui:VisualElement>

View File

@ -2,8 +2,8 @@
<ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;">
<uie:Toolbar name="TopBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
<uie:ToolbarButton text="Bundle Name" display-tooltip-when-elided="true" name="TopBar1" style="width: 280px; -unity-text-align: middle-left; flex-grow: 1;" />
<uie:ToolbarButton text="Size" display-tooltip-when-elided="true" name="TopBar2" style="width: 100px; -unity-text-align: middle-left; flex-grow: 0;" />
<uie:ToolbarButton text="Hash" display-tooltip-when-elided="true" name="TopBar3" style="width: 280px; -unity-text-align: middle-left;" />
<uie:ToolbarButton text="File Size" display-tooltip-when-elided="true" name="TopBar2" style="width: 100px; -unity-text-align: middle-left; flex-grow: 0;" />
<uie:ToolbarButton text="File Hash" display-tooltip-when-elided="true" name="TopBar3" style="width: 280px; -unity-text-align: middle-left;" />
<uie:ToolbarButton text="Encrypted" display-tooltip-when-elided="true" name="TopBar4" style="width: 150px; -unity-text-align: middle-left; flex-grow: 0;" />
<uie:ToolbarButton text="Tags" display-tooltip-when-elided="true" name="TopBar5" style="width: 80px; -unity-text-align: middle-left; flex-grow: 1;" />
</uie:Toolbar>

View File

@ -56,38 +56,41 @@ namespace YooAsset.Editor
{
_items.Clear();
_items.Add(new ItemWrapper("YooAsset版本", buildReport.Summary.YooVersion));
_items.Add(new ItemWrapper("引擎版本", buildReport.Summary.UnityVersion));
_items.Add(new ItemWrapper("构建时间", buildReport.Summary.BuildDate));
_items.Add(new ItemWrapper("构建耗时", ConvertTime(buildReport.Summary.BuildSeconds)));
_items.Add(new ItemWrapper("构建平台", $"{buildReport.Summary.BuildTarget}"));
_items.Add(new ItemWrapper("构建管线", $"{buildReport.Summary.BuildPipeline}"));
_items.Add(new ItemWrapper("构建模式", $"{buildReport.Summary.BuildMode}"));
_items.Add(new ItemWrapper("包裹名称", buildReport.Summary.BuildPackageName));
_items.Add(new ItemWrapper("包裹版本", buildReport.Summary.BuildPackageVersion));
_items.Add(new ItemWrapper("YooAsset Version", buildReport.Summary.YooVersion));
_items.Add(new ItemWrapper("UnityEngine Version", buildReport.Summary.UnityVersion));
_items.Add(new ItemWrapper("Build Date", buildReport.Summary.BuildDate));
_items.Add(new ItemWrapper("Build Seconds", ConvertTime(buildReport.Summary.BuildSeconds)));
_items.Add(new ItemWrapper("Build Target", $"{buildReport.Summary.BuildTarget}"));
_items.Add(new ItemWrapper("Build Pipeline", $"{buildReport.Summary.BuildPipeline}"));
_items.Add(new ItemWrapper("Build Mode", $"{buildReport.Summary.BuildMode}"));
_items.Add(new ItemWrapper("Package Name", buildReport.Summary.BuildPackageName));
_items.Add(new ItemWrapper("Package Version", buildReport.Summary.BuildPackageVersion));
_items.Add(new ItemWrapper(string.Empty, string.Empty));
_items.Add(new ItemWrapper("启用可寻址资源定位", $"{buildReport.Summary.EnableAddressable}"));
_items.Add(new ItemWrapper("资源定位地址大小写不敏感", $"{buildReport.Summary.LocationToLower}"));
_items.Add(new ItemWrapper("包含资源GUID数据", $"{buildReport.Summary.IncludeAssetGUID}"));
_items.Add(new ItemWrapper("资源包名唯一化", $"{buildReport.Summary.UniqueBundleName}"));
_items.Add(new ItemWrapper("资源加密服务类", buildReport.Summary.EncryptionServicesClassName));
_items.Add(new ItemWrapper("Settings", string.Empty));
_items.Add(new ItemWrapper("Unique Bundle Name", $"{buildReport.Summary.UniqueBundleName}"));
_items.Add(new ItemWrapper("Enable Addressable", $"{buildReport.Summary.EnableAddressable}"));
_items.Add(new ItemWrapper("Location To Lower", $"{buildReport.Summary.LocationToLower}"));
_items.Add(new ItemWrapper("Include Asset GUID", $"{buildReport.Summary.IncludeAssetGUID}"));
_items.Add(new ItemWrapper("Ignore Default Type", $"{buildReport.Summary.IgnoreDefaultType}"));
_items.Add(new ItemWrapper("Auto Collect Shaders", $"{buildReport.Summary.AutoCollectShaders}"));
_items.Add(new ItemWrapper(string.Empty, string.Empty));
_items.Add(new ItemWrapper("构建参数", string.Empty));
_items.Add(new ItemWrapper("Build Params", string.Empty));
_items.Add(new ItemWrapper("Encryption Class Name", buildReport.Summary.EncryptionClassName));
_items.Add(new ItemWrapper("FileNameStyle", $"{buildReport.Summary.FileNameStyle}"));
_items.Add(new ItemWrapper("CompressOption", $"{buildReport.Summary.CompressOption}"));
_items.Add(new ItemWrapper("DisableWriteTypeTree", $"{buildReport.Summary.DisableWriteTypeTree}"));
_items.Add(new ItemWrapper("IgnoreTypeTreeChanges", $"{buildReport.Summary.IgnoreTypeTreeChanges}"));
_items.Add(new ItemWrapper(string.Empty, string.Empty));
_items.Add(new ItemWrapper("构建结果", string.Empty));
_items.Add(new ItemWrapper("构建文件总数", $"{buildReport.Summary.AssetFileTotalCount}"));
_items.Add(new ItemWrapper("主资源总数", $"{buildReport.Summary.MainAssetTotalCount}"));
_items.Add(new ItemWrapper("资源包总数", $"{buildReport.Summary.AllBundleTotalCount}"));
_items.Add(new ItemWrapper("资源包总大小", ConvertSize(buildReport.Summary.AllBundleTotalSize)));
_items.Add(new ItemWrapper("加密资源包总数", $"{buildReport.Summary.EncryptedBundleTotalCount}"));
_items.Add(new ItemWrapper("加密资源包总大小", ConvertSize(buildReport.Summary.EncryptedBundleTotalSize)));
_items.Add(new ItemWrapper("Build Results", string.Empty));
_items.Add(new ItemWrapper("Asset File Total Count", $"{buildReport.Summary.AssetFileTotalCount}"));
_items.Add(new ItemWrapper("Main Asset Total Count", $"{buildReport.Summary.MainAssetTotalCount}"));
_items.Add(new ItemWrapper("All Bundle Total Count", $"{buildReport.Summary.AllBundleTotalCount}"));
_items.Add(new ItemWrapper("All Bundle Total Size", ConvertSize(buildReport.Summary.AllBundleTotalSize)));
_items.Add(new ItemWrapper("Encrypted Bundle Total Count", $"{buildReport.Summary.EncryptedBundleTotalCount}"));
_items.Add(new ItemWrapper("Encrypted Bundle Total Size", ConvertSize(buildReport.Summary.EncryptedBundleTotalSize)));
_listView.Clear();
_listView.ClearSelection();

View File

@ -1,8 +1,8 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="True">
<ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;">
<uie:Toolbar name="TopBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
<uie:ToolbarButton text="概览" display-tooltip-when-elided="true" name="TopBar1" style="width: 200px; -unity-text-align: middle-left; flex-grow: 0;" />
<uie:ToolbarButton text="参数" display-tooltip-when-elided="true" name="TopBar2" style="width: 150px; -unity-text-align: middle-left; flex-grow: 1;" />
<uie:ToolbarButton text="Info" display-tooltip-when-elided="true" name="TopBar1" style="width: 200px; -unity-text-align: middle-left; flex-grow: 0;" />
<uie:ToolbarButton text="Param" display-tooltip-when-elided="true" name="TopBar2" style="width: 150px; -unity-text-align: middle-left; flex-grow: 1;" />
</uie:Toolbar>
<ui:ListView focusable="true" name="ListView" item-height="18" virtualization-method="DynamicHeight" style="flex-grow: 1;" />
</ui:VisualElement>

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 13015ce973f2b96489045e9f305427ac
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@

namespace YooAsset.Editor
{
public interface ILocalization
{
string GetLanguage(ELanguageKey key);
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7a034d1ededabd44dbb1c7b4cf4772f6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,55 +0,0 @@

namespace YooAsset.Editor
{
public enum ELanguageKey
{
None,
// AssetBundleBuilder
ABB_WindowTitle,
AAB_NoPackageTips,
ABB_BuildOutput,
ABB_BuildVersion,
ABB_BuildMode,
ABB_Encryption,
ABB_Compression,
ABB_FileNameStyle,
ABB_CopyBuildinFileOption,
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,
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 5fef97c24f81187488b84dfa60f36d62
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: cd20abe0407ec2f469ee2f8166248262
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,70 +0,0 @@
using System;
using UnityEditor;
using UnityEngine;
namespace YooAsset.Editor
{
public class ChineseSimplified : ILocalization
{
public string GetLanguage(ELanguageKey key)
{
switch (key)
{
case ELanguageKey.None: return "Invalid language";
// AssetBundleBuilder
case ELanguageKey.ABB_WindowTitle: return "资源包构建工具";
case ELanguageKey.AAB_NoPackageTips: return "没有发现可构建的资源包";
case ELanguageKey.ABB_BuildOutput: return "构建输出目录";
case ELanguageKey.ABB_BuildVersion: return "构建版本";
case ELanguageKey.ABB_BuildMode: return "构建模式";
case ELanguageKey.ABB_Encryption: return "加密方法";
case ELanguageKey.ABB_Compression: return "压缩方式";
case ELanguageKey.ABB_FileNameStyle: return "文件命名方式";
case ELanguageKey.ABB_CopyBuildinFileOption: 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:
{
Debug.LogError($"Not found language : {key}");
return string.Empty;
}
}
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 65cd951ca39cd1b469691424350f5bc6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,70 +0,0 @@
using System;
using UnityEditor;
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;
}
}
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 27a994f8cae769f4e9aa986c3ecb5079
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,93 +0,0 @@
using System;
using UnityEditor;
using UnityEngine;
namespace YooAsset.Editor
{
[InitializeOnLoad]
public static class Localization
{
private static readonly string EditorPrefsLanguageKey;
private static ILocalization _localization;
static Localization()
{
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>
private static void CheckContent()
{
foreach (ELanguageKey key in Enum.GetValues(typeof(ELanguageKey)))
{
_localization.GetLanguage(key);
}
}
/// <summary>
/// 字符串转换为枚举类型
/// </summary>
internal static ELanguageKey Convert(string enumName)
{
return (ELanguageKey)Enum.Parse(typeof(ELanguageKey), enumName);
}
/// <summary>
/// 获取多语言内容
/// </summary>
internal static string Language(ELanguageKey key, params object[] args)
{
string content = _localization.GetLanguage(key);
if (args.Length > 0)
return string.Format(content, args);
else
return content;
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 1f2558d1b74a918449486d37aecdd850
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,61 +0,0 @@
#if UNITY_2019_4_OR_NEWER
using System;
using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
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);
element.label = Localization.Language(key);
}
public static void Localize(Button element)
{
ELanguageKey key = Localization.Convert(element.text);
element.text = Localization.Language(key);
}
public static void Localize(EnumField element)
{
ELanguageKey key = Localization.Convert(element.label);
element.label = Localization.Language(key);
}
public static void Localize(PopupField<Enum> element)
{
ELanguageKey key = Localization.Convert(element.label);
element.label = Localization.Language(key);
}
public static void Localize(PopupField<Type> element)
{
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

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 3d4124369e9ae444888b46fa07816908
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: