예제 #1
0
        private static void ShowAssetsPopupMenu <T>(Rect buttonRect, string typeName, SerializedProperty serializedProperty, string fileExtension, string defaultFieldName) where T : UnityEngine.Object, new()
        {
            GenericMenu genericMenu = new GenericMenu();
            int         num         = (!(serializedProperty.objectReferenceValue != null)) ? 0 : serializedProperty.objectReferenceValue.GetInstanceID();

            genericMenu.AddItem(new GUIContent(defaultFieldName), num == 0, new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback), new object[]
            {
                0,
                serializedProperty
            });
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
            SearchFilter      searchFilter      = new SearchFilter
            {
                classNames = new string[]
                {
                    typeName
                }
            };

            hierarchyProperty.SetSearchFilter(searchFilter);
            hierarchyProperty.Reset();
            while (hierarchyProperty.Next(null))
            {
                genericMenu.AddItem(new GUIContent(hierarchyProperty.name), hierarchyProperty.instanceID == num, new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback), new object[]
                {
                    hierarchyProperty.instanceID,
                    serializedProperty
                });
            }
            int num2 = BaseObjectTools.StringToClassID(typeName);

            if (num2 > 0)
            {
                BuiltinResource[] builtinResourceList = EditorGUIUtility.GetBuiltinResourceList(num2);
                BuiltinResource[] array = builtinResourceList;
                for (int i = 0; i < array.Length; i++)
                {
                    BuiltinResource builtinResource = array[i];
                    genericMenu.AddItem(new GUIContent(builtinResource.m_Name), builtinResource.m_InstanceID == num, new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback), new object[]
                    {
                        builtinResource.m_InstanceID,
                        serializedProperty
                    });
                }
            }
            genericMenu.AddSeparator(string.Empty);
            genericMenu.AddItem(new GUIContent("Create New..."), false, delegate
            {
                T t = Activator.CreateInstance <T>();
                ProjectWindowUtil.CreateAsset(t, "New " + typeName + "." + fileExtension);
                serializedProperty.objectReferenceValue = t;
                serializedProperty.m_SerializedObject.ApplyModifiedProperties();
            });
            genericMenu.DropDown(buttonRect);
        }
예제 #2
0
        private static void ShowAssetsPopupMenu <T>(Rect buttonRect, string typeName, SerializedProperty serializedProperty, string fileExtension, string defaultFieldName) where T : UnityEngine.Object, new()
        {
            GenericMenu genericMenu = new GenericMenu();
            int         num         = (!(serializedProperty.objectReferenceValue != null)) ? 0 : serializedProperty.objectReferenceValue.GetInstanceID();
            bool        flag        = false;
            UnityType   unityType   = UnityType.FindTypeByName(typeName);
            int         num2        = (unityType == null) ? 0 : unityType.persistentTypeID;

            BuiltinResource[] array = null;
            if (num2 > 0)
            {
                array = EditorGUIUtility.GetBuiltinResourceList(num2);
                BuiltinResource[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    BuiltinResource resource = array2[i];
                    if (resource.m_Name == defaultFieldName)
                    {
                        GenericMenu arg_124_0 = genericMenu;
                        GUIContent  arg_124_1 = new GUIContent(resource.m_Name);
                        bool        arg_124_2 = resource.m_InstanceID == num;
                        if (AssetPopupBackend.< > f__mg$cache0 == null)
                        {
                            AssetPopupBackend.< > f__mg$cache0 = new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback);
                        }
                        arg_124_0.AddItem(arg_124_1, arg_124_2, AssetPopupBackend.< > f__mg$cache0, new object[]
                        {
                            resource.m_InstanceID,
                            serializedProperty
                        });
                        array = (from x in array
                                 where x != resource
                                 select x).ToArray <BuiltinResource>();
                        flag = true;
                        break;
                    }
                }
            }
            if (!flag)
            {
                GenericMenu arg_1A6_0 = genericMenu;
                GUIContent  arg_1A6_1 = new GUIContent(defaultFieldName);
                bool        arg_1A6_2 = num == 0;
                if (AssetPopupBackend.< > f__mg$cache1 == null)
                {
                    AssetPopupBackend.< > f__mg$cache1 = new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback);
                }
                arg_1A6_0.AddItem(arg_1A6_1, arg_1A6_2, AssetPopupBackend.< > f__mg$cache1, new object[]
                {
                    0,
                    serializedProperty
                });
            }
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
            SearchFilter      searchFilter      = new SearchFilter
            {
                classNames = new string[]
                {
                    typeName
                }
            };

            hierarchyProperty.SetSearchFilter(searchFilter);
            hierarchyProperty.Reset();
            while (hierarchyProperty.Next(null))
            {
                GenericMenu arg_23D_0 = genericMenu;
                GUIContent  arg_23D_1 = new GUIContent(hierarchyProperty.name);
                bool        arg_23D_2 = hierarchyProperty.instanceID == num;
                if (AssetPopupBackend.< > f__mg$cache2 == null)
                {
                    AssetPopupBackend.< > f__mg$cache2 = new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback);
                }
                arg_23D_0.AddItem(arg_23D_1, arg_23D_2, AssetPopupBackend.< > f__mg$cache2, new object[]
                {
                    hierarchyProperty.instanceID,
                    serializedProperty
                });
            }
            if (num2 > 0 && array != null)
            {
                BuiltinResource[] array3 = array;
                for (int j = 0; j < array3.Length; j++)
                {
                    BuiltinResource builtinResource = array3[j];
                    GenericMenu     arg_2C7_0       = genericMenu;
                    GUIContent      arg_2C7_1       = new GUIContent(builtinResource.m_Name);
                    bool            arg_2C7_2       = builtinResource.m_InstanceID == num;
                    if (AssetPopupBackend.< > f__mg$cache3 == null)
                    {
                        AssetPopupBackend.< > f__mg$cache3 = new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback);
                    }
                    arg_2C7_0.AddItem(arg_2C7_1, arg_2C7_2, AssetPopupBackend.< > f__mg$cache3, new object[]
                    {
                        builtinResource.m_InstanceID,
                        serializedProperty
                    });
                }
            }
            genericMenu.AddSeparator("");
            genericMenu.AddItem(new GUIContent("Create New..."), false, delegate
            {
                T t = Activator.CreateInstance <T>();
                ProjectWindowUtil.CreateAsset(t, "New " + typeName + "." + fileExtension);
                serializedProperty.objectReferenceValue = t;
                serializedProperty.m_SerializedObject.ApplyModifiedProperties();
            });
            genericMenu.DropDown(buttonRect);
        }
