internal override bool EndRepaint() { bool result; if (!base.enabled) { result = false; } else { PanelDebug.RepaintData repaintData = null; foreach (PanelDebug.RepaintData current in this.m_RepaintDatas) { Color c = current.color; if (this.highlightedElement != 0u) { if (this.highlightedElement == current.controlId) { repaintData = current; continue; } c = Color.gray; } PickingData.DrawRect(current.contentRect, c); } this.m_RepaintDatas.Clear(); if (repaintData != null) { PickingData.DrawRect(repaintData.contentRect, repaintData.color); } result = true; } return(result); }
private void EndPicking(ViewPanel?viewPanel) { bool expand = !viewPanel.Equals(m_CurPanel); m_CurPanel = viewPanel; if (m_CurPanel.HasValue) { m_LastWindowTitle = PickingData.GetName(m_CurPanel.Value); if (m_CurPanel.Value.Panel.panelDebug == null) { m_CurPanel.Value.Panel.panelDebug = new PanelDebug(); } m_CurPanel.Value.Panel.panelDebug.interceptEvents = InterceptEvents; m_CurPanel.Value.Panel.panelDebug.enabled = m_Overlay; m_CurPanel.Value.Panel.visualTree.Dirty(ChangeType.Repaint); m_VisualTreeTreeView.panel = (m_CurPanel.Value.Panel); m_VisualTreeTreeView.Reload(); if (expand) { m_VisualTreeTreeView.ExpandAll(); } } else { m_LastWindowTitle = String.Empty; } }
internal override bool EndRepaint() { if (!enabled) { return(false); } RepaintData onTopElement = null; foreach (var repaintData in m_RepaintDatas) { var color = repaintData.color; if (highlightedElement != 0) { if (highlightedElement != repaintData.controlId) { color = Color.gray; } else { onTopElement = repaintData; continue; } } PickingData.DrawRect(repaintData.contentRect, color); } m_RepaintDatas.Clear(); if (onTopElement != null) { PickingData.DrawRect(onTopElement.contentRect, onTopElement.color); } return(true); }
private void EndPicking(ViewPanel?viewPanel) { bool newPanel = !viewPanel.Equals(m_CurPanel); if (newPanel) { panelDebug?.DetachDebugger(this); } m_CurPanel = viewPanel; if (m_CurPanel.HasValue) { m_LastWindowTitle = PickingData.GetName(m_CurPanel.Value); m_VisualTreeTreeView.panel = (m_CurPanel.Value.Panel); m_VisualTreeTreeView.Reload(); if (newPanel) { m_VisualTreeTreeView.ExpandAll(); } } else { m_LastWindowTitle = String.Empty; } if (newPanel && m_CurPanel.HasValue) { m_CurPanel.Value.Panel.panelDebug.AttachDebugger(this); } }
internal static PanelPickerWindow Show(PickingData data, Action <UIElementsDebugger.ViewPanel?> callback) { PanelPickerWindow panelPickerWindow = ScriptableObject.CreateInstance <PanelPickerWindow>(); panelPickerWindow.m_Data = data; panelPickerWindow.m_Pos = data.screenRect; panelPickerWindow.m_Callback = callback; panelPickerWindow.ShowPopup(); panelPickerWindow.Focus(); return(panelPickerWindow); }
public void Refresh() { this.m_Panels.Clear(); Dictionary <int, Panel> .Enumerator it = UIElementsUtility.GetPanelsIterator(); List <GUIView> list = new List <GUIView>(); GUIViewDebuggerHelper.GetViews(list); bool flag = false; Rect rect = new Rect(3.40282347E+38f, 3.40282347E+38f, 0f, 0f); while (it.MoveNext()) { GUIView gUIView = list.FirstOrDefault(delegate(GUIView v) { int arg_19_0 = v.GetInstanceID(); KeyValuePair <int, Panel> current2 = it.Current; return(arg_19_0 == current2.Key); }); if (!(gUIView == null)) { List <UIElementsDebugger.ViewPanel> arg_A6_0 = this.m_Panels; UIElementsDebugger.ViewPanel item = default(UIElementsDebugger.ViewPanel); KeyValuePair <int, Panel> current = it.Current; item.Panel = current.Value; item.View = gUIView; arg_A6_0.Add(item); if (rect.xMin > gUIView.screenPosition.xMin) { rect.xMin = gUIView.screenPosition.xMin; } if (rect.yMin > gUIView.screenPosition.yMin) { rect.yMin = gUIView.screenPosition.yMin; } if (rect.xMax < gUIView.screenPosition.xMax || !flag) { rect.xMax = gUIView.screenPosition.xMax; } if (rect.yMax < gUIView.screenPosition.yMax || !flag) { rect.yMax = gUIView.screenPosition.yMax; } flag = true; } } this.m_Labels = new GUIContent[this.m_Panels.Count + 1]; this.m_Labels[0] = EditorGUIUtility.TrTextContent("Select a panel", null, null); for (int i = 0; i < this.m_Panels.Count; i++) { this.m_Labels[i + 1] = new GUIContent(PickingData.GetName(this.m_Panels[i])); } this.screenRect = rect; }
internal static PanelPickerWindow Show(PickingData data, Action <UIElementsDebugger.ViewPanel?> callback) { var overlayWindow = CreateInstance <PanelPickerWindow>(); overlayWindow.m_Data = data; overlayWindow.m_Pos = data.screenRect; overlayWindow.m_Callback = callback; overlayWindow.ShowPopup(); overlayWindow.Focus(); return(overlayWindow); }
public void OnEnable() { m_PickingData = new PickingData(); titleContent = EditorGUIUtility.TrTextContent("UIElements Debugger"); m_VisualTreeTreeViewState = new TreeViewState(); m_VisualTreeTreeView = new VisualTreeTreeView(m_VisualTreeTreeViewState); if (m_SplitterState == null) { m_SplitterState = new SplitterState(1, 2); } m_TempTexture = new Texture2D(2, 2); if (!String.IsNullOrEmpty(m_LastWindowTitle)) { // if the previous window is selected again and displayed too early, we might miss some elements added // during the window's OnEnable, so delay that m_ScheduleRestoreSelection = true; } }
internal bool Draw(ref UIElementsDebugger.ViewPanel?selectedPanel, Rect dataScreenRect) { bool result; foreach (UIElementsDebugger.ViewPanel current in this.m_Panels) { Rect screenPosition = current.View.screenPosition; screenPosition.x -= dataScreenRect.xMin; screenPosition.y -= dataScreenRect.yMin; if (GUI.Button(screenPosition, string.Format("{0}({1})", current.Panel.visualTree.name, current.View.GetInstanceID()), EditorStyles.miniButton)) { selectedPanel = new UIElementsDebugger.ViewPanel?(current); result = true; return(result); } PickingData.DrawRect(screenPosition, Color.white); } result = false; return(result); }
public void OnEnable() { this.m_PickingData = new PickingData(); base.titleContent = EditorGUIUtility.TrTextContent("UIElements Debugger", null, null); this.m_VisualTreeTreeViewState = new TreeViewState(); this.m_VisualTreeTreeView = new VisualTreeTreeView(this.m_VisualTreeTreeViewState); if (this.m_SplitterState == null) { this.m_SplitterState = new SplitterState(new float[] { 1f, 2f }); } this.m_TempTexture = new Texture2D(2, 2); if (!string.IsNullOrEmpty(this.m_LastWindowTitle)) { this.m_ScheduleRestoreSelection = true; } }
private void EndPicking(UIElementsDebugger.ViewPanel?viewPanel) { Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator(); while (panelsIterator.MoveNext()) { KeyValuePair <int, Panel> current = panelsIterator.Current; current.Value.panelDebug = null; } this.m_CurPanel = viewPanel; if (this.m_CurPanel.HasValue) { this.m_LastWindowTitle = PickingData.GetName(this.m_CurPanel.Value); if (this.m_CurPanel.Value.Panel.panelDebug == null) { this.m_CurPanel.Value.Panel.panelDebug = new PanelDebug(); } this.m_CurPanel.Value.Panel.panelDebug.enabled = true; this.m_CurPanel.Value.Panel.visualTree.Dirty(ChangeType.Repaint); this.m_VisualTreeTreeView.panel = this.m_CurPanel.Value.Panel; this.m_VisualTreeTreeView.Reload(); } }
private void EndPicking(ViewPanel?viewPanel) { Dictionary <int, Panel> .Enumerator it = UIElementsUtility.GetPanelsIterator(); while (it.MoveNext()) { it.Current.Value.panelDebug = null; } m_CurPanel = viewPanel; if (m_CurPanel.HasValue) { m_LastWindowTitle = PickingData.GetName(m_CurPanel.Value); if (m_CurPanel.Value.Panel.panelDebug == null) { m_CurPanel.Value.Panel.panelDebug = new PanelDebug(); } m_CurPanel.Value.Panel.panelDebug.enabled = true; m_CurPanel.Value.Panel.visualTree.Dirty(ChangeType.Repaint); m_VisualTreeTreeView.panel = (m_CurPanel.Value.Panel); m_VisualTreeTreeView.Reload(); } }