Exemplo n.º 1
0
        private void Update()
        {
            if (!_setting_showHoverPreview)
            {
                return;
            }

            if (_lastGUID == null && _currentGUID == null)
            {
                return;
            }

            if (_lastGUID != _currentGUID)
            {
                _lastGUID = _currentGUID;

                TeneEnhPreviewWindow.Update(
                    Common.ProjectWindow.position,
                    _mousePosition,
                    pGUID: _currentGUID
                    );
            }
            else
            {
                _updateThrottle++;
                if (_updateThrottle > 20)
                {
                    _currentGUID = null;
                    Common.ProjectWindow.Repaint();
                    _updateThrottle = 0;
                }
            }
        }
Exemplo n.º 2
0
    public static void Update( Rect pAnchorTo, Vector2 pMousePosition, string pGUID = null, Object pAsset = null )
    {
        if( ( pGUID == null && pAsset == null )
            || !CanShowPreviewFor(pGUID:pGUID, pAsset:pAsset)
        )
        {
            if( _window != null )
            {
                _window.Close();
                _window = null;
            }

            return;
        }

        if( _window == null )
            _window = EditorWindow.GetWindow<TeneEnhPreviewWindow>( true );

        _window.SetPosition( pAnchorTo, pMousePosition );
        _window.SetPreview( pGUID: pGUID, pAsset: pAsset );
    }
    public static void Update(Rect pAnchorTo, Vector2 pMousePosition, string pGUID = null, Object pAsset = null)
    {
        if ((pGUID == null && pAsset == null) ||
            !CanShowPreviewFor(pGUID: pGUID, pAsset: pAsset)
            )
        {
            if (_window != null)
            {
                _window.Close();
                _window = null;
            }

            return;
        }

        if (_window == null)
        {
            _window = EditorWindow.GetWindow <TeneEnhPreviewWindow>(true);
        }

        _window.SetPosition(pAnchorTo, pMousePosition);
        _window.SetPreview(pGUID: pGUID, pAsset: pAsset);
    }
Exemplo n.º 4
0
        private void Update()
        {
            bool nowDragging = DragAndDrop.objectReferences.Length == 1;

            if (_wasDragging != nowDragging)
            {
                // detect when dragging state changes, so we force a refresh of the hierarchy
                _wasDragging = nowDragging;

                if (!nowDragging)
                {
                    _draggingHeldOver            = null;
                    _draggingShownQuickInspector = false;
                }

                // doesn't appear to refresh when starting to drag stuff
                // but works ok when finishing
                Common.HierarchyWindow.Repaint();
            }

            if (_lastHoverObject != null || _hoverObject != null)
            {
                if (_lastHoverObject != _hoverObject)
                {
                    // don't currently support plain old gameobjects
                    if (_hoverObject is GameObject)
                    {
                        if (PrefabUtility.GetPrefabParent(_hoverObject) == null)
                        {
                            _hoverObject = null;
                        }
                    }
                }

                if (_lastHoverObject != _hoverObject)
                {
                    _lastHoverObject = _hoverObject;

                    TeneEnhPreviewWindow.Update(
                        Common.HierarchyWindow.position,
                        _mousePosition,
                        pAsset: _hoverObject
                        );
                }
                else
                {
                    _updateThrottle++;
                    if (_updateThrottle > 20)
                    {
                        _hoverObject = null;
                        Common.HierarchyWindow.Repaint();
                        _updateThrottle = 0;
                    }
                }
            }

            if (_draggingHeldOver != null)
            {
                if (!_draggingShownQuickInspector)
                {
                    if ((System.DateTime.Now - _draggingHeldStart).TotalSeconds >= 0.5f)
                    {
                        // user held mouse over a game object, so we can show the
                        // quick-drop popup window

                        TeneDropTarget.Update(
                            Common.HierarchyWindow.position,
                            _mousePosition,
                            _draggingHeldOver
                            );

                        _draggingShownQuickInspector = true;
                    }
                }
            }
        }