mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-03 10:29:22 +00:00
Custom event classes for patched methods
Update to LeapCSharp 6.15.0
This commit is contained in:
parent
4b879d53d5
commit
85925a7072
76 changed files with 3443 additions and 2187 deletions
|
@ -1,4 +1,4 @@
|
|||
[assembly: MelonLoader.MelonInfo(typeof(ml_vei.ViveExtendedInput), "ViveExtendedInput", "1.0.2", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||
[assembly: MelonLoader.MelonInfo(typeof(ml_vei.ViveExtendedInput), "ViveExtendedInput", "1.0.3", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
||||
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||
|
|
|
@ -6,6 +6,14 @@ namespace ml_vei
|
|||
{
|
||||
static class Settings
|
||||
{
|
||||
internal class SettingEvent<T>
|
||||
{
|
||||
event Action<T> m_action;
|
||||
public void AddHandler(Action<T> p_listener) => m_action += p_listener;
|
||||
public void RemoveHandler(Action<T> p_listener) => m_action -= p_listener;
|
||||
public void Invoke(T p_value) => m_action?.Invoke(p_value);
|
||||
}
|
||||
|
||||
enum ModSetting
|
||||
{
|
||||
Gestures = 0,
|
||||
|
@ -26,9 +34,9 @@ namespace ml_vei
|
|||
static MelonLoader.MelonPreferences_Category ms_category = null;
|
||||
static List<MelonLoader.MelonPreferences_Entry> ms_entries = null;
|
||||
|
||||
public static event Action<bool> GesturesChange;
|
||||
public static event Action<bool> GripTriggerChange;
|
||||
public static event Action<PriorityAxis> AxisPriorityChange;
|
||||
public static readonly SettingEvent<bool> OnGesturesChanged;
|
||||
public static readonly SettingEvent<bool> OnGripTriggerChanged;
|
||||
public static readonly SettingEvent<PriorityAxis> OnAxisPriorityChanged;
|
||||
|
||||
internal static void Init()
|
||||
{
|
||||
|
@ -73,44 +81,58 @@ namespace ml_vei
|
|||
|
||||
static void OnToggleUpdate(string p_name, string p_value)
|
||||
{
|
||||
if(Enum.TryParse(p_name, out ModSetting l_setting))
|
||||
try
|
||||
{
|
||||
switch(l_setting)
|
||||
if(Enum.TryParse(p_name, out ModSetting l_setting))
|
||||
{
|
||||
case ModSetting.Gestures:
|
||||
switch(l_setting)
|
||||
{
|
||||
Gestures = bool.Parse(p_value);
|
||||
GesturesChange?.Invoke(Gestures);
|
||||
}
|
||||
break;
|
||||
case ModSetting.Gestures:
|
||||
{
|
||||
Gestures = bool.Parse(p_value);
|
||||
OnGesturesChanged.Invoke(Gestures);
|
||||
}
|
||||
break;
|
||||
|
||||
case ModSetting.GripTrigger:
|
||||
{
|
||||
GripTrigger = bool.Parse(p_value);
|
||||
GripTriggerChange?.Invoke(GripTrigger);
|
||||
case ModSetting.GripTrigger:
|
||||
{
|
||||
GripTrigger = bool.Parse(p_value);
|
||||
OnGripTriggerChanged.Invoke(GripTrigger);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
ms_entries[(int)l_setting].BoxedValue = bool.Parse(p_value);
|
||||
}
|
||||
|
||||
ms_entries[(int)l_setting].BoxedValue = bool.Parse(p_value);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
MelonLoader.MelonLogger.Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
static void OnDropdownUpdate(string p_name, string p_value)
|
||||
{
|
||||
if(Enum.TryParse(p_name, out ModSetting l_setting))
|
||||
try
|
||||
{
|
||||
switch(l_setting)
|
||||
if(Enum.TryParse(p_name, out ModSetting l_setting))
|
||||
{
|
||||
case ModSetting.AxisPriority:
|
||||
switch(l_setting)
|
||||
{
|
||||
AxisPriority = (PriorityAxis)int.Parse(p_value);
|
||||
AxisPriorityChange?.Invoke(AxisPriority);
|
||||
case ModSetting.AxisPriority:
|
||||
{
|
||||
AxisPriority = (PriorityAxis)int.Parse(p_value);
|
||||
OnAxisPriorityChanged.Invoke(AxisPriority);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ms_entries[(int)l_setting].BoxedValue = int.Parse(p_value);
|
||||
ms_entries[(int)l_setting].BoxedValue = int.Parse(p_value);
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
MelonLoader.MelonLogger.Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<Platforms>x64</Platforms>
|
||||
<PackageId>ViveExtendedInput</PackageId>
|
||||
<Version>1.0.2</Version>
|
||||
<Version>1.0.3</Version>
|
||||
<Authors>SDraw</Authors>
|
||||
<Company>None</Company>
|
||||
<Product>ViveExtendedInput</Product>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue