protected override void Update()
        {
            base.Update();

            if (IsBound)
            {
                float time = Time.realtimeSinceStartup;
                if (isDirty)
                {
                    // Rebind to refresh the exposed variables in Inspector
                    object inspectedObject = m_inspectedObject;
                    StopInspect();
                    Inspect(inspectedObject);

                    isDirty         = false;
                    nextRefreshTime = time + refreshInterval;
                }
                else
                {
                    if (time > nextRefreshTime)
                    {
                        nextRefreshTime = time + refreshInterval;
                        Refresh();
                    }
                }

                // Check if a pointer has remained static over a drawer for a while; if so, show a tooltip
                if (hoveringPointer != null)
                {
                    Vector2 pointerDelta = hoveringPointer.delta;
                    if (pointerDelta.x != 0f || pointerDelta.y != 0f)
                    {
                        hoveredDrawerTooltipShowTime = time + m_tooltipDelay;
                    }
                    else if (time > hoveredDrawerTooltipShowTime)
                    {
                        // Make sure that everything is OK
                        if (!hoveredDrawer || !hoveredDrawer.gameObject.activeSelf)
                        {
                            hoveredDrawer   = null;
                            hoveringPointer = null;
                        }
                        else
                        {
                            RuntimeInspectorUtils.ShowTooltip(hoveredDrawer.NameRaw, hoveringPointer, Skin, m_canvas);

                            // Don't show the tooltip again until the pointer moves
                            hoveredDrawerTooltipShowTime = float.PositiveInfinity;
                        }
                    }
                }
            }
            else if (currentDrawer != null)
            {
                StopInspect();
            }
        }
Пример #2
0
        private void Update()
        {
            // Check if a pointer has remained static over a drawer for a while; if so, show a tooltip
            float time = Time.realtimeSinceStartup;

            if (hoveringPointer != null)
            {
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
                // PointerEventData.delta isn't set to (0,0) for static pointers in the new Input System, so we use the active Pointer's delta instead
                // The default value isn't Vector2.zero but Vector2.one because we don't want to show tooltip if there is no pointer
                Vector2 pointerDelta = Pointer.current != null?Pointer.current.delta.ReadValue() : Vector2.one;
#else
                Vector2 pointerDelta = hoveringPointer.delta;
#endif
                if (pointerDelta.x != 0f || pointerDelta.y != 0f)
                {
                    hoveredDrawerTooltipShowTime = time + manager.TooltipDelay;
                }
                else if (time > hoveredDrawerTooltipShowTime)
                {
                    // Make sure that everything is OK
                    if (!hoveredDrawer.IsActive)
                    {
                        hoveredDrawer   = null;
                        hoveringPointer = null;
                    }
                    else
                    {
                        RuntimeInspectorUtils.ShowTooltip(hoveredDrawer.TooltipText, hoveringPointer, manager.Skin, manager.Canvas);

                        // Don't show the tooltip again until the pointer moves
                        hoveredDrawerTooltipShowTime = float.PositiveInfinity;
                    }
                }
            }
        }
Пример #3
0
        protected override void Update()
        {
            base.Update();

            if (IsBound)
            {
                float time = Time.realtimeSinceStartup;
                if (isDirty)
                {
                    // Rebind to refresh the exposed variables in Inspector
                    object inspectedObject = m_inspectedObject;
                    StopInspect();
                    Inspect(inspectedObject);

                    isDirty         = false;
                    nextRefreshTime = time + refreshInterval;
                }
                else
                {
                    if (time > nextRefreshTime)
                    {
                        nextRefreshTime = time + refreshInterval;
                        Refresh();
                    }
                }

                // Check if a pointer has remained static over a drawer for a while; if so, show a tooltip
                if (hoveringPointer != null)
                {
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
                    // PointerEventData.delta isn't set to (0,0) for static pointers in the new Input System, so we use the active Pointer's delta instead
                    // The default value isn't Vector2.zero but Vector2.one because we don't want to show tooltip if there is no pointer
                    Vector2 pointerDelta = Pointer.current != null?Pointer.current.delta.ReadValue() : Vector2.one;
#else
                    Vector2 pointerDelta = hoveringPointer.delta;
#endif
                    if (pointerDelta.x != 0f || pointerDelta.y != 0f)
                    {
                        hoveredDrawerTooltipShowTime = time + m_tooltipDelay;
                    }
                    else if (time > hoveredDrawerTooltipShowTime)
                    {
                        // Make sure that everything is OK
                        if (!hoveredDrawer || !hoveredDrawer.gameObject.activeSelf)
                        {
                            hoveredDrawer   = null;
                            hoveringPointer = null;
                        }
                        else
                        {
                            RuntimeInspectorUtils.ShowTooltip(hoveredDrawer.NameRaw, hoveringPointer, Skin, m_canvas);

                            // Don't show the tooltip again until the pointer moves
                            hoveredDrawerTooltipShowTime = float.PositiveInfinity;
                        }
                    }
                }
            }
            else if (currentDrawer != null)
            {
                StopInspect();
            }
        }