private static void DrawExpandedInfo(JMilesDebug.DebugLoggerData log, int index) { var gui = new GUIStyle("label") { fontSize = 12 }; if (log.Info.objectOfInfo) { if (GUILayout.Button(new GUIContent(log.Info.objectOfInfo.ToString()), gui)) { Select(log.Info.objectOfInfo); } } EditorGUILayout.TextArea(log.Info.stack); }
private void DrawLog(JMilesDebug.DebugLoggerData log, int index) { GetWindow(); if (log == null) { return; } if (log.Info == null) { return; } if (log.Info.info == null) { return; } var backgroundColor = GUI.backgroundColor; switch (log.Info.rating) { case LogType.Error: if (!ShowError) { return; } GUI.backgroundColor = new EditorColour(Color.red * 2, 0.8f); break; case LogType.Assert: if (!ShowAssert) { return; } GUI.backgroundColor = new EditorColour(Color.blue, 0.8f); break; case LogType.Warning: if (!ShowWarnings) { return; } GUI.backgroundColor = new EditorColour(Color.yellow); break; case LogType.Log: if (!ShowInfo) { return; } GUI.backgroundColor = backgroundColor; break; case LogType.Exception: if (!ShowException) { return; } GUI.backgroundColor = new EditorColour(Color.cyan, 0.8f); break; default: throw new ArgumentOutOfRangeException(); } if (log.Expanded) { EditorGUILayout.BeginVertical("box", GUILayout.Height(27)); } else { EditorGUILayout.BeginVertical("box", GUILayout.Height(27)); } EditorGUILayout.BeginHorizontal(); Rect r = EditorGUILayout.BeginHorizontal(GUILayout.Width(32), GUILayout.Height(27)); log.Expanded = EditorGUI.Foldout(r, log.Expanded, ""); EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); //log.Expanded = EditorGUILayout.Foldout(log.Expanded, "", true); var gui = new GUIStyle("label") { fontSize = 16 }; if (GUILayout.Button(new GUIContent(string.Format("[{0}] {1}", log.Count, log.Info.info)), gui, GUILayout.Width(window.position.width - 32 - 128 - 32))) { Select(log.Info.objectOfInfo); } if (GUILayout.Button(new GUIContent("Remove entry", "Deletes log from the database."), GUILayout.Height(20), GUILayout.Width(128))) { if (EditorUtility.DisplayDialog( "WARNING: DELETE LOG ENTRY", string.Format("Warning you are about to delete Log ({0}), Are you sure you want to do this?", log.Info.info), "Yes, Delete log", "No, keep log")) { JMilesDebug.Clear(index); } } EditorGUILayout.EndHorizontal(); if (log.Expanded) { EditorGUILayout.BeginVertical(); DrawExpandedInfo(log, index); EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); GUI.backgroundColor = backgroundColor; }