mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-03 10:29:22 +00:00
Rework of IK override
This commit is contained in:
parent
4e3d5dd6d4
commit
49b72a0711
5 changed files with 158 additions and 30 deletions
|
@ -2,7 +2,6 @@
|
|||
using cohtml;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ml_amt
|
||||
{
|
||||
|
@ -10,14 +9,17 @@ namespace ml_amt
|
|||
{
|
||||
enum ModSetting
|
||||
{
|
||||
CrouchLimit = 0
|
||||
IKOverride = 0,
|
||||
CrouchLimit
|
||||
};
|
||||
|
||||
static bool ms_ikOverride = true;
|
||||
static float ms_crouchLimit = 0.65f;
|
||||
|
||||
static MelonLoader.MelonPreferences_Category ms_category = null;
|
||||
static List<MelonLoader.MelonPreferences_Entry> ms_entries = null;
|
||||
|
||||
static public event Action<bool> IKOverrideChange;
|
||||
static public event Action<float> CrouchLimitChange;
|
||||
|
||||
public static void Init()
|
||||
|
@ -25,6 +27,7 @@ namespace ml_amt
|
|||
ms_category = MelonLoader.MelonPreferences.CreateCategory("AMT");
|
||||
|
||||
ms_entries = new List<MelonLoader.MelonPreferences_Entry>();
|
||||
ms_entries.Add(ms_category.CreateEntry(ModSetting.IKOverride.ToString(), true));
|
||||
ms_entries.Add(ms_category.CreateEntry(ModSetting.CrouchLimit.ToString(), 65));
|
||||
|
||||
Load();
|
||||
|
@ -44,6 +47,7 @@ namespace ml_amt
|
|||
ViewManager.Instance.gameMenuView.Listener.ReadyForBindings += () =>
|
||||
{
|
||||
ViewManager.Instance.gameMenuView.View.BindCall("MelonMod_AMT_Call_InpSlider", new Action<string, string>(OnSliderUpdate));
|
||||
ViewManager.Instance.gameMenuView.View.BindCall("MelonMod_AMT_Call_InpToggle", new Action<string, string>(OnToggleUpdate));
|
||||
};
|
||||
ViewManager.Instance.gameMenuView.Listener.FinishLoad += (_) =>
|
||||
{
|
||||
|
@ -55,6 +59,7 @@ namespace ml_amt
|
|||
|
||||
static void Load()
|
||||
{
|
||||
ms_ikOverride = (bool)ms_entries[(int)ModSetting.IKOverride].BoxedValue;
|
||||
ms_crouchLimit = ((int)ms_entries[(int)ModSetting.CrouchLimit].BoxedValue) * 0.01f;
|
||||
}
|
||||
|
||||
|
@ -66,18 +71,42 @@ namespace ml_amt
|
|||
{
|
||||
case ModSetting.CrouchLimit:
|
||||
{
|
||||
ms_crouchLimit = ((int)ms_entries[(int)ModSetting.CrouchLimit].BoxedValue) * 0.01f;
|
||||
ms_crouchLimit = int.Parse(p_value) * 0.01f;
|
||||
CrouchLimitChange?.Invoke(ms_crouchLimit);
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ms_entries[(int)l_setting].BoxedValue = int.Parse(p_value);
|
||||
}
|
||||
}
|
||||
|
||||
static void OnToggleUpdate(string p_name, string p_value)
|
||||
{
|
||||
if(Enum.TryParse(p_name, out ModSetting l_setting))
|
||||
{
|
||||
switch(l_setting)
|
||||
{
|
||||
case ModSetting.IKOverride:
|
||||
{
|
||||
ms_ikOverride = bool.Parse(p_value);
|
||||
IKOverrideChange?.Invoke(ms_ikOverride);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ms_entries[(int)l_setting].BoxedValue = bool.Parse(p_value);
|
||||
}
|
||||
}
|
||||
|
||||
public static float CrouchLimit
|
||||
{
|
||||
get => ms_crouchLimit;
|
||||
}
|
||||
|
||||
public static bool IKOverride
|
||||
{
|
||||
get => ms_ikOverride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue