private void createISOLanguagesBox() { EditorGUILayout.BeginVertical(GUI.skin.box); EditorGUILayout.LabelField("ISO Languages", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(EditorStyles.inspectorDefaultMargins); if (fileISOLanguages != null) { // Create the options for all iso languages stored in memory string[] isoLanguageOptions = new string[fileISOLanguages.Length]; string prefix = ""; // If the json items in the file are sorted by code, then they will be already sorted for popup submenus // so we can use the first char of the language code to order them. for (int i = 0; i < isoLanguageOptions.Length; i++) { prefix = fileISOLanguages[i].code[0] + "/"; isoLanguageOptions[i] = prefix + fileISOLanguages[i].code + " - " + fileISOLanguages[i].name + " - " + fileISOLanguages[i].nativeName; } string label = "File Languages"; EditorGUILayout.LabelField(label, GUILayout.Width((label.Length * 7))); ISOListSelectedIndex = EditorGUILayout.Popup(ISOListSelectedIndex, isoLanguageOptions); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(EditorStyles.inspectorDefaultMargins); EditorColors.SET_ADD_BUTTON_COLOR(); if (GUILayout.Button(" Add Selected Language to Game ", GUILayout.ExpandWidth(true))) { AddLanguage(fileISOLanguages[ISOListSelectedIndex]); } EditorColors.SET_DEFAULT_COLOR(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); }
public static bool createListButton(string title, bool removeButton = false, GUILayoutOption option = null) { if (removeButton) { EditorColors.SET_REMOVE_BUTTON_COLOR(); } else { EditorColors.SET_ADD_BUTTON_COLOR(); } if (option == null) { option = GUILayout.ExpandWidth(false); } bool pressed = GUILayout.Button(title, option); EditorColors.SET_DEFAULT_COLOR(); return(pressed); }