private void DoPreviewPopup(PackageImportTreeView.PackageImportTreeViewItem pitem, Rect rowRect)
            {
                ImportPackageItem item = pitem.item;

                if (item != null)
                {
                    if (((Event.current.type == EventType.MouseDown) && rowRect.Contains(Event.current.mousePosition)) && !PopupWindowWithoutFocus.IsVisible())
                    {
                        this.showPreviewForID = pitem.id;
                    }
                    if ((pitem.id == this.showPreviewForID) && (Event.current.type != EventType.Layout))
                    {
                        this.showPreviewForID = 0;
                        if (!string.IsNullOrEmpty(item.previewPath))
                        {
                            Texture2D preview       = PackageImport.GetPreview(item.previewPath);
                            Rect      activatorRect = rowRect;
                            activatorRect.width = EditorGUIUtility.currentViewWidth;
                            PopupLocationHelper.PopupLocation[] locationPriorityOrder = new PopupLocationHelper.PopupLocation[3];
                            locationPriorityOrder[0] = PopupLocationHelper.PopupLocation.Right;
                            locationPriorityOrder[1] = PopupLocationHelper.PopupLocation.Left;
                            PopupWindowWithoutFocus.Show(activatorRect, new PackageImportTreeView.PreviewPopup(preview), locationPriorityOrder);
                        }
                    }
                }
            }
