Navigation tools upgraded to use the new MainToolbarElement API

This commit is contained in:
Anders Ejlersen 2025-12-06 15:17:30 +01:00
parent 708b99f763
commit 3e1602162c
52 changed files with 837 additions and 66 deletions

View file

@ -1,19 +1,25 @@
using UnityEditor;
#if !UNITY_6000_3_OR_NEWER
using UnityEditor;
#endif
using UnityEngine;
namespace Module.NavigationTool.Editor.Toolbar
{
public sealed class Styles
{
#if !UNITY_6000_3_OR_NEWER
public GUIStyle popup;
public GUIStyle button;
public GUIStyle buttonNoPadding;
public GUIStyle slider;
public GUIStyle label;
public GUIStyle labelCenter;
public GUIStyle settingsGroup;
public GUIStyle centeredMiniLabel;
#endif
public GUIStyle settingsGroup;
#if !UNITY_6000_3_OR_NEWER
public GUIContent iconPlusSmall;
#if !UNITY_6000_0_OR_NEWER
public GUIContent iconSceneAdditive;
@ -22,6 +28,7 @@ namespace Module.NavigationTool.Editor.Toolbar
public GUIContent iconDisconnect;
public GUIContent iconProject;
public GUIContent iconSettings;
#endif
private GUISkin skin;
@ -31,6 +38,8 @@ namespace Module.NavigationTool.Editor.Toolbar
return;
this.skin = skin;
#if !UNITY_6000_3_OR_NEWER
popup = new GUIStyle(skin.FindStyle("ToolbarPopup"));
button = new GUIStyle(skin.FindStyle("toolbarbutton"));
slider = new GUIStyle(skin.FindStyle("ToolbarSlider"));
@ -55,12 +64,14 @@ namespace Module.NavigationTool.Editor.Toolbar
{
alignment = TextAnchor.MiddleCenter
};
#endif
settingsGroup = new GUIStyle
{
margin = new RectOffset(8, 0, 8, 0)
};
#if !UNITY_6000_3_OR_NEWER
if (EditorGUIUtility.isProSkin)
{
iconPlusSmall = EditorGUIUtility.IconContent("d_CreateAddNew");
@ -83,6 +94,7 @@ namespace Module.NavigationTool.Editor.Toolbar
iconDisconnect = EditorGUIUtility.IconContent("d_CacheServerDisconnected");
iconProject = EditorGUIUtility.IconContent("Project");
iconSettings = new GUIContent(EditorGUIUtility.IconContent("Settings"));
#endif
}
}
}

View file

@ -1,4 +1,5 @@
using System;
#if !UNITY_6000_3_OR_NEWER
using System;
using UnityEngine.UIElements;
namespace Module.NavigationTool.Editor.Toolbar
@ -13,4 +14,5 @@ namespace Module.NavigationTool.Editor.Toolbar
Priority = priority;
}
}
}
}
#endif

View file

@ -1,4 +1,5 @@
using System;
#if !UNITY_6000_3_OR_NEWER
using System;
using System.Collections.Generic;
using UnityEngine;
using System.Reflection;
@ -234,4 +235,5 @@ namespace Module.NavigationTool.Editor.Toolbar
}
#endif
}
}
}
#endif