예제 #3
0
			protected override void DrawInternal(int beginIndex, int endIndex, float yOffset)
			{
				int num = beginIndex;
				int num2 = 0;
				FilteredHierarchy.FilterResult[] results = this.m_FilteredHierarchy.results;
				bool flag = this.m_FilteredHierarchy.searchFilter.GetState() == SearchFilter.State.FolderBrowsing;
				yOffset += this.GetHeaderHeight();
				if (this.m_NoneList.Length > 0)
				{
					if (beginIndex < 1)
					{
						Rect position = this.m_Grid.CalcRect(num, yOffset);
						this.DrawItem(position, null, this.m_NoneList[0], flag);
						num++;
					}
					num2++;
				}
				if (!this.ListMode && flag)
				{
					this.DrawSubAssetBackground(beginIndex, endIndex, yOffset);
				}
				if (Event.current.type == EventType.Repaint)
				{
					this.ClearDirtyStateTracking();
				}
				int num3 = num - num2;
				while (true)
				{
					if (this.IsCreatingAtThisIndex(num))
					{
						BuiltinResource builtinResource = new BuiltinResource();
						builtinResource.m_Name = this.m_Owner.GetCreateAssetUtility().originalName;
						builtinResource.m_InstanceID = this.m_Owner.GetCreateAssetUtility().instanceID;
						this.DrawItem(this.m_Grid.CalcRect(num, yOffset), null, builtinResource, flag);
						num++;
						num2++;
					}
					if (num > endIndex)
					{
						break;
					}
					if (num3 >= results.Length)
					{
						break;
					}
					FilteredHierarchy.FilterResult filterItem = results[num3];
					Rect position = this.m_Grid.CalcRect(num, yOffset);
					this.DrawItem(position, filterItem, null, flag);
					num++;
					num3++;
				}
				num2 += results.Length;
				if (this.m_ActiveBuiltinList.Length > 0)
				{
					int num4 = beginIndex - num2;
					num4 = Math.Max(num4, 0);
					int num5 = num4;
					while (num5 < this.m_ActiveBuiltinList.Length && num <= endIndex)
					{
						this.DrawItem(this.m_Grid.CalcRect(num, yOffset), null, this.m_ActiveBuiltinList[num5], flag);
						num++;
						num5++;
					}
				}
				if (!this.ListMode && AssetPreview.IsLoadingAssetPreviews(this.m_Owner.GetAssetPreviewManagerID()))
				{
					this.m_Owner.Repaint();
				}
			}
 private void DrawItem(Rect position, FilteredHierarchy.FilterResult filterItem, BuiltinResource builtinResource, bool isFolderBrowsing)
 {
   Event current = Event.current;
   Rect selectionRect = position;
   int num1 = 0;
   bool flag1 = false;
   if (filterItem != null)
   {
     num1 = filterItem.instanceID;
     flag1 = filterItem.hasChildren && !filterItem.isFolder && isFolderBrowsing;
   }
   else if (builtinResource != null)
     num1 = builtinResource.m_InstanceID;
   int idFromInstanceId = ObjectListArea.LocalGroup.GetControlIDFromInstanceID(num1);
   bool flag2 = !this.m_Owner.allowDragging ? this.m_Owner.IsSelected(num1) : (this.m_DragSelection.Count <= 0 ? this.m_Owner.IsSelected(num1) : this.m_DragSelection.Contains(num1));
   if (flag2 && num1 == this.m_Owner.m_State.m_LastClickedInstanceID)
     this.m_LastClickedDrawTime = EditorApplication.timeSinceStartup;
   Rect position1 = new Rect(position.x + 2f, position.y, 16f, 16f);
   if (flag1 && !this.ListMode)
   {
     float num2 = position.height / 128f;
     float width = 28f * num2;
     float height = 32f * num2;
     position1 = new Rect(position.xMax - width * 0.5f, (float) ((double) position.y + ((double) position.height - (double) ObjectListArea.s_Styles.resultsGridLabel.fixedHeight) * 0.5 - (double) width * 0.5), width, height);
   }
   bool flag3 = false;
   if (flag2 && current.type == EventType.KeyDown && this.m_Owner.HasFocus())
   {
     switch (current.keyCode)
     {
       case KeyCode.RightArrow:
         if (this.ListMode || this.m_Owner.IsPreviewIconExpansionModifierPressed())
         {
           if (!this.IsExpanded(num1))
             flag3 = true;
           current.Use();
           break;
         }
         break;
       case KeyCode.LeftArrow:
         if (this.ListMode || this.m_Owner.IsPreviewIconExpansionModifierPressed())
         {
           if (this.IsExpanded(num1))
             flag3 = true;
           else
             this.SelectAndFrameParentOf(num1);
           current.Use();
           break;
         }
         break;
     }
   }
   if (flag1 && current.type == EventType.MouseDown && (current.button == 0 && position1.Contains(current.mousePosition)))
     flag3 = true;
   if (flag3)
   {
     bool expanded = !this.IsExpanded(num1);
     if (expanded)
       this.m_ItemFader.Start(this.m_FilteredHierarchy.GetSubAssetInstanceIDs(num1));
     this.ChangeExpandedState(num1, expanded);
     current.Use();
     GUIUtility.ExitGUI();
   }
   bool flag4 = this.IsRenaming(num1);
   Rect position2 = position;
   if (!this.ListMode)
     position2 = new Rect(position.x, position.yMax + 1f - ObjectListArea.s_Styles.resultsGridLabel.fixedHeight, position.width - 1f, ObjectListArea.s_Styles.resultsGridLabel.fixedHeight);
   int num3 = !Provider.isActive || !this.ListMode ? 0 : 14;
   float x = 16f;
   if (this.ListMode)
   {
     selectionRect.x = 16f;
     if (filterItem != null && !filterItem.isMainRepresentation && isFolderBrowsing)
     {
       x = 28f;
       selectionRect.x = (float) (28.0 + (double) num3 * 0.5);
     }
     selectionRect.width -= selectionRect.x;
   }
   if (Event.current.type == EventType.Repaint)
   {
     if (this.m_DropTargetControlID == idFromInstanceId && !position.Contains(current.mousePosition))
       this.m_DropTargetControlID = 0;
     bool flag5 = idFromInstanceId == this.m_DropTargetControlID && this.m_DragSelection.IndexOf(this.m_DropTargetControlID) == -1;
     string str = filterItem == null ? builtinResource.m_Name : filterItem.name;
     if (this.ListMode)
     {
       if (flag4)
       {
         flag2 = false;
         str = string.Empty;
       }
       position.width = Mathf.Max(position.width, 500f);
       this.m_Content.text = str;
       this.m_Content.image = (Texture) null;
       Texture2D icon = filterItem == null ? AssetPreview.GetAssetPreview(num1, this.m_Owner.GetAssetPreviewManagerID()) : filterItem.icon;
       if ((UnityEngine.Object) icon == (UnityEngine.Object) null && (UnityEngine.Object) this.m_Owner.GetCreateAssetUtility().icon != (UnityEngine.Object) null)
         icon = this.m_Owner.GetCreateAssetUtility().icon;
       if (flag2)
         ObjectListArea.s_Styles.resultsLabel.Draw(position, GUIContent.none, false, false, flag2, this.m_Owner.HasFocus());
       if (flag5)
         ObjectListArea.s_Styles.resultsLabel.Draw(position, GUIContent.none, true, true, false, false);
       ObjectListArea.LocalGroup.DrawIconAndLabel(new Rect(x, position.y, position.width - x, position.height), filterItem, str, icon, flag2, this.m_Owner.HasFocus());
       if (flag1)
         ObjectListArea.s_Styles.groupFoldout.Draw(position1, !this.ListMode, !this.ListMode, this.IsExpanded(num1), false);
     }
     else
     {
       bool flag6 = false;
       if (this.m_Owner.GetCreateAssetUtility().instanceID == num1 && (UnityEngine.Object) this.m_Owner.GetCreateAssetUtility().icon != (UnityEngine.Object) null)
       {
         this.m_Content.image = (Texture) this.m_Owner.GetCreateAssetUtility().icon;
       }
       else
       {
         this.m_Content.image = (Texture) AssetPreview.GetAssetPreview(num1, this.m_Owner.GetAssetPreviewManagerID());
         if ((UnityEngine.Object) this.m_Content.image != (UnityEngine.Object) null)
           flag6 = true;
         if (filterItem != null)
         {
           if ((UnityEngine.Object) this.m_Content.image == (UnityEngine.Object) null)
             this.m_Content.image = (Texture) filterItem.icon;
           if (isFolderBrowsing && !filterItem.isMainRepresentation)
             flag6 = false;
         }
       }
       float num2 = !flag6 ? 0.0f : 2f;
       position.height -= ObjectListArea.s_Styles.resultsGridLabel.fixedHeight + 2f * num2;
       position.y += num2;
       Rect rect = !((UnityEngine.Object) this.m_Content.image == (UnityEngine.Object) null) ? ObjectListArea.LocalGroup.ActualImageDrawPosition(position, (float) this.m_Content.image.width, (float) this.m_Content.image.height) : new Rect();
       this.m_Content.text = (string) null;
       float a = 1f;
       if (filterItem != null)
       {
         this.AddDirtyStateFor(filterItem.instanceID);
         if (!filterItem.isMainRepresentation && isFolderBrowsing)
         {
           position.x += 4f;
           position.y += 4f;
           position.width -= 8f;
           position.height -= 8f;
           rect = !((UnityEngine.Object) this.m_Content.image == (UnityEngine.Object) null) ? ObjectListArea.LocalGroup.ActualImageDrawPosition(position, (float) this.m_Content.image.width, (float) this.m_Content.image.height) : new Rect();
           a = this.m_ItemFader.GetAlpha(filterItem.instanceID);
           if ((double) a < 1.0)
             this.m_Owner.Repaint();
         }
         if (flag6 && filterItem.iconDrawStyle == IconDrawStyle.NonTexture)
           ObjectListArea.s_Styles.previewBg.Draw(rect, GUIContent.none, false, false, false, false);
       }
       Color color1 = GUI.color;
       if (flag2)
         GUI.color *= new Color(0.85f, 0.9f, 1f);
       if ((UnityEngine.Object) this.m_Content.image != (UnityEngine.Object) null)
       {
         Color color2 = GUI.color;
         if ((double) a < 1.0)
           GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, a);
         ObjectListArea.s_Styles.resultsGrid.Draw(rect, this.m_Content, false, false, flag2, this.m_Owner.HasFocus());
         if ((double) a < 1.0)
           GUI.color = color2;
       }
       if (flag2)
         GUI.color = color1;
       if (flag6)
       {
         Rect position3 = new RectOffset(1, 1, 1, 1).Remove(ObjectListArea.s_Styles.textureIconDropShadow.border.Add(rect));
         ObjectListArea.s_Styles.textureIconDropShadow.Draw(position3, GUIContent.none, false, false, flag2 || flag5, this.m_Owner.HasFocus() || flag4 || flag5);
       }
       if (!flag4)
       {
         if (flag5)
           ObjectListArea.s_Styles.resultsLabel.Draw(new Rect(position2.x - 10f, position2.y, position2.width + 20f, position2.height), GUIContent.none, true, true, false, false);
         string croppedLabelText = this.m_Owner.GetCroppedLabelText(num1, str, position.width);
         ObjectListArea.s_Styles.resultsGridLabel.Draw(position2, croppedLabelText, false, false, flag2, this.m_Owner.HasFocus());
       }
       if (flag1)
         ObjectListArea.s_Styles.subAssetExpandButton.Draw(position1, !this.ListMode, !this.ListMode, this.IsExpanded(num1), false);
       if (filterItem != null && filterItem.isMainRepresentation)
         ProjectHooks.OnProjectWindowItem(filterItem.guid, position);
     }
   }
   if (flag4)
   {
     if (this.ListMode)
     {
       float num2 = (float) (num3 + 16);
       position2.x = selectionRect.x + num2;
       position2.width -= position2.x;
     }
     else
     {
       position2.x -= 4f;
       position2.width += 8f;
     }
     this.m_Owner.GetRenameOverlay().editFieldRect = position2;
     this.m_Owner.HandleRenameOverlay();
   }
   if (EditorApplication.projectWindowItemOnGUI != null && filterItem != null && this.m_Owner.allowUserRenderingHook)
     EditorApplication.projectWindowItemOnGUI(filterItem.guid, selectionRect);
   if (this.m_Owner.allowDragging)
     this.HandleMouseWithDragging(num1, idFromInstanceId, position);
   else
     this.HandleMouseWithoutDragging(num1, idFromInstanceId, position);
 }
예제 #5
0
			private void DrawItem(Rect position, FilteredHierarchy.FilterResult filterItem, BuiltinResource builtinResource, bool isFolderBrowsing)
			{
				Event current = Event.current;
				Rect selectionRect = position;
				int num = 0;
				bool flag = false;
				if (filterItem != null)
				{
					num = filterItem.instanceID;
					flag = (filterItem.hasChildren && !filterItem.isFolder && isFolderBrowsing);
				}
				else
				{
					if (builtinResource != null)
					{
						num = builtinResource.m_InstanceID;
					}
				}
				int controlIDFromInstanceID = ObjectListArea.LocalGroup.GetControlIDFromInstanceID(num);
				bool flag2;
				if (this.m_Owner.allowDragging)
				{
					flag2 = ((this.m_DragSelection.Count <= 0) ? this.m_Owner.IsSelected(num) : this.m_DragSelection.Contains(num));
				}
				else
				{
					flag2 = this.m_Owner.IsSelected(num);
				}
				if (flag2 && num == this.m_Owner.m_State.m_LastClickedInstanceID)
				{
					this.m_LastClickedDrawTime = EditorApplication.timeSinceStartup;
				}
				Rect position2 = new Rect(position.x + 2f, position.y, 16f, 16f);
				if (flag && !this.ListMode)
				{
					float num2 = position.height / 128f;
					float num3 = 28f * num2;
					float height = 32f * num2;
					position2 = new Rect(position.xMax - num3 * 0.5f, position.y + (position.height - ObjectListArea.s_Styles.resultsGridLabel.fixedHeight) * 0.5f - num3 * 0.5f, num3, height);
				}
				bool flag3 = false;
				if (flag2 && current.type == EventType.KeyDown && this.m_Owner.HasFocus())
				{
					KeyCode keyCode = current.keyCode;
					if (keyCode != KeyCode.RightArrow)
					{
						if (keyCode == KeyCode.LeftArrow)
						{
							if (this.ListMode || this.m_Owner.IsPreviewIconExpansionModifierPressed())
							{
								if (this.IsExpanded(num))
								{
									flag3 = true;
								}
								else
								{
									this.SelectAndFrameParentOf(num);
								}
								current.Use();
							}
						}
					}
					else
					{
						if (this.ListMode || this.m_Owner.IsPreviewIconExpansionModifierPressed())
						{
							if (!this.IsExpanded(num))
							{
								flag3 = true;
							}
							current.Use();
						}
					}
				}
				if (flag && current.type == EventType.MouseDown && current.button == 0 && position2.Contains(current.mousePosition))
				{
					flag3 = true;
				}
				if (flag3)
				{
					bool flag4 = !this.IsExpanded(num);
					if (flag4)
					{
						this.m_ItemFader.Start(this.m_FilteredHierarchy.GetSubAssetInstanceIDs(num));
					}
					this.ChangeExpandedState(num, flag4);
					current.Use();
					GUIUtility.ExitGUI();
				}
				bool flag5 = this.IsRenaming(num);
				Rect rect = position;
				if (!this.ListMode)
				{
					rect = new Rect(position.x, position.yMax + 1f - ObjectListArea.s_Styles.resultsGridLabel.fixedHeight, position.width - 1f, ObjectListArea.s_Styles.resultsGridLabel.fixedHeight);
				}
				int num4 = (!Provider.isActive || !this.ListMode) ? 0 : 14;
				float num5 = 16f;
				if (this.ListMode)
				{
					selectionRect.x = 16f;
					if (filterItem != null && !filterItem.isMainRepresentation && isFolderBrowsing)
					{
						num5 = 28f;
						selectionRect.x = 28f + (float)num4 * 0.5f;
					}
					selectionRect.width -= selectionRect.x;
				}
				if (Event.current.type == EventType.Repaint)
				{
					if (this.m_DropTargetControlID == controlIDFromInstanceID && !position.Contains(current.mousePosition))
					{
						this.m_DropTargetControlID = 0;
					}
					bool flag6 = controlIDFromInstanceID == this.m_DropTargetControlID;
					string text = (filterItem == null) ? builtinResource.m_Name : filterItem.name;
					if (this.ListMode)
					{
						if (flag5)
						{
							flag2 = false;
							text = string.Empty;
						}
						position.width = Mathf.Max(position.width, 500f);
						this.m_Content.text = text;
						this.m_Content.image = null;
						Texture2D texture2D = (filterItem == null) ? AssetPreview.GetAssetPreview(num, this.m_Owner.GetAssetPreviewManagerID()) : filterItem.icon;
						if (texture2D == null && this.m_Owner.GetCreateAssetUtility().icon != null)
						{
							texture2D = this.m_Owner.GetCreateAssetUtility().icon;
						}
						if (flag2)
						{
							ObjectListArea.s_Styles.resultsLabel.Draw(position, GUIContent.none, false, false, flag2, this.m_Owner.HasFocus());
						}
						if (flag6)
						{
							ObjectListArea.s_Styles.resultsLabel.Draw(position, GUIContent.none, true, true, false, false);
						}
						ObjectListArea.LocalGroup.DrawIconAndLabel(new Rect(num5, position.y, position.width - num5, position.height), filterItem, text, texture2D, flag2, this.m_Owner.HasFocus());
						if (flag)
						{
							ObjectListArea.s_Styles.groupFoldout.Draw(position2, !this.ListMode, !this.ListMode, this.IsExpanded(num), false);
						}
					}
					else
					{
						bool flag7 = false;
						if (this.m_Owner.GetCreateAssetUtility().instanceID == num && this.m_Owner.GetCreateAssetUtility().icon != null)
						{
							this.m_Content.image = this.m_Owner.GetCreateAssetUtility().icon;
						}
						else
						{
							this.m_Content.image = AssetPreview.GetAssetPreview(num, this.m_Owner.GetAssetPreviewManagerID());
							if (this.m_Content.image != null)
							{
								flag7 = true;
							}
							if (filterItem != null)
							{
								if (this.m_Content.image == null)
								{
									this.m_Content.image = filterItem.icon;
								}
								if (isFolderBrowsing && !filterItem.isMainRepresentation)
								{
									flag7 = false;
								}
							}
						}
						float num6 = (!flag7) ? 0f : 2f;
						position.height -= ObjectListArea.s_Styles.resultsGridLabel.fixedHeight + 2f * num6;
						position.y += num6;
						Rect rect2 = (!(this.m_Content.image == null)) ? ObjectListArea.LocalGroup.ActualImageDrawPosition(position, (float)this.m_Content.image.width, (float)this.m_Content.image.height) : default(Rect);
						this.m_Content.text = null;
						float num7 = 1f;
						if (filterItem != null)
						{
							this.AddDirtyStateFor(filterItem.instanceID);
							if (!filterItem.isMainRepresentation && isFolderBrowsing)
							{
								position.x += 4f;
								position.y += 4f;
								position.width -= 8f;
								position.height -= 8f;
								rect2 = ((!(this.m_Content.image == null)) ? ObjectListArea.LocalGroup.ActualImageDrawPosition(position, (float)this.m_Content.image.width, (float)this.m_Content.image.height) : default(Rect));
								num7 = this.m_ItemFader.GetAlpha(filterItem.instanceID);
								if (num7 < 1f)
								{
									this.m_Owner.Repaint();
								}
							}
							if (flag7 && filterItem.iconDrawStyle == IconDrawStyle.NonTexture)
							{
								ObjectListArea.s_Styles.previewBg.Draw(rect2, GUIContent.none, false, false, false, false);
							}
						}
						Color color = GUI.color;
						if (flag2)
						{
							GUI.color *= new Color(0.85f, 0.9f, 1f);
						}
						if (this.m_Content.image != null)
						{
							Color color2 = GUI.color;
							if (num7 < 1f)
							{
								GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, num7);
							}
							ObjectListArea.s_Styles.resultsGrid.Draw(rect2, this.m_Content, false, false, flag2, this.m_Owner.HasFocus());
							if (num7 < 1f)
							{
								GUI.color = color2;
							}
						}
						if (flag2)
						{
							GUI.color = color;
						}
						if (flag7)
						{
							Rect position3 = new RectOffset(1, 1, 1, 1).Remove(ObjectListArea.s_Styles.textureIconDropShadow.border.Add(rect2));
							ObjectListArea.s_Styles.textureIconDropShadow.Draw(position3, GUIContent.none, false, false, flag2 || flag6, this.m_Owner.HasFocus() || flag5 || flag6);
						}
						if (!flag5)
						{
							text = this.m_Owner.GetCroppedLabelText(num, text, position.width);
							ObjectListArea.s_Styles.resultsGridLabel.Draw(rect, text, false, false, flag2, this.m_Owner.HasFocus());
						}
						if (flag)
						{
							ObjectListArea.s_Styles.subAssetExpandButton.Draw(position2, !this.ListMode, !this.ListMode, this.IsExpanded(num), false);
						}
						if (filterItem != null && filterItem.isMainRepresentation)
						{
							ProjectHooks.OnProjectWindowItem(filterItem.guid, position);
						}
					}
				}
				if (flag5)
				{
					if (this.ListMode)
					{
						float num8 = (float)(num4 + 16);
						rect.x = selectionRect.x + num8;
						rect.width -= rect.x;
					}
					else
					{
						rect.x -= 4f;
						rect.width += 8f;
					}
					this.m_Owner.GetRenameOverlay().editFieldRect = rect;
					this.m_Owner.HandleRenameOverlay();
				}
				if (EditorApplication.projectWindowItemOnGUI != null && filterItem != null && this.m_Owner.allowUserRenderingHook)
				{
					EditorApplication.projectWindowItemOnGUI(filterItem.guid, selectionRect);
				}
				if (this.m_Owner.allowDragging)
				{
					this.HandleMouseWithDragging(num, controlIDFromInstanceID, position);
				}
				else
				{
					this.HandleMouseWithoutDragging(num, controlIDFromInstanceID, position);
				}
			}