Example #1
0
 public static int SelectionList(int selected, GUIContent[] list)
 {
     return(GUILayoutx.SelectionList(selected, list, "List Item", null));
 }
Example #2
0
 public static int SelectionList(int selected, string[] list, GUIStyle elementStyle)
 {
     return(GUILayoutx.SelectionList(selected, list, elementStyle, null));
 }
Example #3
0
 public static int SelectionList(int selected, string[] list, GUILayoutx.DoubleClickCallback callback)
 {
     return(GUILayoutx.SelectionList(selected, list, "List Item", callback));
 }
 public void OnGUI(int winID)
 {
     GUI.skin.GetStyle("List Item").alignment = (TextAnchor)3;
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     for (int i = 0; i < this.m_currentDirectoryParts.Length; i++)
     {
         if (i == this.m_currentDirectoryParts.Length - 1)
         {
             GUILayout.Label(this.m_currentDirectoryParts[i], this.CentredText, new GUILayoutOption[0]);
         }
         else if (GUILayout.Button(this.m_currentDirectoryParts[i], new GUILayoutOption[0]))
         {
             if (i == 0)
             {
                 this.SetNewDirectory("");
             }
             else
             {
                 string text = this.m_currentDirectory;
                 for (int j = this.m_currentDirectoryParts.Length - 1; j > i; j--)
                 {
                     text = Path.GetDirectoryName(text);
                 }
                 this.SetNewDirectory(text);
             }
         }
     }
     GUILayout.FlexibleSpace();
     GUILayout.EndHorizontal();
     this.m_scrollPosition    = GUILayout.BeginScrollView(this.m_scrollPosition, false, true, GUI.skin.horizontalScrollbar, GUI.skin.verticalScrollbar, GUI.skin.box, new GUILayoutOption[0]);
     this.m_selectedDirectory = GUILayoutx.SelectionList(this.m_selectedDirectory, this.m_directoriesWithImages, new GUILayoutx.DoubleClickCallback(this.DirectoryDoubleClickCallback));
     if (this.m_selectedDirectory > -1)
     {
         this.m_selectedFile = (this.m_selectedNonMatchingDirectory = -1);
     }
     this.m_selectedNonMatchingDirectory = GUILayoutx.SelectionList(this.m_selectedNonMatchingDirectory, this.m_nonMatchingDirectoriesWithImages, new GUILayoutx.DoubleClickCallback(this.NonMatchingDirectoryDoubleClickCallback));
     if (this.m_selectedNonMatchingDirectory > -1)
     {
         this.m_selectedDirectory = (this.m_selectedFile = -1);
     }
     GUI.enabled         = (this.BrowserType == FileBrowserType.File);
     this.m_selectedFile = GUILayoutx.SelectionList(this.m_selectedFile, this.m_filesWithImages, new GUILayoutx.DoubleClickCallback(this.FileDoubleClickCallback));
     GUI.enabled         = true;
     if (this.m_selectedFile > -1)
     {
         this.m_selectedDirectory = (this.m_selectedNonMatchingDirectory = -1);
     }
     GUI.enabled = false;
     GUILayoutx.SelectionList(-1, this.m_nonMatchingFilesWithImages);
     GUI.enabled = true;
     GUILayout.EndScrollView();
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.FlexibleSpace();
     if (GUILayout.Button("Cancel", new GUILayoutOption[]
     {
         GUILayout.Width(50f)
     }))
     {
         this.m_callback(null);
     }
     if (this.BrowserType == FileBrowserType.File)
     {
         GUI.enabled = (this.m_selectedFile > -1);
     }
     else if (this.SelectionPattern == null)
     {
         GUI.enabled = (this.m_selectedDirectory > -1);
     }
     else
     {
         GUI.enabled = (this.m_selectedDirectory > -1 || (this.m_currentDirectoryMatches && this.m_selectedNonMatchingDirectory == -1 && this.m_selectedFile == -1));
     }
     if (GUILayout.Button("Select", new GUILayoutOption[]
     {
         GUILayout.Width(50f)
     }))
     {
         if (this.BrowserType == FileBrowserType.File)
         {
             this.m_callback(Path.Combine(this.m_currentDirectory, this.m_files[this.m_selectedFile]));
         }
         else if (this.m_selectedDirectory > -1)
         {
             this.m_callback(Path.Combine(this.m_currentDirectory, this.m_directories[this.m_selectedDirectory]));
         }
         else
         {
             this.m_callback(this.m_currentDirectory);
         }
     }
     GUI.enabled = true;
     GUILayout.EndHorizontal();
     if (Event.current.type == (EventType)7)
     {
         this.SwitchDirectoryNow();
     }
 }