private void DrawCultures(LeanLocalization localization) { var labelA = Reserve(); var valueA = Reserve(ref labelA, 35.0f); EditorGUI.LabelField(labelA, "Cultures", EditorStyles.boldLabel); // Add a new culture? if (localization.Languages.Count > 0) { if (GUI.Button(valueA, "Add") == true) { MarkAsModified(); var menu = new GenericMenu(); for (var i = 0; i < localization.Languages.Count; i++) { var language = localization.Languages[i]; menu.AddItem(new GUIContent(language), false, () => { var culture = localization.AddCulture(language, ""); cultureIndex = localization.Cultures.IndexOf(culture); }); } menu.DropDown(valueA); } } // Draw all cultures for (var i = 0; i < localization.Languages.Count; i++) { var language = localization.Languages[i]; if (localization.Cultures.Exists(c => c.Language == language) == true) { var labelB = Reserve(); if (EditorGUI.Foldout(labelB, cultureIndex == i, language) == true) { if (cultureIndex != i) { cultureIndex = i; } EditorGUI.indentLevel += 1; { for (var j = 0; j < localization.Cultures.Count; j++) { var culture = localization.Cultures[j]; if (culture.Language == language) { DrawCulture(localization, culture, false); } } } EditorGUI.indentLevel -= 1; } else if (cultureIndex == i) { cultureIndex = -1; } } } for (var i = 0; i < localization.Cultures.Count; i++) { var culture = localization.Cultures[i]; var cultureLanguage = culture.Language; if (localization.Languages.Contains(cultureLanguage) == false) { DrawCulture(localization, culture, true); } } }