Skip to content

Commit f2c6f0a

Browse files
committed
feat: Display StringTableCollections in Inspector
1 parent ce726ac commit f2c6f0a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Assets/Plugins/LocalizationExtension/Editor/Google/StringTableCollection/StringTableCollectionBundleEditor.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.IO;
33
using UnityEngine;
44
using UnityEditor;
5+
using UnityEditor.Localization;
56
using UnityEditor.Localization.Plugins.Google;
67

78
namespace Tsgcpp.Localization.Extension.Editor.Google
@@ -21,6 +22,8 @@ public override void OnInspectorGUI()
2122

2223
DrawToolsWithServiceAccount();
2324
EditorGUILayout.Space(8);
25+
26+
DrawStringTableCollections();
2427
}
2528

2629
private void DrawToolsWithSheetsServiceProvider()
@@ -55,6 +58,30 @@ private void DrawToolsWithServiceAccount()
5558
}
5659
}
5760

61+
private bool _showStringTableCollections = true;
62+
63+
private void DrawStringTableCollections()
64+
{
65+
var foldoutStyle = new GUIStyle(EditorStyles.foldout)
66+
{
67+
fontStyle = FontStyle.Bold,
68+
};
69+
70+
_showStringTableCollections = EditorGUILayout.Foldout(_showStringTableCollections, "Target \"StringTableCollection\"s", foldoutStyle);
71+
if (!_showStringTableCollections)
72+
{
73+
return;
74+
}
75+
76+
var stringTableCollections = Bundle.StringTableCollections;
77+
using var h = new EditorGUILayout.VerticalScope(GUI.skin.box);
78+
using var g = new EditorGUI.DisabledGroupScope(true);
79+
foreach (var collection in stringTableCollections)
80+
{
81+
EditorGUILayout.ObjectField(collection, typeof(StringTableCollection), allowSceneObjects: false);
82+
}
83+
}
84+
5885
private void PullWithGoogleServiceAccount()
5986
{
6087
var serviceProvider = CreateServiceAccountSheetsServiceProvider();

0 commit comments

Comments
 (0)