コード例 #1
0
 private void RefreshSplittedSelectedPath()
 {
     m_BottomBar.SelectedPathSplitted.Clear();
     if (m_BottomBarSelectedItem == null)
     {
         m_BottomBar.SelectedPathSplitted.Add(new GUIContent());
     }
     else
     {
         if (!m_TreeView.isSearching)
         {
             m_BottomBar.SelectedPathSplitted.Add(new GUIContent(Path.GetFileName(m_BottomBarSelectedItem.Path), m_BottomBarSelectedItem.Texture));
         }
         else
         {
             float num            = m_BottomBarRectWidth - 55 - 16;
             var   parentItemList = GetSplittedParentItems();
             var   itemPathString = GetSplittedString(parentItemList);
             if (selectedPathLabel.CalcSize(GUIContentWrap.Temp(itemPathString)).x + 25.0 > num)
             {
                 for (int i = parentItemList.Count - 1; i >= 0; --i)
                 {
                     m_BottomBar.SelectedPathSplitted.Add(new GUIContent(parentItemList[i].displayName, EditorGUIUtility.FindTexture(EditorResourcesUtilityWrap.folderIconName)));
                 }
                 m_BottomBar.SelectedPathSplitted.Add(new GUIContent(m_BottomBarSelectedItem.DisplayName, m_BottomBarSelectedItem.Texture));
             }
             else
             {
                 m_BottomBar.SelectedPathSplitted.Add(new GUIContent(itemPathString, m_BottomBarSelectedItem.Texture));
             }
         }
     }
 }
コード例 #2
0
        protected float GetMaxWidth(List <TreeViewItem> rows)
        {
            InitStyles();
            float num1 = 1f;

            using (List <TreeViewItem> .Enumerator enumerator = rows.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    TreeViewItem current = enumerator.Current;
                    float        num2    = 0.0f + GetContentIndent(current);
                    if (current.icon != null)
                    {
                        num2 += k_IconWidth;
                    }
                    float minWidth;
                    float maxWidth;
                    s_Styles.lineStyle.CalcMinMaxWidth(GUIContentWrap.Temp(current.displayName), out minWidth, out maxWidth);
                    float num3 = num2 + maxWidth + k_BaseIndent;
                    if (num3 > num1)
                    {
                        num1 = num3;
                    }
                }
            }
            return(num1);
        }
コード例 #3
0
        private void BreadCrumbBar(Rect rect)
        {
            Event current = Event.current;

            if (current.type == EventType.MouseDown && rect.Contains(current.mousePosition))
            {
                GUIUtility.keyboardControl = m_KeyboardControlID;
                Repaint();
            }

            GUI.Label(rect, GUIContent.none, m_Styles.topBarBg);

            Rect listHeaderRect = rect;

            ++listHeaderRect.y;
            listHeaderRect.x += 4f;
            if (!ShowMultipleFolders)
            {
                for (int index = 0; index < m_BreadCrumbs.Count; ++index)
                {
                    bool       flag    = index == m_BreadCrumbs.Count - 1;
                    GUIStyle   style   = !flag ? EditorStyles.label : EditorStyles.boldLabel;
                    GUIContent key     = m_BreadCrumbs[index].Key;
                    int        id      = m_BreadCrumbs[index].Value;
                    Vector2    vector2 = style.CalcSize(key);
                    listHeaderRect.width = vector2.x;
                    if (GUI.Button(listHeaderRect, key, style))
                    {
                        if (ShowFolderContentsAction != null)
                        {
                            ShowFolderContentsAction(id);
                        }
                    }
                    listHeaderRect.x += vector2.x + 3f;
                    if (!flag || LastFolderHasSubFolders)
                    {
                        Rect arrowRect = new Rect(listHeaderRect.x, listHeaderRect.y + 2f, 13f, 13f);
                        if (EditorGUI.DropdownButton(arrowRect, GUIContent.none, FocusType.Passive, m_Styles.foldout))
                        {
                            int childItemId = Int32.MinValue;
                            if (!flag)
                            {
                                childItemId = m_BreadCrumbs[index + 1].Value;
                            }
                            BreadCrumbListMenu.Show(id, childItemId, FolderTreeView, arrowRect, this);
                        }
                    }
                    listHeaderRect.x += 11f;
                }
            }
            else
            {
                GUI.Label(listHeaderRect, GUIContentWrap.Temp("Showing multiple folders..."), EditorStyles.miniLabel);
            }
        }
コード例 #4
0
        public override void BeginPingItem(TreeViewItem item, float topPixelOfRow, float availableWidth)
        {
            if (item == null || topPixelOfRow < 0.0)
            {
                return;
            }

            m_Ping.m_TimeStart = Time.realtimeSinceStartup;
            m_Ping.m_PingStyle = s_Styles.ping;

            Vector2 vector2 = m_Ping.m_PingStyle.CalcSize(GUIContentWrap.Temp(item.displayName));

            m_Ping.m_ContentRect    = new Rect(GetContentIndent(item) + k_FoldoutWidth, topPixelOfRow, k_IconWidth + k_SpaceBetweenIconAndText + vector2.x + iconTotalPadding, vector2.y);
            m_Ping.m_AvailableWidth = availableWidth;

            m_Ping.m_ContentDraw = (rect) => { DrawIconAndLabel(rect, item, item.displayName, false, false, false, true); };
            m_TreeView.Repaint();
        }