mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-03 18:39:23 +00:00
Scaled locomotion steps
Funny C# properties Minor fixes
This commit is contained in:
parent
fc60219a4e
commit
28aca1bb49
11 changed files with 343 additions and 410 deletions
|
@ -34,6 +34,7 @@ namespace ml_dht
|
|||
Quaternion m_bindRotation;
|
||||
Quaternion m_lastHeadRotation;
|
||||
|
||||
// Unity events
|
||||
void Start()
|
||||
{
|
||||
Settings.EnabledChange += this.SetEnabled;
|
||||
|
@ -56,6 +57,7 @@ namespace ml_dht
|
|||
Settings.FaceOverrideChange -= this.SetFaceOverride;
|
||||
}
|
||||
|
||||
// Tracking updates
|
||||
public void UpdateTrackingData(ref TrackingData p_data)
|
||||
{
|
||||
m_headPosition.Set(p_data.m_headPositionX * (m_mirrored ? -1f : 1f), p_data.m_headPositionY, p_data.m_headPositionZ);
|
||||
|
@ -77,6 +79,7 @@ namespace ml_dht
|
|||
}
|
||||
}
|
||||
|
||||
// Game events
|
||||
internal void OnEyeControllerUpdate(CVREyeController p_component)
|
||||
{
|
||||
if(m_enabled)
|
||||
|
@ -139,7 +142,8 @@ namespace ml_dht
|
|||
m_bindRotation = Quaternion.identity;
|
||||
}
|
||||
|
||||
public void SetEnabled(bool p_state)
|
||||
// Settings
|
||||
internal void SetEnabled(bool p_state)
|
||||
{
|
||||
if(m_enabled != p_state)
|
||||
{
|
||||
|
@ -148,7 +152,7 @@ namespace ml_dht
|
|||
m_lastHeadRotation = ((m_headBone != null) ? m_headBone.rotation : m_bindRotation);
|
||||
}
|
||||
}
|
||||
public void SetHeadTracking(bool p_state)
|
||||
internal void SetHeadTracking(bool p_state)
|
||||
{
|
||||
if(m_headTracking != p_state)
|
||||
{
|
||||
|
@ -157,23 +161,23 @@ namespace ml_dht
|
|||
m_lastHeadRotation = ((m_headBone != null) ? m_headBone.rotation : m_bindRotation);
|
||||
}
|
||||
}
|
||||
public void SetEyeTracking(bool p_state)
|
||||
internal void SetEyeTracking(bool p_state)
|
||||
{
|
||||
m_eyeTracking = p_state;
|
||||
}
|
||||
public void SetBlinking(bool p_state)
|
||||
internal void SetBlinking(bool p_state)
|
||||
{
|
||||
m_blinking = p_state;
|
||||
}
|
||||
public void SetSmoothing(float p_value)
|
||||
internal void SetSmoothing(float p_value)
|
||||
{
|
||||
m_smoothing = 1f - Mathf.Clamp(p_value, 0f, 0.99f);
|
||||
}
|
||||
public void SetMirrored(bool p_state)
|
||||
internal void SetMirrored(bool p_state)
|
||||
{
|
||||
m_mirrored = p_state;
|
||||
}
|
||||
public void SetFaceOverride(bool p_state)
|
||||
internal void SetFaceOverride(bool p_state)
|
||||
{
|
||||
m_faceOverride = p_state;
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@ namespace ml_dht
|
|||
FaceOverride
|
||||
}
|
||||
|
||||
static bool ms_enabled = false;
|
||||
static bool ms_headTracking = true;
|
||||
static bool ms_eyeTracking = true;
|
||||
static bool ms_blinking = true;
|
||||
static bool ms_mirrored = false;
|
||||
static float ms_smoothing = 0.5f;
|
||||
static bool ms_faceOverride = true;
|
||||
public static bool Enabled { get; private set; } = false;
|
||||
public static bool HeadTracking { get; private set; } = true;
|
||||
public static bool EyeTracking { get; private set; } = true;
|
||||
public static bool Blinking { get; private set; } = true;
|
||||
public static bool Mirrored { get; private set; } = false;
|
||||
public static float Smoothing { get; private set; } = 0.5f;
|
||||
public static bool FaceOverride { get; private set; } = true;
|
||||
|
||||
static MelonLoader.MelonPreferences_Category ms_category = null;
|
||||
static List<MelonLoader.MelonPreferences_Entry> ms_entries = null;
|
||||
|
@ -43,13 +43,13 @@ namespace ml_dht
|
|||
|
||||
ms_entries = new List<MelonLoader.MelonPreferences_Entry>()
|
||||
{
|
||||
ms_category.CreateEntry(ModSetting.Enabled.ToString(), false),
|
||||
ms_category.CreateEntry(ModSetting.HeadTracking.ToString(), false),
|
||||
ms_category.CreateEntry(ModSetting.EyeTracking.ToString(), true),
|
||||
ms_category.CreateEntry(ModSetting.Blinking.ToString(), true),
|
||||
ms_category.CreateEntry(ModSetting.Mirrored.ToString(), false),
|
||||
ms_category.CreateEntry(ModSetting.Smoothing.ToString(), 50),
|
||||
ms_category.CreateEntry(ModSetting.FaceOverride.ToString(), true)
|
||||
ms_category.CreateEntry(ModSetting.Enabled.ToString(), Enabled),
|
||||
ms_category.CreateEntry(ModSetting.HeadTracking.ToString(), HeadTracking),
|
||||
ms_category.CreateEntry(ModSetting.EyeTracking.ToString(), EyeTracking),
|
||||
ms_category.CreateEntry(ModSetting.Blinking.ToString(), Blinking),
|
||||
ms_category.CreateEntry(ModSetting.Mirrored.ToString(), Mirrored),
|
||||
ms_category.CreateEntry(ModSetting.Smoothing.ToString(), (int)(Smoothing * 50f)),
|
||||
ms_category.CreateEntry(ModSetting.FaceOverride.ToString(), FaceOverride)
|
||||
};
|
||||
|
||||
Load();
|
||||
|
@ -81,13 +81,13 @@ namespace ml_dht
|
|||
|
||||
static void Load()
|
||||
{
|
||||
ms_enabled = (bool)ms_entries[(int)ModSetting.Enabled].BoxedValue;
|
||||
ms_headTracking = (bool)ms_entries[(int)ModSetting.HeadTracking].BoxedValue;
|
||||
ms_eyeTracking = (bool)ms_entries[(int)ModSetting.EyeTracking].BoxedValue;
|
||||
ms_blinking = (bool)ms_entries[(int)ModSetting.Blinking].BoxedValue;
|
||||
ms_mirrored = (bool)ms_entries[(int)ModSetting.Mirrored].BoxedValue;
|
||||
ms_smoothing = ((int)ms_entries[(int)ModSetting.Smoothing].BoxedValue) * 0.01f;
|
||||
ms_faceOverride = (bool)ms_entries[(int)ModSetting.FaceOverride].BoxedValue;
|
||||
Enabled = (bool)ms_entries[(int)ModSetting.Enabled].BoxedValue;
|
||||
HeadTracking = (bool)ms_entries[(int)ModSetting.HeadTracking].BoxedValue;
|
||||
EyeTracking = (bool)ms_entries[(int)ModSetting.EyeTracking].BoxedValue;
|
||||
Blinking = (bool)ms_entries[(int)ModSetting.Blinking].BoxedValue;
|
||||
Mirrored = (bool)ms_entries[(int)ModSetting.Mirrored].BoxedValue;
|
||||
Smoothing = ((int)ms_entries[(int)ModSetting.Smoothing].BoxedValue) * 0.01f;
|
||||
FaceOverride = (bool)ms_entries[(int)ModSetting.FaceOverride].BoxedValue;
|
||||
}
|
||||
|
||||
static void OnSliderUpdate(string p_name, string p_value)
|
||||
|
@ -98,8 +98,8 @@ namespace ml_dht
|
|||
{
|
||||
case ModSetting.Smoothing:
|
||||
{
|
||||
ms_smoothing = int.Parse(p_value) * 0.01f;
|
||||
SmoothingChange?.Invoke(ms_smoothing);
|
||||
Smoothing = int.Parse(p_value) * 0.01f;
|
||||
SmoothingChange?.Invoke(Smoothing);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -116,43 +116,43 @@ namespace ml_dht
|
|||
{
|
||||
case ModSetting.Enabled:
|
||||
{
|
||||
ms_enabled = bool.Parse(p_value);
|
||||
EnabledChange?.Invoke(ms_enabled);
|
||||
Enabled = bool.Parse(p_value);
|
||||
EnabledChange?.Invoke(Enabled);
|
||||
}
|
||||
break;
|
||||
|
||||
case ModSetting.HeadTracking:
|
||||
{
|
||||
ms_headTracking = bool.Parse(p_value);
|
||||
HeadTrackingChange?.Invoke(ms_headTracking);
|
||||
HeadTracking = bool.Parse(p_value);
|
||||
HeadTrackingChange?.Invoke(HeadTracking);
|
||||
}
|
||||
break;
|
||||
|
||||
case ModSetting.EyeTracking:
|
||||
{
|
||||
ms_eyeTracking = bool.Parse(p_value);
|
||||
EyeTrackingChange?.Invoke(ms_eyeTracking);
|
||||
EyeTracking = bool.Parse(p_value);
|
||||
EyeTrackingChange?.Invoke(EyeTracking);
|
||||
}
|
||||
break;
|
||||
|
||||
case ModSetting.Blinking:
|
||||
{
|
||||
ms_blinking = bool.Parse(p_value);
|
||||
BlinkingChange?.Invoke(ms_blinking);
|
||||
Blinking = bool.Parse(p_value);
|
||||
BlinkingChange?.Invoke(Blinking);
|
||||
}
|
||||
break;
|
||||
|
||||
case ModSetting.Mirrored:
|
||||
{
|
||||
ms_mirrored = bool.Parse(p_value);
|
||||
MirroredChange?.Invoke(ms_mirrored);
|
||||
Mirrored = bool.Parse(p_value);
|
||||
MirroredChange?.Invoke(Mirrored);
|
||||
}
|
||||
break;
|
||||
|
||||
case ModSetting.FaceOverride:
|
||||
{
|
||||
ms_faceOverride = bool.Parse(p_value);
|
||||
FaceOverrideChange?.Invoke(ms_faceOverride);
|
||||
FaceOverride = bool.Parse(p_value);
|
||||
FaceOverrideChange?.Invoke(FaceOverride);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -160,34 +160,5 @@ namespace ml_dht
|
|||
ms_entries[(int)l_setting].BoxedValue = bool.Parse(p_value);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Enabled
|
||||
{
|
||||
get => ms_enabled;
|
||||
}
|
||||
public static bool HeadTracking
|
||||
{
|
||||
get => ms_headTracking;
|
||||
}
|
||||
public static bool EyeTracking
|
||||
{
|
||||
get => ms_eyeTracking;
|
||||
}
|
||||
public static bool Blinking
|
||||
{
|
||||
get => ms_blinking;
|
||||
}
|
||||
public static bool Mirrored
|
||||
{
|
||||
get => ms_mirrored;
|
||||
}
|
||||
public static float Smoothing
|
||||
{
|
||||
get => ms_smoothing;
|
||||
}
|
||||
public static bool FaceOverride
|
||||
{
|
||||
get => ms_faceOverride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue