Skip to content

Commit 0c37649

Browse files
committed
fix: Add "_showStringTableCollections" in StringTableCollectionBundleEditor
1 parent 582cc41 commit 0c37649

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

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

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.IO;
34
using UnityEngine;
45
using UnityEditor;
@@ -14,16 +15,19 @@ public sealed class StringTableCollectionBundleEditor : UnityEditor.Editor
1415

1516
public override void OnInspectorGUI()
1617
{
17-
DrawDefaultInspector();
18-
EditorGUILayout.Space(16);
18+
using (var changeCheck = new EditorGUI.ChangeCheckScope())
19+
{
20+
DrawDefaultInspector();
21+
EditorGUILayout.Space(16);
1922

20-
DrawToolsWithSheetsServiceProvider();
21-
EditorGUILayout.Space(8);
23+
DrawToolsWithSheetsServiceProvider();
24+
EditorGUILayout.Space(8);
2225

23-
DrawToolsWithServiceAccount();
24-
EditorGUILayout.Space(8);
26+
DrawToolsWithServiceAccount();
27+
EditorGUILayout.Space(8);
2528

26-
DrawStringTableCollections();
29+
DrawStringTableCollections(changeCheck.changed);
30+
}
2731
}
2832

2933
private void DrawToolsWithSheetsServiceProvider()
@@ -59,8 +63,9 @@ private void DrawToolsWithServiceAccount()
5963
}
6064

6165
private bool _showStringTableCollections = true;
66+
private IReadOnlyList<StringTableCollection> _stringTableCollectionsCache = new List<StringTableCollection>();
6267

63-
private void DrawStringTableCollections()
68+
private void DrawStringTableCollections(bool guiChanged)
6469
{
6570
var foldoutStyle = new GUIStyle(EditorStyles.foldout)
6671
{
@@ -70,9 +75,15 @@ private void DrawStringTableCollections()
7075
_showStringTableCollections = EditorGUILayout.Foldout(_showStringTableCollections, "Target \"StringTableCollection\"s", foldoutStyle);
7176
if (!_showStringTableCollections)
7277
{
78+
_stringTableCollectionsCache = null;
7379
return;
7480
}
7581

82+
if (_stringTableCollectionsCache == null || guiChanged)
83+
{
84+
_stringTableCollectionsCache = Bundle.StringTableCollections;
85+
}
86+
7687
var stringTableCollections = Bundle.StringTableCollections;
7788
using var h = new EditorGUILayout.VerticalScope(GUI.skin.box);
7889
using var g = new EditorGUI.DisabledGroupScope(true);

0 commit comments

Comments
 (0)