mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
feat: Improved Log Settings Window Appearance (#1885)
* setting window min size * using Layout scopes * adding scroll bar * setting label and field widths
This commit is contained in:
parent
5726d3b84a
commit
69b845183c
@ -7,8 +7,10 @@ namespace Mirror.EditorScripts.Logging
|
||||
public class LogLevelWindow : EditorWindow
|
||||
{
|
||||
[SerializeField] LogSettings settings = null;
|
||||
|
||||
SerializedObject serializedObject;
|
||||
SerializedProperty settingsProp;
|
||||
Vector2 dictionaryScrollPosition;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
@ -25,15 +27,22 @@ void OnEnable()
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
using (EditorGUILayout.ScrollViewScope scrollScope = new EditorGUILayout.ScrollViewScope(dictionaryScrollPosition, GUIStyle.none, GUI.skin.verticalScrollbar))
|
||||
{
|
||||
dictionaryScrollPosition = scrollScope.scrollPosition;
|
||||
|
||||
using (new EditorGUILayout.VerticalScope())
|
||||
{
|
||||
using (new EditorGUILayout.VerticalScope())
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField(new GUIContent("Mirror Log Levels"), EditorStyles.boldLabel);
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
EditorGUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins);
|
||||
}
|
||||
|
||||
using (new EditorGUILayout.VerticalScope())
|
||||
{
|
||||
serializedObject.Update();
|
||||
EditorGUILayout.PropertyField(settingsProp);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
@ -51,14 +60,16 @@ void OnGUI()
|
||||
{
|
||||
LogLevelsGUI.DrawLogFactoryDictionary(settings);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("Window/Analysis/Mirror Log Levels", priority = 20002)]
|
||||
public static void ShowWindow()
|
||||
{
|
||||
LogLevelWindow window = GetWindow<LogLevelWindow>();
|
||||
window.minSize = new Vector2(200, 100);
|
||||
window.titleContent = new GUIContent("Mirror Log levels");
|
||||
window.Show();
|
||||
}
|
||||
|
@ -45,7 +45,14 @@ static void DrawLoggerField(KeyValuePair<string, ILogger> item)
|
||||
ILogger logger = item.Value;
|
||||
string name = item.Key;
|
||||
|
||||
logger.filterLogType = (LogType)EditorGUILayout.EnumPopup(new GUIContent(name), logger.filterLogType);
|
||||
const float fieldWidth = 100f;
|
||||
const float inspectorMargin = 25f;
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
EditorGUILayout.LabelField(new GUIContent(name), GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth - fieldWidth - inspectorMargin));
|
||||
logger.filterLogType = (LogType)EditorGUILayout.EnumPopup(logger.filterLogType, GUILayout.Width(fieldWidth));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user