protected override void RowGUI(RowGUIArgs args) { var item = (UCL_TreeViewItem)args.item; var logLine = item.Log; InitStylesIfNeeded(); var style = defaultLineStyle; if (args.selected) { style = selecredLineStyle; } GUI.Label(args.rowRect, logLine.LineGUIContent, style); if (UCL_LogEntries.HasFlag(UCL_ConsoleFlags.Collapse)) { var badgeContent = new GUIContent(logLine.EntryCount.ToString()); var size = CountBadge.CalcSize(badgeContent); Rect badgeRect = new Rect(); badgeRect.width = size.x; badgeRect.height = size.y; badgeRect.x = args.rowRect.x + args.rowRect.width; badgeRect.x -= badgeRect.width; badgeRect.x -= 5f; badgeRect.y = args.rowRect.y + (args.rowRect.height - badgeRect.height) / 2f; GUI.Label(badgeRect, badgeContent, CountBadge); } }
private void DrawToolbar() { GUILayout.BeginHorizontal(EditorStyles.toolbar); { bool clear = GUILayout.Button("Clear", EditorStyles.toolbarButton); if (clear) { UCL_LogEntries.Clear(); } GUILayout.Space(6); bool val = false; if (m_state.DisplayCollapse) { val = UCL_LogEntries.HasFlag(UCL_ConsoleFlags.Collapse); val = GUILayout.Toggle(val, "Collapse", EditorStyles.toolbarButton); UCL_LogEntries.SetFlag(UCL_ConsoleFlags.Collapse, val); } if (m_state.DisplayClearOnPlay) { val = UCL_LogEntries.HasFlag(UCL_ConsoleFlags.ClearOnPlay); val = GUILayout.Toggle(val, "Clear on Play", EditorStyles.toolbarButton); UCL_LogEntries.SetFlag(UCL_ConsoleFlags.ClearOnPlay, val); } if (m_state.DisplayPauseOnError) { val = UCL_LogEntries.HasFlag(UCL_ConsoleFlags.ErrorPause); val = GUILayout.Toggle(val, "Error Pause", EditorStyles.toolbarButton); UCL_LogEntries.SetFlag(UCL_ConsoleFlags.ErrorPause, val); } if (UnDockedUsedTagsCount > 0) { if (GUILayout.Button("Tags (" + UnDockedUsedTagsCount + ")", EditorStyles.toolbarDropDown)) { GenericMenu toolsMenu = new GenericMenu(); foreach (var pair in m_tagsMessagesCount) { var tag = UCL_Settings.Instance.GetTag(pair.Key); if (m_state.IsTagDocked(tag)) { continue; } bool enabled = m_state.IsTagEnabled(tag); toolsMenu.AddItem(new GUIContent(tag.Name + " (" + pair.Value + ")"), enabled, () => { enabled = !enabled; m_state.SetTagEnabledState(tag, enabled); UCL_Settings.SaveConsoleWindowState(m_state); }); } toolsMenu.ShowAsContext(); } } GUILayout.FlexibleSpace(); if (m_state.DisplaySearchBar) { GUILayout.BeginHorizontal(m_toolbarStyle); { GUI.SetNextControlName(SEARCH_BAR_CONTROL_NAME); m_searchString = EditorGUILayout.TextField(m_searchString, m_toolbarSearchTextFieldStyle, GUILayout.MinWidth(200f)); if (GUILayout.Button("", m_toolbarSearchCancelButtonStyle)) { m_searchString = ""; GUI.FocusControl(null); } m_logsView.SerSearthcString(m_searchString); } GUILayout.EndHorizontal(); } for (int i = UCL_Settings.Instance.Tags.Count - 1; i >= 0; i--) { var tag = UCL_Settings.Instance.Tags[i]; //just a stupid workaround we have to make // since gui list plgun an add a null balue to the tags list just for a second if (tag == null) { continue; } if (m_state.IsTagDocked(tag)) { var content = new GUIContent(GetMessagesCountForTag(tag.Name).ToString(), tag.Icon); EditorGUI.BeginChangeCheck(); bool enabled = GUILayout.Toggle(m_state.IsTagEnabled(tag), content, EditorStyles.toolbarButton); if (EditorGUI.EndChangeCheck()) { m_state.SetTagEnabledState(tag, enabled); UCL_Settings.SaveConsoleWindowState(m_state); } } } } GUILayout.EndHorizontal(); }