示例#2
0
            private void DoPreviewPopup(PackageImportTreeView.PackageImportTreeViewItem pitem, Rect rowRect)
            {
                ImportPackageItem item = pitem.item;

                if (item != null)
                {
                    if (Event.current.type == EventType.MouseDown && rowRect.Contains(Event.current.mousePosition) && !PopupWindowWithoutFocus.IsVisible())
                    {
                        this.showPreviewForID = pitem.id;
                    }
                    if (pitem.id == this.showPreviewForID && Event.current.type != EventType.Layout)
                    {
                        this.showPreviewForID = 0;
                        if (!string.IsNullOrEmpty(item.previewPath))
                        {
                            Texture2D preview = PackageImport.GetPreview(item.previewPath);
                            Rect      rect    = rowRect;
                            rect.width = EditorGUIUtility.currentViewWidth;
                            Rect arg_AF_0 = rect;
                            PopupWindowContent arg_AF_1 = new PackageImportTreeView.PreviewPopup(preview);
                            PopupLocationHelper.PopupLocation[] expr_A7 = new PopupLocationHelper.PopupLocation[3];
                            expr_A7[0] = PopupLocationHelper.PopupLocation.Right;
                            expr_A7[1] = PopupLocationHelper.PopupLocation.Left;
                            PopupWindowWithoutFocus.Show(arg_AF_0, arg_AF_1, expr_A7);
                        }
                    }
                }
            }
		public static Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
		{
			if (locationPriorityOrder == null)
			{
				locationPriorityOrder = new PopupLocationHelper.PopupLocation[]
				{
					PopupLocationHelper.PopupLocation.Below,
					PopupLocationHelper.PopupLocation.Above
				};
			}
			List<Rect> list = new List<Rect>();
			PopupLocationHelper.PopupLocation[] array = locationPriorityOrder;
			for (int i = 0; i < array.Length; i++)
			{
				switch (array[i])
				{
				case PopupLocationHelper.PopupLocation.Below:
				{
					Rect rect;
					if (PopupLocationHelper.PopupBelow(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
					{
						return rect;
					}
					list.Add(rect);
					break;
				}
				case PopupLocationHelper.PopupLocation.Above:
				{
					Rect rect;
					if (PopupLocationHelper.PopupAbove(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
					{
						return rect;
					}
					list.Add(rect);
					break;
				}
				case PopupLocationHelper.PopupLocation.Left:
				{
					Rect rect;
					if (PopupLocationHelper.PopupLeft(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
					{
						return rect;
					}
					list.Add(rect);
					break;
				}
				case PopupLocationHelper.PopupLocation.Right:
				{
					Rect rect;
					if (PopupLocationHelper.PopupRight(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
					{
						return rect;
					}
					list.Add(rect);
					break;
				}
				}
			}
			return PopupLocationHelper.GetLargestRect(list);
		}
示例#4
0
 private void Init(Rect buttonRect)
 {
     buttonRect = GUIUtility.GUIToScreenRect(buttonRect);
     PopupLocationHelper.PopupLocation[] locationPriorityOrder = new PopupLocationHelper.PopupLocation[] { PopupLocationHelper.PopupLocation.Right };
     base.ShowAsDropDown(buttonRect, this.windowSize, locationPriorityOrder);
     base.Focus();
     base.m_Parent.AddToAuxWindowList();
     base.wantsMouseMove = true;
 }
 private void Init(Rect buttonRect)
 {
     buttonRect = GUIUtility.GUIToScreenRect(buttonRect);
     PopupLocationHelper.PopupLocation[] locationPriorityOrder = new PopupLocationHelper.PopupLocation[] { PopupLocationHelper.PopupLocation.Right };
     base.ShowAsDropDown(buttonRect, this.windowSize, locationPriorityOrder);
     base.Focus();
     base.m_Parent.AddToAuxWindowList();
     base.wantsMouseMove = true;
 }
            public override Rect OnRowGUI(TreeViewItem node, int row, float rowWidth, bool selected, bool focused)
            {
                Rect rect = new Rect(0f, (float)row * this.k_LineHeight, rowWidth, this.k_LineHeight);

                this.DoNodeGUI(rect, node, selected, focused, false);
                PackageImportTreeView.PackageImportTreeViewItem packageImportTreeViewItem = node as PackageImportTreeView.PackageImportTreeViewItem;
                if (packageImportTreeViewItem != null)
                {
                    Rect toggleRect = new Rect(2f, rect.y, rect.height, rect.height);
                    EditorGUI.BeginChangeCheck();
                    PackageImportTreeView.PackageImportTreeViewGUI.Toggle(packageImportTreeViewItem, toggleRect);
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (this.m_TreeView.GetSelection().Length <= 1 || !this.m_TreeView.GetSelection().Contains(packageImportTreeViewItem.id))
                        {
                            this.m_TreeView.SetSelection(new int[]
                            {
                                packageImportTreeViewItem.id
                            }, false);
                            this.m_TreeView.NotifyListenersThatSelectionChanged();
                        }
                        if (this.itemWasToggled != null)
                        {
                            this.itemWasToggled(packageImportTreeViewItem);
                        }
                        Event.current.Use();
                    }
                    if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition) && !PopupWindowWithoutFocus.IsVisible())
                    {
                        this.showPreviewForID = packageImportTreeViewItem.id;
                    }
                    if (packageImportTreeViewItem.id == this.showPreviewForID && Event.current.type != EventType.Layout)
                    {
                        this.showPreviewForID = 0;
                        if (!string.IsNullOrEmpty(packageImportTreeViewItem.item.previewPath))
                        {
                            Texture2D preview = PackageImport.GetPreview(packageImportTreeViewItem.item.previewPath);
                            Rect      rect2   = rect;
                            rect2.width = EditorGUIUtility.currentViewWidth;
                            Rect arg_190_0 = rect2;
                            PopupWindowContent arg_190_1 = new PackageImportTreeView.PreviewPopup(preview);
                            PopupLocationHelper.PopupLocation[] expr_188 = new PopupLocationHelper.PopupLocation[3];
                            expr_188[0] = PopupLocationHelper.PopupLocation.Right;
                            expr_188[1] = PopupLocationHelper.PopupLocation.Left;
                            PopupWindowWithoutFocus.Show(arg_190_0, arg_190_1, expr_188);
                        }
                    }
                    if (packageImportTreeViewItem.item.exists == 0)
                    {
                        Texture image = this.constants.badgeNew.image;
                        GUI.DrawTexture(new Rect(rect.xMax - (float)image.width - 6f, rect.y + (rect.height - (float)image.height) / 2f, (float)image.width, (float)image.height), image);
                    }
                }
                return(rect);
            }
示例#7
0
        public static Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
        {
            if (locationPriorityOrder == null)
            {
                locationPriorityOrder = new PopupLocationHelper.PopupLocation[2]
                {
                    PopupLocationHelper.PopupLocation.Below,
                    PopupLocationHelper.PopupLocation.Above
                }
            }
            ;
            List <Rect> rects = new List <Rect>();
            Rect        resultRect;

            foreach (int num in locationPriorityOrder)
            {
                switch (num)
                {
                case 0:
                    if (PopupLocationHelper.PopupBelow(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;

                case 1:
                    if (PopupLocationHelper.PopupAbove(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;

                case 2:
                    if (PopupLocationHelper.PopupLeft(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;

                case 3:
                    if (PopupLocationHelper.PopupRight(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;
                }
            }
            return(PopupLocationHelper.GetLargestRect(rects));
        }
 public static Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
 {
   if (locationPriorityOrder == null)
     locationPriorityOrder = new PopupLocationHelper.PopupLocation[2]
     {
       PopupLocationHelper.PopupLocation.Below,
       PopupLocationHelper.PopupLocation.Above
     };
   List<Rect> rects = new List<Rect>();
   Rect resultRect;
   foreach (int num in locationPriorityOrder)
   {
     switch (num)
     {
       case 0:
         if (PopupLocationHelper.PopupBelow(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
           return resultRect;
         rects.Add(resultRect);
         break;
       case 1:
         if (PopupLocationHelper.PopupAbove(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
           return resultRect;
         rects.Add(resultRect);
         break;
       case 2:
         if (PopupLocationHelper.PopupLeft(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
           return resultRect;
         rects.Add(resultRect);
         break;
       case 3:
         if (PopupLocationHelper.PopupRight(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
           return resultRect;
         rects.Add(resultRect);
         break;
     }
   }
   return PopupLocationHelper.GetLargestRect(rects);
 }
        public static Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
        {
            if (locationPriorityOrder == null)
            {
                locationPriorityOrder = new PopupLocationHelper.PopupLocation[]
                {
                    PopupLocationHelper.PopupLocation.Below,
                    PopupLocationHelper.PopupLocation.Above
                };
            }
            List <Rect> list = new List <Rect>();

            PopupLocationHelper.PopupLocation[] array = locationPriorityOrder;
            for (int i = 0; i < array.Length; i++)
            {
                switch (array[i])
                {
                case PopupLocationHelper.PopupLocation.Below:
                {
                    Rect rect;
                    if (PopupLocationHelper.PopupBelow(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
                    {
                        return(rect);
                    }
                    list.Add(rect);
                    break;
                }

                case PopupLocationHelper.PopupLocation.Above:
                {
                    Rect rect;
                    if (PopupLocationHelper.PopupAbove(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
                    {
                        return(rect);
                    }
                    list.Add(rect);
                    break;
                }

                case PopupLocationHelper.PopupLocation.Left:
                {
                    Rect rect;
                    if (PopupLocationHelper.PopupLeft(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
                    {
                        return(rect);
                    }
                    list.Add(rect);
                    break;
                }

                case PopupLocationHelper.PopupLocation.Right:
                {
                    Rect rect;
                    if (PopupLocationHelper.PopupRight(buttonRect, minSize, maxSize, popupContainerWindow, out rect))
                    {
                        return(rect);
                    }
                    list.Add(rect);
                    break;
                }
                }
            }
            return(PopupLocationHelper.GetLargestRect(list));
        }
示例#10
0
 private void Init(Rect buttonRect)
 {
     buttonRect = GUIUtility.GUIToScreenRect(buttonRect);
     PopupLocationHelper.PopupLocation[] locationPriorityOrder = new PopupLocationHelper.PopupLocation[] { PopupLocationHelper.PopupLocation.Right };
     base.ShowAsDropDown(buttonRect, windowSize, locationPriorityOrder);
 }
示例#11
0
 private void Init(Rect buttonRect)
 {
     buttonRect = GUIUtility.GUIToScreenRect(buttonRect);
     PopupLocationHelper.PopupLocation[] locationPriorityOrder = new PopupLocationHelper.PopupLocation[] { PopupLocationHelper.PopupLocation.Right };
     base.ShowAsDropDown(buttonRect, windowSize, locationPriorityOrder);
 }
			public override Rect OnRowGUI(TreeViewItem node, int row, float rowWidth, bool selected, bool focused)
			{
				Rect rect = new Rect(0f, (float)row * this.k_LineHeight, rowWidth, this.k_LineHeight);
				this.DoNodeGUI(rect, node, selected, focused, false);
				PackageImportTreeView.PackageImportTreeViewItem packageImportTreeViewItem = node as PackageImportTreeView.PackageImportTreeViewItem;
				if (packageImportTreeViewItem != null)
				{
					Rect toggleRect = new Rect(2f, rect.y, rect.height, rect.height);
					EditorGUI.BeginChangeCheck();
					PackageImportTreeView.PackageImportTreeViewGUI.Toggle(packageImportTreeViewItem, toggleRect);
					if (EditorGUI.EndChangeCheck())
					{
						if (this.m_TreeView.GetSelection().Length <= 1 || !this.m_TreeView.GetSelection().Contains(packageImportTreeViewItem.id))
						{
							this.m_TreeView.SetSelection(new int[]
							{
								packageImportTreeViewItem.id
							}, false);
							this.m_TreeView.NotifyListenersThatSelectionChanged();
						}
						if (this.itemWasToggled != null)
						{
							this.itemWasToggled(packageImportTreeViewItem);
						}
						Event.current.Use();
					}
					if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition) && !PopupWindowWithoutFocus.IsVisible())
					{
						this.showPreviewForID = packageImportTreeViewItem.id;
					}
					if (packageImportTreeViewItem.id == this.showPreviewForID && Event.current.type != EventType.Layout)
					{
						this.showPreviewForID = 0;
						if (!string.IsNullOrEmpty(packageImportTreeViewItem.item.previewPath))
						{
							Texture2D preview = PackageImport.GetPreview(packageImportTreeViewItem.item.previewPath);
							Rect rect2 = rect;
							rect2.width = EditorGUIUtility.currentViewWidth;
							Rect arg_190_0 = rect2;
							PopupWindowContent arg_190_1 = new PackageImportTreeView.PreviewPopup(preview);
							PopupLocationHelper.PopupLocation[] expr_188 = new PopupLocationHelper.PopupLocation[3];
							expr_188[0] = PopupLocationHelper.PopupLocation.Right;
							expr_188[1] = PopupLocationHelper.PopupLocation.Left;
							PopupWindowWithoutFocus.Show(arg_190_0, arg_190_1, expr_188);
						}
					}
					if (packageImportTreeViewItem.item.exists == 0)
					{
						Texture image = this.constants.badgeNew.image;
						GUI.DrawTexture(new Rect(rect.xMax - (float)image.width - 6f, rect.y + (rect.height - (float)image.height) / 2f, (float)image.width, (float)image.height), image);
					}
				}
				return rect;
			}