/// <summary> /// Raises the inspector GUI event. /// </summary> public override void OnInspectorGUI() { bool needsUpdate = false; this.serializedObject.Update(); EditorGUILayout.PropertyField(m_Script); EditorGUI.BeginChangeCheck(); { EditorGUILayout.PropertyField(m_CurrentLocale); EditorGUILayout.PropertyField(m_DefaultText); } if (EditorGUI.EndChangeCheck()) { needsUpdate = true; } if (EditorGUIX.DisplayButton("Add 10 Most Common Languages")) { Undo.RecordObjects(this.targets, "Add 10 Most Common Languages"); foreach (LocalizableText text in this.targets) { text.GetLocaleOverrides(m_LocaleOverrideEntries); foreach (string locale in LocalizableText.TenMostCommonLanguages) { if (!m_LocaleOverrideEntries.ContainsKey(locale)) { m_LocaleOverrideEntries.Add(locale, ""); } } text.SetLocaleOverrides(m_LocaleOverrideEntries); } EditorUtilityX.SetDirty(this.targets); UpdateGUIContents(); } if (EditorGUIX.DisplayButton("Alphabetize")) { Undo.RecordObjects(this.targets, "Alphabetize"); foreach (LocalizableText text in this.targets) { System.Collections.IList backingFieldValue = (System.Collections.IList)s_LocaleOverridesField.GetValue(text); List <IIdentifiable <string> > sortingList = backingFieldValue.Cast <IIdentifiable <string> >().ToList(); sortingList.Sort((x, y) => x.Identifier.ToLower().CompareTo(y.Identifier.ToLower())); for (int i = 0; i < sortingList.Count; ++i) { backingFieldValue[i] = sortingList[i]; } s_LocaleOverridesField.SetValue(text, backingFieldValue); } EditorUtilityX.SetDirty(this.targets); } EditorGUI.BeginChangeCheck(); { EditorGUIX.DisplayListWithElementEditor(m_LocaleOverrides); } if (EditorGUI.EndChangeCheck()) { needsUpdate = true; } this.serializedObject.ApplyModifiedProperties(); if (needsUpdate) { UpdateGUIContents(); } }