public static void ShowTooltip(string tooltip, PointerEventData pointer, UISkin skin = null, Canvas referenceCanvas = null)
        {
            bool hasCanvasChanged = CreatePopupCanvas(referenceCanvas);

            if (!tooltipPopup)
            {
                //tooltipPopup = (Tooltip) Object.Instantiate( Resources.Load<Tooltip>( "RuntimeInspector/Tooltip" ), popupCanvas.transform, false );
                tooltipPopup     = (Tooltip)Object.Instantiate(RuntimeInspector.GetTooltip(), popupCanvas.transform, false);
                hasCanvasChanged = true;
            }
            else
            {
                tooltipPopup.gameObject.SetActive(true);
            }

            if (hasCanvasChanged)
            {
                tooltipPopup.Initialize(popupCanvas);
            }

            if (skin)
            {
                tooltipPopup.Skin = skin;
            }

            tooltipPopup.SetContent(tooltip, pointer);
        }
        public static DraggedReferenceItem CreateDraggedReferenceItem(Object reference, PointerEventData draggingPointer, UISkin skin = null, Canvas referenceCanvas = null)
        {
            bool hasCanvasChanged = CreatePopupCanvas(referenceCanvas);

            DraggedReferenceItem referenceItem;

            if (draggedReferenceItemsPool.Count > 0)
            {
                referenceItem = draggedReferenceItemsPool.Pop();
                referenceItem.gameObject.SetActive(true);
            }
            else
            {
                //referenceItem = (DraggedReferenceItem) Object.Instantiate( Resources.Load<DraggedReferenceItem>( "RuntimeInspector/DraggedReferenceItem" ), popupCanvas.transform, false );
                referenceItem    = (DraggedReferenceItem)Object.Instantiate(RuntimeInspector.GetDraggedReferenceItem(), popupCanvas.transform, false);
                hasCanvasChanged = true;
            }

            if (hasCanvasChanged)
            {
                referenceItem.Initialize(popupCanvas);
            }

            if (skin)
            {
                referenceItem.Skin = skin;
            }

            referenceItem.SetContent(reference, draggingPointer);

            draggingPointer.dragging         = true;
            draggingPointer.eligibleForClick = false;

            return(referenceItem);
        }
Esempio n. 3
0
        private static IEnumerator RemoveComponentCoroutine(Component component, RuntimeInspector inspector)
        {
            Destroy(component);

            // Destroy operation doesn't take place immediately, wait for the component to be fully destroyed
            yield return(null);

            inspector.Refresh();
            inspector.EnsureScrollViewIsWithinBounds();             // Scroll view's contents can get out of bounds after removing a component
        }