diff --git a/Assets/Scenes/WACVR.unity b/Assets/Scenes/WACVR.unity index feb0949..a234d01 100644 --- a/Assets/Scenes/WACVR.unity +++ b/Assets/Scenes/WACVR.unity @@ -2129,7 +2129,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6c150c011a6544b4b8054bba7ee5e5ca, type: 3} m_Name: m_EditorClassIdentifier: - searchTiming_: 1 + searchTiming_: 0 type_: 0 altTabWindow_: 1 createChildWindows_: 0 @@ -23533,12 +23533,12 @@ PrefabInstance: - target: {fileID: 6609493762104327279, guid: cf8684b3c4f47b94aa7cb23ce498caf3, type: 3} propertyPath: m_LocalPosition.y - value: 0.00074 + value: 0.00075 objectReference: {fileID: 0} - target: {fileID: 6609493762104327279, guid: cf8684b3c4f47b94aa7cb23ce498caf3, type: 3} propertyPath: m_LocalPosition.z - value: 0.01208 + value: 0.0121 objectReference: {fileID: 0} - target: {fileID: 6618956848436274754, guid: cf8684b3c4f47b94aa7cb23ce498caf3, type: 3} diff --git a/Assets/Script/Configuration/JsonConfiguration.cs b/Assets/Script/Configuration/JsonConfiguration.cs index 605c12e..d511af0 100644 --- a/Assets/Script/Configuration/JsonConfiguration.cs +++ b/Assets/Script/Configuration/JsonConfiguration.cs @@ -4,9 +4,10 @@ using UnityEngine; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.IO; +using System.Linq; public static class JsonConfiguration { - private static bool hasInitialized = false; + public static bool hasInitialized = false; private static JObject config; private static void ensureInitialization() { @@ -113,7 +114,8 @@ public static class JsonConfiguration { } public static float[] GetFloatArray(string key) { ensureInitialization(); - - return config.Value(key); + //convert JArray to float[] + return config.Value(key).ToObject(); } + } diff --git a/Assets/Script/Configuration/SettingsManager.cs b/Assets/Script/Configuration/SettingsManager.cs index 0410e73..e38b08e 100644 --- a/Assets/Script/Configuration/SettingsManager.cs +++ b/Assets/Script/Configuration/SettingsManager.cs @@ -34,9 +34,11 @@ public class SettingsManager : MonoBehaviour } void UpdateAllConfigs() { + JsonConfiguration.hasInitialized = false; UwcConfig.UpdateConfigs(); UpdatePhysicFPS(); UpdateHands(); + Debug.Log("Configs Updated"); } void UpdatePhysicFPS() @@ -46,14 +48,17 @@ public class SettingsManager : MonoBehaviour Time.fixedDeltaTime = 1/(float)JsonConfiguration.GetDouble("PhysicFPS"); } + static float HandSize; + static float[] HandPosition; + void UpdateHands() { if (!JsonConfiguration.HasKey("HandSize")) JsonConfiguration.SetDouble("HandSize", DefaultHandSize); if (!JsonConfiguration.HasKey("HandPosition")) JsonConfiguration.SetFloatArray("HandPosition", DefaultHandPosition); - float HandSize = (float)JsonConfiguration.GetDouble("HandSize"); - float[] HandPosition = JsonConfiguration.GetFloatArray("HandPosition"); + HandSize = (float)JsonConfiguration.GetDouble("HandSize"); + HandPosition = JsonConfiguration.GetFloatArray("HandPosition"); LHand.transform.localScale = new Vector3(HandSize/100,HandSize/100,HandSize/100); RHand.transform.localScale = new Vector3(HandSize/100,HandSize/100,HandSize/100); LHand.transform.localPosition = new Vector3(HandPosition[0]/100,HandPosition[1]/100,HandPosition[2]/100);