You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/3rd/Plugins/Smart-Inspector/Base/Preferences/InspectorSettingsProvider.cs

44 lines
1.4 KiB
C#

3 months ago
using System.Reflection;
using AV.Inspector.Runtime;
using AV.UITK;
using HarmonyLib;
using UnityEditor;
using UnityEditor.UIElements;
using UnityEngine;
using UnityEngine.UIElements;
namespace AV.Inspector
{
internal class InspectorSettingsProvider : SettingsProvider
{
const string Title = "Smart Inspector";
const string UIPath = "Preferences/Open Labs/Smart Inspector";
static PropertyInfo settingsWindowInfo = AccessTools.Property(typeof(SettingsProvider), "settingsWindow");
[SettingsProvider]
public static SettingsProvider CreateProvider() => new InspectorSettingsProvider(UIPath, SettingsScope.User);
InspectorSettingsProvider(string path, SettingsScope scope) : base(path, scope) {}
public override void OnActivate(string searchContext, VisualElement root)
{
var window = (EditorWindow)settingsWindowInfo.GetValue(this);
window.SetAntiAliasing(8);
var prefs = InspectorPrefs.LoadFromUserData();
var ui = new InspectorPrefsUI(prefs);
root.Add(CreateBigTitle());
root.Add(ui);
}
Label CreateBigTitle()
{
return new Label(Title).Fluent().FontSize(19).FontStyle(FontStyle.Bold).Grow(0).Padding(2, 9, 2).Margin(bottom: 2);
}
}
}