mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-04 23:39:22 +00:00
[DesktopCameraFix] Update viewpoint when disabling mod.
This commit is contained in:
parent
6ee3d80ef8
commit
c32d8735be
2 changed files with 9 additions and 18 deletions
|
@ -1,24 +1,27 @@
|
|||
using ABI_RC.Core.IO;
|
||||
using ABI_RC.Core.Player;
|
||||
using MelonLoader;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.DesktopCameraFix;
|
||||
|
||||
public class DesktopCameraFix : MelonMod
|
||||
{
|
||||
internal const string SettingsCategory = nameof(DesktopCameraFix);
|
||||
|
||||
public static readonly MelonPreferences_Category Category =
|
||||
MelonPreferences.CreateCategory(SettingsCategory);
|
||||
MelonPreferences.CreateCategory(nameof(DesktopCameraFix));
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryEnabled =
|
||||
Category.CreateEntry("Enabled", true, description: "Toggle DesktopCameraFix entirely.");
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
EntryEnabled.OnEntryValueChanged.Subscribe(OnEntryEnabledChanged);
|
||||
ApplyPatches(typeof(HarmonyPatches.PlayerSetupPatches));
|
||||
}
|
||||
|
||||
void OnEntryEnabledChanged(bool newValue, bool oldValue)
|
||||
{
|
||||
if (newValue) PlayerSetup.Instance.SetViewPointOffset();
|
||||
}
|
||||
|
||||
void ApplyPatches(Type type)
|
||||
{
|
||||
try
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue