protected virtual void ShowButton(Rect r) { if (ProjectBrowser.s_Styles == null) ProjectBrowser.s_Styles = new ProjectBrowser.Styles(); this.m_IsLocked = GUI.Toggle(r, this.m_IsLocked, GUIContent.none, ProjectBrowser.s_Styles.lockButton); }
private void RefreshSplittedSelectedPath() { if (ProjectBrowser.s_Styles == null) ProjectBrowser.s_Styles = new ProjectBrowser.Styles(); this.m_SelectedPathSplitted.Clear(); if (string.IsNullOrEmpty(this.m_SelectedPath)) { this.m_SelectedPathSplitted.Add(new GUIContent()); } else { string str1 = this.m_SelectedPath; if (this.m_SelectedPath.StartsWith("assets/", StringComparison.CurrentCultureIgnoreCase)) str1 = this.m_SelectedPath.Substring("assets/".Length); if (this.m_SearchFilter.GetState() == SearchFilter.State.FolderBrowsing) { this.m_SelectedPathSplitted.Add(new GUIContent(Path.GetFileName(this.m_SelectedPath), AssetDatabase.GetCachedIcon(this.m_SelectedPath))); } else { float num = (float) ((double) this.position.width - (double) this.m_DirectoriesAreaWidth - 55.0 - 16.0); if ((double) ProjectBrowser.s_Styles.selectedPathLabel.CalcSize(GUIContent.Temp(str1)).x + 25.0 > (double) num) { string[] strArray = str1.Split('/'); string str2 = "Assets/"; for (int index = 0; index < strArray.Length; ++index) { string path = str2 + strArray[index]; Texture cachedIcon = AssetDatabase.GetCachedIcon(path); this.m_SelectedPathSplitted.Add(new GUIContent(strArray[index], cachedIcon)); str2 = path + "/"; } } else this.m_SelectedPathSplitted.Add(new GUIContent(str1, AssetDatabase.GetCachedIcon(this.m_SelectedPath))); } } }
private void OnGUI() { if (ProjectBrowser.s_Styles == null) ProjectBrowser.s_Styles = new ProjectBrowser.Styles(); if (!this.Initialized()) this.Init(); this.m_ListKeyboardControlID = GUIUtility.GetControlID(FocusType.Keyboard); this.m_TreeViewKeyboardControlID = GUIUtility.GetControlID(FocusType.Keyboard); this.OnEvent(); this.m_ToolbarHeight = EditorStyles.toolbar.fixedHeight; this.m_ItemSelectedByRightClickThisEvent = false; this.ResizeHandling(this.position.width, this.position.height - this.m_ToolbarHeight); this.CalculateRects(); Event current = Event.current; Rect position1 = new Rect(0.0f, 0.0f, this.position.width, this.position.height); if (current.type == EventType.MouseDown && position1.Contains(current.mousePosition)) { this.EndPing(); this.SetAsLastInteractedProjectBrowser(); } if (this.m_GrabKeyboardFocusForListArea) { this.m_GrabKeyboardFocusForListArea = false; GUIUtility.keyboardControl = this.m_ListKeyboardControlID; } GUI.BeginGroup(position1, GUIContent.none); this.TopToolbar(); this.BottomBar(); if (this.m_ViewMode == ProjectBrowser.ViewMode.OneColumn) { if (this.m_SearchFilter.IsSearching()) { this.SearchAreaBar(); if (GUIUtility.keyboardControl == this.m_TreeViewKeyboardControlID) GUIUtility.keyboardControl = this.m_ListKeyboardControlID; this.m_ListArea.OnGUI(this.m_ListAreaRect, this.m_ListKeyboardControlID); } else { if (GUIUtility.keyboardControl == this.m_ListKeyboardControlID) GUIUtility.keyboardControl = this.m_TreeViewKeyboardControlID; this.m_AssetTree.OnGUI(this.m_TreeViewRect, this.m_TreeViewKeyboardControlID); } } else { if (this.m_SearchFilter.IsSearching()) this.SearchAreaBar(); else this.BreadCrumbBar(); this.m_FolderTree.OnGUI(this.m_TreeViewRect, this.m_TreeViewKeyboardControlID); EditorGUIUtility.DrawHorizontalSplitter(new Rect(this.m_ListAreaRect.x, this.m_ToolbarHeight, 1f, this.m_TreeViewRect.height)); this.m_ListArea.OnGUI(this.m_ListAreaRect, this.m_ListKeyboardControlID); if (this.m_SearchFilter.GetState() == SearchFilter.State.FolderBrowsing && this.m_ListArea.numItemsDisplayed == 0) { Vector2 vector2 = EditorStyles.label.CalcSize(ProjectBrowser.s_Styles.m_EmptyFolderText); Rect position2 = new Rect(this.m_ListAreaRect.x + 2f + Mathf.Max(0.0f, (float) (((double) this.m_ListAreaRect.width - (double) vector2.x) * 0.5)), this.m_ListAreaRect.y + 10f, vector2.x, 20f); EditorGUI.BeginDisabledGroup(true); GUI.Label(position2, ProjectBrowser.s_Styles.m_EmptyFolderText, EditorStyles.label); EditorGUI.EndDisabledGroup(); } } this.HandleContextClickInListArea(this.m_ListAreaRect); if (this.m_ListArea.gridSize != this.m_StartGridSize) { this.m_StartGridSize = this.m_ListArea.gridSize; if (this.m_SearchFilter.GetState() == SearchFilter.State.FolderBrowsing) this.m_LastFoldersGridSize = (float) this.m_ListArea.gridSize; } GUI.EndGroup(); if (this.m_ViewMode == ProjectBrowser.ViewMode.TwoColumns) this.useTreeViewSelectionInsteadOfMainSelection = GUIUtility.keyboardControl == this.m_TreeViewKeyboardControlID; if (this.m_ViewMode == ProjectBrowser.ViewMode.TwoColumns && GUIUtility.keyboardControl == this.m_TreeViewKeyboardControlID) this.HandleCommandEventsForTreeView(); this.HandleCommandEvents(); }
private void RefreshSplittedSelectedPath() { if (ProjectBrowser.s_Styles == null) { ProjectBrowser.s_Styles = new ProjectBrowser.Styles(); } this.m_SelectedPathSplitted.Clear(); if (string.IsNullOrEmpty(this.m_SelectedPath)) { this.m_SelectedPathSplitted.Add(new GUIContent()); } else { string text = this.m_SelectedPath; if (this.m_SelectedPath.StartsWith("assets/", StringComparison.CurrentCultureIgnoreCase)) { text = this.m_SelectedPath.Substring("assets/".Length); } if (this.m_SearchFilter.GetState() == SearchFilter.State.FolderBrowsing) { this.m_SelectedPathSplitted.Add(new GUIContent(Path.GetFileName(this.m_SelectedPath), AssetDatabase.GetCachedIcon(this.m_SelectedPath))); } else { float num = base.position.width - this.m_DirectoriesAreaWidth - 55f - 16f; if (ProjectBrowser.s_Styles.selectedPathLabel.CalcSize(GUIContent.Temp(text)).x + 25f > num) { string[] array = text.Split(new char[] { '/' }); string text2 = "Assets/"; for (int i = 0; i < array.Length; i++) { text2 += array[i]; Texture cachedIcon = AssetDatabase.GetCachedIcon(text2); this.m_SelectedPathSplitted.Add(new GUIContent(array[i], cachedIcon)); text2 += "/"; } } else { this.m_SelectedPathSplitted.Add(new GUIContent(text, AssetDatabase.GetCachedIcon(this.m_SelectedPath))); } } } }