StopDebugging() private method

private StopDebugging ( ) : void
return void
        private void OnWindowSelected(object userdata, string[] options, int selected)
        {
            selected--;
            GUIView gUIView;

            if (selected >= 0)
            {
                List <GUIView> list = (List <GUIView>)userdata;
                gUIView = list[selected];
            }
            else
            {
                gUIView = null;
            }
            if (this.m_Inspected != gUIView)
            {
                if (this.m_InstructionOverlayWindow != null)
                {
                    this.m_InstructionOverlayWindow.Close();
                }
                this.m_Inspected = gUIView;
                if (this.m_Inspected != null)
                {
                    GUIViewDebuggerHelper.DebugWindow(this.m_Inspected);
                    this.m_Inspected.Repaint();
                }
                else
                {
                    GUIViewDebuggerHelper.StopDebugging();
                }
                this.instructionModeView.Unselect();
            }
            base.Repaint();
        }
 private void OnDisable()
 {
     GUIViewDebuggerHelper.StopDebugging();
     if (this.m_InstructionOverlayWindow != null)
     {
         this.m_InstructionOverlayWindow.Close();
     }
 }
Ejemplo n.º 3
0
        private void UpdateExploredGUIStyle(Vector2 screenPos)
        {
            GUIView mouseUnderView = GetViewUnderMouse(screenPos, m_ExploredViews);

            ExploredDrawInstructionIndex = -1;
            ExploredStyle = null;
            if (mouseUnderView != m_ExploredView)
            {
                if (m_ExploredView)
                {
                    GUIViewDebuggerHelper.StopDebugging();
                    // Debug.Log("Stop debugging: " + GetViewName(m_ExploredView));
                }

                m_ExploredView = CanInspectView(mouseUnderView) ? mouseUnderView : null;

                if (m_ExploredView)
                {
                    // Start debugging
                    GUIViewDebuggerHelper.DebugWindow(m_ExploredView);
                    // Debug.Log("Start debugging: " + GetViewName(m_ExploredView));

                    // Since we have attached the debugger, this view hasn't logged its repaint steps yet.
                    m_ExploredView.Repaint();
                }
            }

            if (m_ExploredView)
            {
                var drawInstructions = new List <IMGUIDrawInstruction>();
                GUIViewDebuggerHelper.GetDrawInstructions(drawInstructions);

                var localPosition = new Vector2(screenPos.x - mouseUnderView.screenPosition.x,
                                                screenPos.y - mouseUnderView.screenPosition.y);
                GUIStyle mouseUnderStyle = null;

                /** Note: no perfect way to find the style under cursor:
                 *  - Lots of style rect overlap
                 *  - by starting with the end, we hope to follow the "Last drawn instruction is the one on top"
                 *  - Some styles are "transparent" and drawn last (TabWindowBackground and such)
                 *  - We try to go with the smallest rect that fits
                 */
                Rect styleRect        = new Rect(0, 0, 10000, 10000);
                var  smallestRectArea = styleRect.width * styleRect.height;
                for (var i = drawInstructions.Count - 1; i >= 0; --i)
                {
                    var instr = drawInstructions[i];
                    if (instr.rect.Contains(localPosition) && smallestRectArea > instr.rect.width * instr.rect.height)
                    {
                        mouseUnderStyle              = instr.usedGUIStyle;
                        styleRect                    = instr.rect;
                        smallestRectArea             = instr.rect.width * instr.rect.height;
                        ExploredDrawInstructionIndex = i;

                        // Debug.Log(GetViewName(m_ExploredView) + " - Found Style: " + instr.usedGUIStyle.name);
                    }
                }

                if (Highlighter != null && mouseUnderStyle != null)
                {
                    var visualElement = m_ExploredView.windowBackend.visualTree as VisualElement;
                    if (visualElement != null)
                    {
                        // Debug.Log(GetViewName(m_ExploredView) + " - Highlight Style: " + mouseUnderStyle.name);
                        Highlighter.HighlightElement(visualElement, styleRect, mouseUnderStyle);
                    }
                }

                ExploredStyle = mouseUnderStyle;
            }
        }
Ejemplo n.º 4
0
 private void OnDisable()
 {
     GUIViewDebuggerHelper.onViewInstructionsChanged = (Action)Delegate.Remove(GUIViewDebuggerHelper.onViewInstructionsChanged, new Action(this.OnInspectedViewChanged));
     GUIViewDebuggerHelper.StopDebugging();
     this.ClearInstructionHighlighter();
 }