private void FilePopup(string label, string selectedString, ref string[] names, ref string[] paths, PreferencesWindow.RefString outString, Action onChanged) { GUIStyle popup = EditorStyles.popup; GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.PrefixLabel(label, popup); int[] array = new int[] { Array.IndexOf <string>(paths, selectedString) }; GUIContent content = new GUIContent(names[array[0]]); Rect rect = GUILayoutUtility.GetRect(GUIContent.none, popup); PreferencesWindow.AppsListUserData userData = new PreferencesWindow.AppsListUserData(paths, outString, onChanged); if (EditorGUI.ButtonMouseDown(rect, content, FocusType.Native, popup)) { ArrayUtility.Add <string>(ref names, "Browse..."); EditorUtility.DisplayCustomMenu(rect, names, array, new EditorUtility.SelectMenuItemFunction(this.AppsListClick), userData); } GUILayout.EndHorizontal(); }
public AppsListUserData(string[] paths, PreferencesWindow.RefString str, Action onChanged) { this.paths = paths; this.str = str; this.onChanged = onChanged; }