@@ -15,19 +15,16 @@ public sealed class StringTableCollectionBundleEditor : UnityEditor.Editor
1515
1616 public override void OnInspectorGUI ( )
1717 {
18- using ( var changeCheck = new EditorGUI . ChangeCheckScope ( ) )
19- {
20- DrawDefaultInspector ( ) ;
21- EditorGUILayout . Space ( 16 ) ;
18+ DrawDefaultInspector ( ) ;
19+ EditorGUILayout . Space ( 16 ) ;
2220
23- DrawToolsWithSheetsServiceProvider ( ) ;
24- EditorGUILayout . Space ( 8 ) ;
21+ DrawToolsWithSheetsServiceProvider ( ) ;
22+ EditorGUILayout . Space ( 8 ) ;
2523
26- DrawToolsWithServiceAccount ( ) ;
27- EditorGUILayout . Space ( 8 ) ;
24+ DrawToolsWithServiceAccount ( ) ;
25+ EditorGUILayout . Space ( 8 ) ;
2826
29- DrawStringTableCollections ( changeCheck . changed ) ;
30- }
27+ DrawStringTableCollections ( ) ;
3128 }
3229
3330 private void DrawToolsWithSheetsServiceProvider ( )
@@ -63,28 +60,20 @@ private void DrawToolsWithServiceAccount()
6360 }
6461
6562 private bool _showStringTableCollections = true ;
66- private IReadOnlyList < StringTableCollection > _stringTableCollectionsCache = new List < StringTableCollection > ( ) ;
63+ private readonly CacheListConverter < DefaultAsset , StringTableCollection > _stringTableCollectionsConverter =
64+ new CacheListConverter < DefaultAsset , StringTableCollection > (
65+ actualConverter : new FolderToCollectionConverter ( ) ) ;
6766
68- private void DrawStringTableCollections ( bool guiChanged )
67+ private void DrawStringTableCollections ( )
6968 {
7069 var foldoutStyle = new GUIStyle ( EditorStyles . foldout )
7170 {
7271 fontStyle = FontStyle . Bold ,
7372 } ;
7473
7574 _showStringTableCollections = EditorGUILayout . Foldout ( _showStringTableCollections , "Target \" StringTableCollection\" s" , foldoutStyle ) ;
76- if ( ! _showStringTableCollections )
77- {
78- _stringTableCollectionsCache = null ;
79- return ;
80- }
81-
82- if ( _stringTableCollectionsCache == null || guiChanged )
83- {
84- _stringTableCollectionsCache = Bundle . StringTableCollections ;
85- }
8675
87- var stringTableCollections = Bundle . StringTableCollections ;
76+ var stringTableCollections = _stringTableCollectionsConverter . Convert ( Bundle . TargetFolders ) ;
8877 using var h = new EditorGUILayout . VerticalScope ( GUI . skin . box ) ;
8978 using var g = new EditorGUI . DisabledGroupScope ( true ) ;
9079 foreach ( var collection in stringTableCollections )
@@ -139,5 +128,13 @@ private ServiceAccountSheetsServiceProvider CreateServiceAccountSheetsServicePro
139128 applicationName : sheetsSesrvicesProvider . ApplicationName ) ;
140129 return provider ;
141130 }
131+
132+ private sealed class FolderToCollectionConverter : IListConverter < DefaultAsset , StringTableCollection >
133+ {
134+ public IReadOnlyList < StringTableCollection > Convert ( IReadOnlyList < DefaultAsset > list )
135+ {
136+ return AssetFinding . FindAssetsInFolders < StringTableCollection > ( list ) ;
137+ }
138+ }
142139 }
143140}
0 commit comments