void DrawCategoriesTranslations() { #region Add/Edit Categories GUILayout.BeginHorizontal(); if (newCategories == true) { string buttonName = (editLanguage ? "Confirm" : "Add"); nameCategorie = GUILayout.TextField(nameCategorie); if (GUILayout.Button(buttonName, GUILayout.MaxWidth(150))) { if (editCategories == false) { AddCategories(nameCategorie); } else { polyglot.languagesCategories[selectedLanguageCategories] = nameCategorie; } ChangeNewCategories(); menu = "List"; } if (GUILayout.Button("Cancel", GUILayout.MaxWidth(150))) { ChangeNewCategories(); menu = "List"; } } else #endregion #region Categories CRUD { selectedLanguageCategories = EditorGUILayout.Popup(selectedLanguageCategories, polyglot.languagesCategories.ToArray()); if (GUILayout.Button("New", GUILayout.MaxWidth(150))) { ChangeNewCategories(); int count = polyglot.languagesCategories.Count + 1; nameCategorie = "New Categorie " + count; editCategories = false; menu = "New"; } if (GUILayout.Button("Edit", GUILayout.MaxWidth(150))) { ChangeNewCategories(); nameCategorie = polyglot.languagesCategories[selectedLanguageCategories]; editCategories = true; menu = "Edit"; } if (GUILayout.Button("Delete", GUILayout.MaxWidth(150))) { if (EditorUtility.DisplayDialog("Delete Language", string.Format(@"Are you sure you want to delete the {0} language and all data together?", polyglot.languages[selectedLanguage]), "Yes", "No")) { RemoveCategorie(); } } } GUILayout.EndHorizontal(); #endregion #region List Translations HEADER GUILayout.BeginVertical("Box"); GUILayout.Label("Translation", EditorStyles.boldLabel); GUILayout.BeginHorizontal("CN Box", GUILayout.MaxHeight(7)); GUILayout.Label("Name ID", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); GUILayout.Label("Translation", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); GUILayout.Label("Settings", EditorStyles.boldLabel); GUILayout.EndHorizontal(); #endregion #region List Elements scrollTranslations = EditorGUILayout.BeginScrollView(scrollTranslations, GUILayout.Width(position.width * 0.977f), GUILayout.Height(140)); // Browse a list of translations for (int i = 0; i < polyglot.translations.Count; i++) { Translation t = polyglot.translations [i]; // Check if the translation is part of the selected language if (t.indexLanguage == selectedLanguage) { // If part of the selected category if (selectedLanguageCategories == t.categories.index) { float tam = position.width / 2; GUILayout.BeginHorizontal("Box", GUILayout.MaxHeight(20)); t.nameID = GUILayout.TextField(t.nameID, GUILayout.MaxWidth(tam)); if (t.isDropdown == false) { t.translation = GUILayout.TextField(t.translation, GUILayout.MaxWidth(tam)); } else { // If you click the button edit translations of dropdown if (GUILayout.Button("EDIT TRANSLATIONS", GUILayout.MaxWidth(tam))) { DropDownWindow ddWindow = EditorWindow.GetWindow <DropDownWindow>(); ddWindow.Init(t, selectedLanguage, selectedLanguageCategories); } } // Changes the brother element in the other languages and get the brother Translation brotherElement = ChangeIdAnotherLanguage(t.idUniqueElements, t.nameID); // If you click the button to delete the translation if (GUILayout.Button("\u00D7", GUILayout.MaxWidth(30))) { // Case YES if (EditorUtility.DisplayDialog("Delete Translation", "Are you sure you want to delete the " + t.nameID + " ?", "Yes", "No")) { polyglot.translations.RemoveAt(i); // Remove translation polyglot.DisableIdElement(t.idUniqueElements); // Disable id brother if (brotherElement != null) { polyglot.translations.Remove(brotherElement); // Delete brother element } } } GUILayout.EndHorizontal(); GUILayout.Space(2); } } } EditorGUILayout.EndScrollView(); #endregion #region Add New Translation GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); // If you click the button to add new translation if (GUILayout.Button("Add New Translation")) { // Create new categories (selected) Categories c = new Categories(selectedLanguageCategories, polyglot.languagesCategories[selectedLanguageCategories].ToString()); // Try get a shared id between brothers translations Vector2Int idE = GetIdElements(); // If there is no shared id available if (idE.y == 0) { // Create new shared id IdElements idElement = new IdElements(true, polyglot.idElements.Count); polyglot.idElements.Add(idElement); } // idE.x = id available (Line: 260) // Creates the new translation in all available languages for (int i = 0; i < polyglot.languages.Count; i++) { Translation element = new Translation(i, "Item Id", "Translation here", idE.x, c, false); polyglot.translations.Add(element); } } // If you click the button to add new translation if (GUILayout.Button("Add New Translation (DropDown)")) { // Create new categories (selected) Categories c = new Categories(selectedLanguageCategories, polyglot.languagesCategories[selectedLanguageCategories].ToString()); // Try get a shared id between brothers translations Vector2Int idE = GetIdElements(); // If there is no shared id available if (idE.y == 0) { // Create new shared id IdElements idElement = new IdElements(true, polyglot.idElements.Count); polyglot.idElements.Add(idElement); } // idE.x = id available (Line: 260) // Creates the new translation in all available languages for (int i = 0; i < polyglot.languages.Count; i++) { Translation element = new Translation(i, "Item Id", "Translation here", idE.x, c, true); polyglot.translations.Add(element); } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); #endregion GUILayout.EndVertical(); // End Begin Vertical in Categories HEADER (Line: 147) }