private void DrawPhrases(LeanLocalization localization) { var labelA = Reserve(); var valueA = Reserve(ref labelA, 35.0f); EditorGUI.LabelField(labelA, "Phrases", EditorStyles.boldLabel); if (GUI.Button(valueA, "Add") == true) { MarkAsModified(); var newPhrase = localization.AddPhrase("New Phrase"); phraseIndex = localization.Phrases.IndexOf(newPhrase); } existingPhrases.Clear(); for (var i = 0; i < localization.Phrases.Count; i++) { var phrase = localization.Phrases[i]; var labelB = Reserve(); var valueB = Reserve(ref labelB, 20.0f); if (phraseIndex == i) { BeginModifications(); { phrase.Name = EditorGUI.TextField(labelB, "", phrase.Name); } EndModifications(); if (GUI.Button(valueB, "X") == true) { MarkAsModified(); localization.Phrases.RemoveAt(i); phraseIndex = -1; } } if (EditorGUI.Foldout(labelB, phraseIndex == i, phraseIndex == i ? "" : phrase.Name) == true) { if (phraseIndex != i) { phraseIndex = i; translationIndex = -1; } EditorGUI.indentLevel += 1; { DrawTranslations(localization, phrase); } EditorGUI.indentLevel -= 1; EditorGUILayout.Separator(); } else if (phraseIndex == i) { phraseIndex = -1; translationIndex = -1; } if (existingPhrases.Contains(phrase.Name) == true) { EditorGUILayout.HelpBox("This phrase already exists in the list!", MessageType.Warning); } else { existingPhrases.Add(phrase.Name); } } }