NAK_CVR_Mods/AvatarScale/ModSettings.cs
2023-09-25 14:09:05 -05:00

51 lines
2.4 KiB
C#

using MelonLoader;
using NAK.AvatarScaleMod.AvatarScaling;
using NAK.AvatarScaleMod.Networking;
namespace NAK.AvatarScaleMod;
// i like this
internal static class ModSettings
{
// Constants
internal const string SettingsCategory = nameof(AvatarScaleMod);
public static readonly MelonPreferences_Category Category =
MelonPreferences.CreateCategory(SettingsCategory);
public static readonly MelonPreferences_Entry<bool> EntryUseUniversalScaling =
Category.CreateEntry("use_universal_scaling", true, display_name: "Use Universal Scaling", description: "Enable or disable universal scaling.");
public static readonly MelonPreferences_Entry<bool> EntryPersistantHeight =
Category.CreateEntry("persistant_height", false, display_name: "Persistant Height", description: "Should the avatar height persist between avatar switches?");
public static readonly MelonPreferences_Entry<bool> EntryScaleGestureEnabled =
Category.CreateEntry("scale_gesture_enabled", true, display_name: "Scale Gesture Enabled", description: "Enable or disable scale gesture.");
public static readonly MelonPreferences_Entry<bool> EntryDebugNetworkInbound =
Category.CreateEntry("debug_inbound", false, display_name: "Debug Inbound", description: "Log inbound Mod Network height updates.");
public static readonly MelonPreferences_Entry<bool> EntryDebugNetworkOutbound =
Category.CreateEntry("debug_outbound", false, display_name: "Debug Outbound", description: "Log outbound Mod Network height updates.");
public static readonly MelonPreferences_Entry<float> EntryHiddenLastAvatarScale =
Category.CreateEntry("last_avatar_scale", -1f, is_hidden: true);
public static void Initialize()
{
foreach (MelonPreferences_Entry entry in Category.Entries)
entry.OnEntryValueChangedUntyped.Subscribe(OnSettingsChanged);
}
private static void OnSettingsChanged(object _, object __)
{
AvatarScaleManager.Instance.Setting_UniversalScaling = EntryUseUniversalScaling.Value;
AvatarScaleManager.Instance.Setting_PersistantHeight = EntryPersistantHeight.Value;
GestureReconizer.ScaleReconizer.Enabled = EntryScaleGestureEnabled.Value;
ModNetwork.Debug_NetworkInbound = EntryDebugNetworkInbound.Value;
ModNetwork.Debug_NetworkOutbound = EntryDebugNetworkOutbound.Value;
}
}