Ejemplo n.º 1
0
        public void OnGUI()
        {
            GUILayout.BeginArea(screenRect, name, GUI.skin.window);
            try {
                GUILayout.BeginHorizontal();
                try {
                    for (int parentIdx = 0; parentIdx < currentDirParts.Length; ++parentIdx)
                    {
                        if (parentIdx == currentDirParts.Length - 1)
                        {
                            GUILayout.Label(currentDirParts[parentIdx], CentredText);
                        }
                        else if (GUILayout.Button(currentDirParts[parentIdx]))
                        {
                            string parentDirName = currentDir;
                            for (int i = currentDirParts.Length - 1; i > parentIdx; --i)
                            {
                                parentDirName = Path.GetDirectoryName(parentDirName);
                            }
                            SetNewDirectory(parentDirName);
                        }
                    }

                    GUILayout.FlexibleSpace();
                } finally {
                    GUILayout.EndHorizontal();
                }
                scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true,
                                                           GUI.skin.horizontalScrollbar,
                                                           GUI.skin.verticalScrollbar, GUI.skin.box);
                selectedDir = GUILayoutx.SelectionList(selectedDir, dirsWithImages, labelStyle, DirectoryClickCallback);
                if (selectedDir > -1)
                {
                    selectedFile = selectedNonMatchingDirs = -1;
                    //selectedName = dirsWithImages[selectedDir].text;
                }

                selectedNonMatchingDirs = GUILayoutx.SelectionList(selectedNonMatchingDirs, nonMatchingDirsWithImages, labelStyle, NonMatchingDirectoryClickCallback);
                if (selectedNonMatchingDirs > -1)
                {
                    selectedDir = selectedFile = -1;
                    //selectedName = string.Empty;
                }
                GUI.enabled  = BrowserType == FileBrowserType.File;
                selectedFile = GUILayoutx.SelectionList(selectedFile, filesWithImages, labelStyle, FileClickCallback);
                GUI.enabled  = true;
                if (selectedFile > -1)
                {
                    selectedDir = selectedNonMatchingDirs = -1;
                    //selectedName = filesWithImages[selectedDir].text;
                }
                GUI.enabled = false;
                GUILayoutx.SelectionList(-1, nonMatchingFilesWithImages, labelStyle);
                GUI.enabled = true;

                GUILayout.EndScrollView();
                GUILayout.BeginHorizontal();
                GUILayout.Label(selectedName);
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("キャンセル", GUILayout.Width(120)))
                {
                    callback(null);
                }
                if (BrowserType == FileBrowserType.File)
                {
                    GUI.enabled  = selectedFile > -1;
                    selectedName = GUI.enabled ? filesWithImages[selectedFile].text : string.Empty;
                }
                else
                {
                    if (SelectionPatterns == null)
                    {
                        GUI.enabled  = selectedDir > -1;
                        selectedName = GUI.enabled ? dirsWithImages[selectedDir].text : string.Empty;
                    }
                    else
                    {
                        GUI.enabled = selectedDir > -1 ||
                                      (currentDirMatches && selectedNonMatchingDirs == -1 && selectedFile == -1);
                        selectedName = selectedDir > -1 ? dirsWithImages[selectedDir].text : string.Empty;
                    }
                }

                if (GUILayout.Button("選択", GUILayout.Width(120)))
                {
                    if (BrowserType == FileBrowserType.File)
                    {
                        callback(Path.Combine(currentDir, files[selectedFile]));
                    }
                    else
                    {
                        if (selectedDir > -1)
                        {
                            callback(Path.Combine(currentDir, directories[selectedDir]));
                        }
                        else
                        {
                            callback(currentDir);
                        }
                    }
                }
                GUI.enabled = true;
                GUILayout.EndHorizontal();
            } finally {
                GUILayout.EndArea();
            }
        }
 // Token: 0x06000054 RID: 84 RVA: 0x00006C34 File Offset: 0x00004E34
 public void OnGUI()
 {
     GUILayout.BeginArea(this.screenRect, this.name, GUI.skin.window);
     try
     {
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         try
         {
             for (int i = 0; i < this.currentDirParts.Length; i++)
             {
                 if (i == this.currentDirParts.Length - 1)
                 {
                     GUILayout.Label(this.currentDirParts[i], this.CentredText, new GUILayoutOption[0]);
                 }
                 else if (GUILayout.Button(this.currentDirParts[i], new GUILayoutOption[0]))
                 {
                     string directoryName = this.currentDir;
                     for (int j = this.currentDirParts.Length - 1; j > i; j--)
                     {
                         directoryName = Path.GetDirectoryName(directoryName);
                     }
                     this.SetNewDirectory(directoryName);
                 }
             }
             GUILayout.FlexibleSpace();
             GUI.enabled = this.historyDirs.Any <string>();
             if (GUILayout.Button("<", new GUILayoutOption[0]))
             {
                 this.Prev();
             }
             GUI.enabled = this.nextDirs.Any <string>();
             if (GUILayout.Button(">", new GUILayoutOption[0]))
             {
                 this.Next();
             }
         }
         finally
         {
             GUI.enabled = true;
             GUILayout.EndHorizontal();
         }
         this.scrollPosition = GUILayout.BeginScrollView(this.scrollPosition, false, true, GUI.skin.horizontalScrollbar, GUI.skin.verticalScrollbar, GUI.skin.box, new GUILayoutOption[0]);
         this.selectedDir    = GUILayoutx.SelectionList(this.selectedDir, this.dirsWithImages, this.labelStyle, new GUILayoutx.ClickCallback(this.DirectoryClickCallback));
         if (this.selectedDir > -1)
         {
             this.selectedFile = (this.selectedNonMatchingDirs = -1);
         }
         this.selectedNonMatchingDirs = GUILayoutx.SelectionList(this.selectedNonMatchingDirs, this.nonMatchingDirsWithImages, this.labelStyle, new GUILayoutx.ClickCallback(this.NonMatchingDirectoryClickCallback));
         if (this.selectedNonMatchingDirs > -1)
         {
             this.selectedDir = (this.selectedFile = -1);
         }
         GUI.enabled       = (this.BrowserType == FileBrowserType.File);
         this.selectedFile = GUILayoutx.SelectionList(this.selectedFile, this.filesWithImages, this.labelStyle, new GUILayoutx.ClickCallback(this.FileClickCallback));
         GUI.enabled       = true;
         if (this.selectedFile > -1)
         {
             this.selectedDir = (this.selectedNonMatchingDirs = -1);
         }
         GUI.enabled = false;
         GUILayoutx.SelectionList(-1, this.nonMatchingFilesWithImages, this.labelStyle, null);
         GUI.enabled = true;
         GUILayout.EndScrollView();
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         GUILayout.Label(this.selectedName, new GUILayoutOption[0]);
         GUILayout.FlexibleSpace();
         if (GUILayout.Button("キャンセル", new GUILayoutOption[]
         {
             GUILayout.Width(120f)
         }))
         {
             this.callback(null);
         }
         if (this.BrowserType == FileBrowserType.File)
         {
             GUI.enabled       = (this.selectedFile > -1);
             this.selectedName = (GUI.enabled ? this.filesWithImages[this.selectedFile].text : string.Empty);
         }
         else if (this.SelectionPatterns == null)
         {
             GUI.enabled       = (this.selectedDir > -1);
             this.selectedName = (GUI.enabled ? this.dirsWithImages[this.selectedDir].text : string.Empty);
         }
         else
         {
             GUI.enabled       = (this.selectedDir > -1 || (this.currentDirMatches && this.selectedNonMatchingDirs == -1 && this.selectedFile == -1));
             this.selectedName = ((this.selectedDir > -1) ? this.dirsWithImages[this.selectedDir].text : string.Empty);
         }
         if (GUILayout.Button("選択", new GUILayoutOption[]
         {
             GUILayout.Width(120f)
         }))
         {
             if (this.BrowserType == FileBrowserType.File)
             {
                 this.callback(Path.Combine(this.currentDir, this.files[this.selectedFile]));
             }
             else
             {
                 this.callback((this.selectedDir > -1) ? Path.Combine(this.currentDir, this.directories[this.selectedDir]) : this.currentDir);
             }
         }
         GUI.enabled = true;
         GUILayout.EndHorizontal();
     }
     finally
     {
         GUILayout.EndArea();
     }
 }