1
0
mirror of synced 2025-01-18 15:24:04 +01:00

fix white screen for ever issue and config not update issue

This commit is contained in:
xpeng 2022-06-09 22:55:37 +02:00
parent 406cbc19f1
commit 98d62503b1
3 changed files with 15 additions and 8 deletions

View File

@ -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}

View File

@ -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<float[]>(key);
//convert JArray to float[]
return config.Value<JArray>(key).ToObject<float[]>();
}
}

View File

@ -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);