private void DrawValuesAutoComplete(SerializedProperty property, string stringValue) { Dictionary <string, string> localizedStrings = LocalizationImporter.GetLanguageValues(stringValue); if (localizedStrings.Count == 0) { localizedStrings = LocalizationImporter.GetLanguagesContains(stringValue); } showValuesAutoComplete.target = EditorGUILayout.Foldout(showValuesAutoComplete.target, "Auto-Complete"); if (EditorGUILayout.BeginFadeGroup(showValuesAutoComplete.faded)) { EditorGUI.indentLevel++; float height = EditorGUIUtility.singleLineHeight * (Mathf.Min(localizedStrings.Count, 6) + 1); this.scrollValues = EditorGUILayout.BeginScrollView(this.scrollValues, GUILayout.Height(height)); foreach (KeyValuePair <string, string> local in localizedStrings) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(local.Key); if (GUILayout.Button(local.Value, contentStyle)) { property.stringValue = local.Key; this.zhString = local.Value; GUIUtility.hotControl = 0; GUIUtility.keyboardControl = 0; } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); EditorGUI.indentLevel--; } EditorGUILayout.EndFadeGroup(); }
private void DrawAutoComplete(SerializedProperty property) { var localizedStrings = LocalizationImporter.GetLanguagesStartsWith(property.stringValue); if (localizedStrings.Count == 0) { localizedStrings = LocalizationImporter.GetLanguagesContains(property.stringValue); } var selectedLanguage = (int)MultiLanguage.Instance.SelectedLanguage; showAutoComplete.target = EditorGUILayout.Foldout(showAutoComplete.target, "Auto-Complete"); if (EditorGUILayout.BeginFadeGroup(showAutoComplete.faded)) { EditorGUI.indentLevel++; var height = EditorGUIUtility.singleLineHeight * (Mathf.Min(localizedStrings.Count, 6) + 1); scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.Height(height)); foreach (var local in localizedStrings) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(local.Key); if (GUILayout.Button(local.Value[selectedLanguage], "CN CountBadge")) { property.stringValue = local.Key; GUIUtility.hotControl = 0; GUIUtility.keyboardControl = 0; } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); EditorGUI.indentLevel--; } EditorGUILayout.EndFadeGroup(); }