private void RenderActiveRow(LogMessage logMessage, float estimatedHeight) { // set the content colour StateColour levelColour = GetStateColorByLevel(logMessage.level); messageDetailStyle.normal.textColor = levelColour.selected; messageDetailStyleSelected.normal.textColor = levelColour.selected; boxStyleSelected.normal.textColor = levelColour.selected; numberStyleSelected.normal.textColor = levelColour.selected; boxStyle.normal.textColor = levelColour.selected; numberStyle.normal.textColor = levelColour.selected; // estimate the height needed for our label, subtract sum of padding + width for two lhs columns string fullMessage = logMessage.message; if (logMessage.stack != null && logMessage.stack.Length > 0) { fullMessage += "\n" + logMessage.stack; } // fetch bounds to make it clickable GUILayout.BeginVertical(selectedStyle, GUILayout.Width(position.width), GUILayout.Height(estimatedHeight)); Rect bounds = EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); EditorGUILayout.BeginVertical(GUIStyle.none, GUILayout.Width(72f)); GUILayout.Space(2f); GUILayout.Label(logMessage.category.ToString(), boxStyleSelected); GUILayout.Label(logMessage.level.ToString(), boxStyle); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(GUIStyle.none, GUILayout.Width(96f)); GUILayout.Space(2f); GUILayout.Label(logMessage.time.ToString("F2"), numberStyleSelected, GUILayout.Width(96f)); GUILayout.Label(logMessage.frame.ToString("F0"), numberStyle, GUILayout.Width(96f)); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(GUIStyle.none, GUILayout.ExpandWidth(true)); GUILayout.Label(logMessage.message, messageDetailStyleSelected, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); GUILayout.Label(logMessage.stack, messageDetailStyle, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); GUILayout.EndVertical(); // check if the user wants to close this expanded view or not if (GUI.Button(bounds, GUIContent.none, GUIStyle.none)) { activeMessage = null; pauseFrame = null; } }
private void InitializeColors() { // check if we are setting for pro or basic unity3d if (EditorGUIUtility.isProSkin) { // set default text color defaultTextColour = new StateColour(); defaultTextColour.normal = new Color(0.85f, 0.85f, 0.85f, 1f); defaultTextColour.selected = new Color(0.85f, 0.85f, 0.85f, 1f); // set text colours levelColours[Log.Level.Critical] = new StateColour(); levelColours[Log.Level.Critical].normal = new Color(0.9f, 0.47f, 0.47f, 1f); levelColours[Log.Level.Critical].selected = new Color(0.95f, 0.75f, 0.75f, 1f); levelColours[Log.Level.Important] = new StateColour(); levelColours[Log.Level.Important].normal = new Color(0.85f, 0.75f, 0.15f, 1f); levelColours[Log.Level.Important].selected = new Color(0.85f, 0.75f, 0.15f, 1f); } else { // set default background color defaultTextColour = new StateColour(); defaultTextColour.normal = Color.black; defaultTextColour.selected = Color.white; // set text colours levelColours[Log.Level.Critical] = new StateColour(); levelColours[Log.Level.Critical].normal = new Color(0.55f, 0.1f, 0.1f, 1f); levelColours[Log.Level.Critical].selected = new Color(0.95f, 0.75f, 0.75f, 1f); levelColours[Log.Level.Important] = new StateColour(); levelColours[Log.Level.Important].normal = new Color(0.55f, 0.42f, 0.1f, 1f); levelColours[Log.Level.Important].selected = Color.yellow; } }