Skip to content

Commit 134c9f9

Browse files
committed
fix: Fix to get all collections from StringTableCollectionBundle
1 parent 0a40ad5 commit 134c9f9

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

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

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ public sealed class StringTableCollectionBundleEditor : UnityEditor.Editor
1313
{
1414
private StringTableCollectionBundle Bundle => target as StringTableCollectionBundle;
1515

16+
private CacheListConverter<DefaultAsset, StringTableCollection> _stringTableCollectionsConverter = null;
17+
public CacheListConverter<DefaultAsset, StringTableCollection> StringTableCollectionsConverter =>
18+
_stringTableCollectionsConverter ??= new CacheListConverter<DefaultAsset, StringTableCollection>(actualConverter: new FolderToCollectionConverter(Bundle));
19+
1620
public override void OnInspectorGUI()
1721
{
1822
DrawDefaultInspector();
@@ -60,9 +64,6 @@ private void DrawToolsWithServiceAccount()
6064
}
6165

6266
private bool _showStringTableCollections = true;
63-
private readonly CacheListConverter<DefaultAsset, StringTableCollection> _stringTableCollectionsConverter =
64-
new CacheListConverter<DefaultAsset, StringTableCollection>(
65-
actualConverter: new FolderToCollectionConverter());
6667

6768
private void DrawStringTableCollections()
6869
{
@@ -80,7 +81,13 @@ private void DrawStringTableCollections()
8081
using var h = new EditorGUILayout.VerticalScope(GUI.skin.box);
8182
using var g = new EditorGUI.DisabledGroupScope(true);
8283

83-
var stringTableCollections = _stringTableCollectionsConverter.Convert(Bundle.TargetFolders);
84+
var stringTableCollections = StringTableCollectionsConverter.Convert(Bundle.TargetFolders);
85+
if (stringTableCollections.Count <= 0)
86+
{
87+
EditorGUILayout.LabelField("No \"StringTableCollection\"s.");
88+
return;
89+
}
90+
8491
foreach (var collection in stringTableCollections)
8592
{
8693
EditorGUILayout.ObjectField(collection, typeof(StringTableCollection), allowSceneObjects: false);
@@ -136,9 +143,16 @@ private ServiceAccountSheetsServiceProvider CreateServiceAccountSheetsServicePro
136143

137144
private sealed class FolderToCollectionConverter : IListConverter<DefaultAsset, StringTableCollection>
138145
{
146+
private readonly StringTableCollectionBundle _bundle;
147+
148+
public FolderToCollectionConverter(StringTableCollectionBundle bundle)
149+
{
150+
_bundle = bundle;
151+
}
152+
139153
public IReadOnlyList<StringTableCollection> Convert(IReadOnlyList<DefaultAsset> list)
140154
{
141-
return AssetFinding.FindAssets<StringTableCollection>(list);
155+
return _bundle.StringTableCollections;
142156
}
143157
}
144158
}

0 commit comments

Comments
 (0)