mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-21 14:00:08 +08:00
926ea255cb
* feat: add menu option to disable "modular avatar information" display Closes: #815
40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
using System;
|
|
using nadena.dev.modular_avatar.ui;
|
|
using UnityEditor;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace nadena.dev.modular_avatar.core.editor
|
|
{
|
|
#if UNITY_2022_3_OR_NEWER
|
|
[FilePath("modular-avatar/ParamsUsagePrefs.asset", FilePathAttribute.Location.PreferencesFolder)]
|
|
internal sealed class ParamsUsagePrefs : ScriptableSingleton<ParamsUsagePrefs>
|
|
{
|
|
public static event Action<bool> OnChange_EnableInfoMenu;
|
|
|
|
[FormerlySerializedAs("EnableInfoMenu")] public bool enableInfoMenu = true;
|
|
|
|
[MenuItem(UnityMenuItems.TopMenu_EnableInfo, false, UnityMenuItems.TopMenu_EnableInfoOrder)]
|
|
private static void Menu_EnableInfo()
|
|
{
|
|
ParamsUsagePrefs.instance.enableInfoMenu = !ParamsUsagePrefs.instance.enableInfoMenu;
|
|
Menu.SetChecked(UnityMenuItems.TopMenu_EnableInfo, ParamsUsagePrefs.instance.enableInfoMenu);
|
|
ParamsUsagePrefs.instance.Save(true);
|
|
|
|
OnChange_EnableInfoMenu?.Invoke(ParamsUsagePrefs.instance.enableInfoMenu);
|
|
}
|
|
|
|
[InitializeOnLoadMethod]
|
|
private static void Initialize()
|
|
{
|
|
Menu.SetChecked(UnityMenuItems.TopMenu_EnableInfo, ParamsUsagePrefs.instance.enableInfoMenu);
|
|
}
|
|
}
|
|
#else
|
|
internal sealed class ParamsUsagePrefs
|
|
{
|
|
public static ParamsUsagePrefs instance => new ParamsUsagePrefs();
|
|
public static event Action<bool> OnChange_EnableInfoMenu;
|
|
public bool enableInfoMenu => false;
|
|
}
|
|
#endif
|
|
} |